Added a bunch of FIXMEs to accurately portray current technical debt.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 04 Nov 2010 02:14:51 -0400
changeset 940 bc2a5efade5e
parent 939 64cc93ee5a56
child 941 405a57d342a1
Added a bunch of FIXMEs to accurately portray current technical debt.
mojoshader.c
mojoshader_assembler.c
mojoshader_compiler.c
mojoshader_preprocessor.c
--- a/mojoshader.c	Wed Nov 03 22:54:17 2010 -0400
+++ b/mojoshader.c	Thu Nov 04 02:14:51 2010 -0400
@@ -13,6 +13,9 @@
 #define __MOJOSHADER_INTERNAL__ 1
 #include "mojoshader_internal.h"
 
+// !!! FIXME: replace this with BufferList from the preprocessor.
+// !!! FIXME: we don't need these as a list of strings, we just need a
+// !!! FIXME:  growable buffer we can flatten at the end.
 // A simple linked list of strings, so we can build the final output without
 //  realloc()ing for each new line, and easily insert lines into the middle
 //  of the output without much trouble.
@@ -275,6 +278,11 @@
     MOJOSHADER_TYPE_UNKNOWN, 0, 0, 0, 0
 };
 
+
+// !!! FIXME: cut and paste between every damned source file follows...
+// !!! FIXME: We need to make some sort of ContextBase that applies to all
+// !!! FIXME:  files and move this stuff to mojoshader_common.c ...
+
 static inline void out_of_memory(Context *ctx)
 {
     ctx->isfail = ctx->out_of_memory = 1;
@@ -383,6 +391,8 @@
 } // get_scratch_buffer
 
 
+// !!! FIXME: move the errpos calculation into Context, and we can move this
+// !!! FIXME:  to mojoshader_common.c
 static void failf(Context *ctx, const char *fmt, ...) ISPRINTF(2,3);
 static void failf(Context *ctx, const char *fmt, ...)
 {
@@ -530,6 +540,7 @@
     return ( ((uint32) regtype) | (((uint32) regnum) << 16) );
 } // reg_to_uint32
 
+// !!! FIXME: ditch this for a hash table.
 static RegisterList *reglist_insert(Context *ctx, RegisterList *prev,
                                     const RegisterType regtype,
                                     const int regnum)
@@ -824,6 +835,8 @@
 } // get_D3D_register_string
 
 
+// !!! FIXME: can we split the profile code out to separate source files?
+
 #define AT_LEAST_ONE_PROFILE 0
 
 #if !SUPPORT_PROFILE_D3D
--- a/mojoshader_assembler.c	Wed Nov 03 22:54:17 2010 -0400
+++ b/mojoshader_assembler.c	Thu Nov 04 02:14:51 2010 -0400
@@ -64,6 +64,10 @@
 } Context;
 
 
+// !!! FIXME: cut and paste between every damned source file follows...
+// !!! FIXME: We need to make some sort of ContextBase that applies to all
+// !!! FIXME:  files and move this stuff to mojoshader_common.c ...
+
 // Convenience functions for allocators...
 
 static inline void out_of_memory(Context *ctx)
@@ -102,6 +106,9 @@
     Free((Context *) data, ptr);
 } // FreeBridge
 
+
+// !!! FIXME: move the errpos calculation into Context, and we can move this
+// !!! FIXME:  to mojoshader_common.c
 static void failf(Context *ctx, const char *fmt, ...) ISPRINTF(2,3);
 static void failf(Context *ctx, const char *fmt, ...)
 {
@@ -221,7 +228,7 @@
     return ctx->tokenval;
 } // nexttoken
 
-
+// !!! FIXME: hashmap?
 static inline void add_token_sourcepos(Context *ctx, const size_t idx)
 {
     unsigned int pos = 0;
@@ -231,6 +238,7 @@
 } // add_token_sourcepos
 
 
+// !!! FIXME: use BufferList.
 static void output_token_noswap(Context *ctx, const uint32 token)
 {
     if (isfail(ctx))
@@ -281,6 +289,8 @@
     {
         const uint32 tokencount = (len / 4) + ((len % 4) ? 1 : 0);
         output_token(ctx, 0xFFFE | (tokencount << 16));
+        // !!! FIXME: we can probably just use use modulo and do this without
+        // !!! FIXME:  a tight loop with BufferList.
         while (len >= 4)
         {
             output_token_noswap(ctx, *((const uint32 *) buf));
--- a/mojoshader_compiler.c	Wed Nov 03 22:54:17 2010 -0400
+++ b/mojoshader_compiler.c	Thu Nov 04 02:14:51 2010 -0400
@@ -123,6 +123,10 @@
 } Context;
 
 
+// !!! FIXME: cut and paste between every damned source file follows...
+// !!! FIXME: We need to make some sort of ContextBase that applies to all
+// !!! FIXME:  files and move this stuff to mojoshader_common.c ...
+
 // Convenience functions for allocators...
 
 static inline void out_of_memory(Context *ctx)
@@ -308,6 +312,9 @@
 } // destroy_symbolmap
 
 
+// !!! FIXME: move this to to mojoshader_ast.c
+// !!! FIXME: new_* and delete_* should take an allocator, not a context.
+
 // These functions are mostly for construction and cleanup of nodes in the
 //  parse tree. Mostly this is simple allocation and initialization, so we
 //  can do as little in the lemon code as possible, and then sort it all out
@@ -1906,7 +1913,7 @@
     // !!! FIXME: do everything else.  :)
 } // semantic_analysis
 
-
+// !!! FIXME: isn't this a cut-and-paste of somewhere else?
 static inline int64 strtoi64(const char *str, unsigned int len)
 {
     int64 retval = 0;
@@ -1944,6 +1951,7 @@
     return retval;
 } // strtoi64
 
+// !!! FIXME: isn't this a cut-and-paste of somewhere else?
 static inline double strtodouble(const char *_str, unsigned int len)
 {
     // !!! FIXME: laziness prevails.
--- a/mojoshader_preprocessor.c	Wed Nov 03 22:54:17 2010 -0400
+++ b/mojoshader_preprocessor.c	Thu Nov 04 02:14:51 2010 -0400
@@ -284,6 +284,7 @@
 #endif  // !MOJOSHADER_FORCE_INCLUDE_CALLBACKS
 
 
+// !!! FIXME: move this stuff to mojoshader_common.c ...
 // data buffer stuff...
 
 #define BUFFER_LEN (64 * 1024)
@@ -375,6 +376,7 @@
 
 
 // !!! FIXME: maybe use these pool magic elsewhere?
+// !!! FIXME: maybe just get rid of this? (maybe the fragmentation isn't a big deal?)
 
 // Pool stuff...
 // ugh, I hate this macro salsa.
@@ -820,7 +822,7 @@
              (token == ((Token) '\n')) || (token == TOKEN_EOI) );
 } // require_newline
 
-
+// !!! FIXME: didn't we implement this by hand elsewhere?
 static int token_to_int(IncludeState *state)
 {
     assert(state->tokenval == TOKEN_INT_LITERAL);