]> git.sesse.net Git - vlc/blobdiff - modules/visualization/galaktos/parser.c
Removes trailing spaces. Removes tabs.
[vlc] / modules / visualization / galaktos / parser.c
index 8beaca46183bdfeb12b171029557df142bb4c5ab..d255290edf57b05e86eed69e3b8dec9784d48a53 100644 (file)
 #define WAVE_INIT_STRING_LENGTH 4
 
 /* Stores a line of a file as its being parsed */
-char string_line_buffer[STRING_LINE_SIZE]; 
+char string_line_buffer[STRING_LINE_SIZE];
 
 /* The current position of the string line buffer (see above) */
 int string_line_buffer_index = 0;
@@ -191,69 +191,69 @@ int string_to_float(char * string, double * float_ptr);
    to the raw string */
 
 token_t parseToken(FILE * fs, char * string) {
-  
   char c;
   int i;
-  
   if (string != NULL)
     memset(string, 0, MAX_TOKEN_SIZE);
-  
   /* Loop until a delimiter is found, or the maximum string size is found */
   for (i = 0; i < MAX_TOKEN_SIZE;i++) {
     c = fgetc(fs);
-    
     /* If the string line buffer is full, quit */
     if (string_line_buffer_index == (STRING_LINE_SIZE - 1))
       return tStringBufferFilled;
-    
     /* Otherwise add this character to the string line buffer */
     string_line_buffer[string_line_buffer_index++] = c;
     /* Now interpret the character */
     switch (c) {
-      
     case '+':
-      return tPlus; 
+      return tPlus;
     case '-':
       return tMinus;
     case '%':
       return tMod;
     case '/':
-      
       /* check for line comment here */
       if ((c = fgetc(fs)) == '/') {
-       while(1) {
-         c = fgetc(fs);
-         if (c == EOF) {
-           line_mode = NORMAL_LINE_MODE;
-           return tEOF;                                
-         }
-         if (c == '\n') {
-           line_mode = NORMAL_LINE_MODE;
-           return tEOL;
-         }
-       }
-       
+    while(1) {
+      c = fgetc(fs);
+      if (c == EOF) {
+        line_mode = NORMAL_LINE_MODE;
+        return tEOF;                
+      }
+      if (c == '\n') {
+        line_mode = NORMAL_LINE_MODE;
+        return tEOL;
+      }
+    }
+    
       }
-      
       /* Otherwise, just a regular division operator */
       ungetc(c, fs);
       return tDiv;
-      
     case '*':
       return tMult;
     case '|':
       return tOr;
     case '&':
       return tAnd;
-    case '(': 
+    case '(':
       return tLPr;
     case ')':
       return tRPr;
-    case '[': 
+    case '[':
       return tLBr;
     case ']':
       return tRBr;
-    case '=': 
+    case '=':
       return tEq;
       //    case '\r':
       //break;
@@ -272,20 +272,20 @@ token_t parseToken(FILE * fs, char * string) {
       line_count = 1;
       line_mode = NORMAL_LINE_MODE;
       return tEOF;
-      
-    default: 
+    default:
       if (string != NULL)
-       string[i] = c;
-    } 
-    
+    string[i] = c;
+    }
   }
-  
- /* String reached maximum length, return special token error */ 
+ /* String reached maximum length, return special token error */
   return tStringTooLong;
-  
 }
 
-/* Parse input in the form of "exp, exp, exp, ...)" 
+/* Parse input in the form of "exp, exp, exp, ...)"
    Returns a general expression list */
 
 gen_expr_t ** parse_prefix_args(FILE * fs, int num_args, struct PRESET_T * preset) {
@@ -293,15 +293,15 @@ gen_expr_t ** parse_prefix_args(FILE * fs, int num_args, struct PRESET_T * prese
   int i, j;
   gen_expr_t ** expr_list; /* List of arguments to function */
   gen_expr_t * gen_expr;
-  
   /* Malloc the expression list */
   expr_list =  (gen_expr_t**)malloc(sizeof(gen_expr_t*)*num_args);
-  
   /* Malloc failed */
   if (expr_list == NULL)
     return NULL;
-  
-  
   i = 0;
 
   while (i < num_args) {
@@ -309,19 +309,19 @@ gen_expr_t ** parse_prefix_args(FILE * fs, int num_args, struct PRESET_T * prese
     /* Parse the ith expression in the list */
     if ((gen_expr = parse_gen_expr(fs, NULL, preset)) == NULL) {
       //if (PARSE_DEBUG) printf("parse_prefix_args: failed to get parameter # %d for function (LINE %d)\n", i+1, line_count);
-      for (j = 0; j < i; j++) 
-       free_gen_expr(expr_list[j]);
+      for (j = 0; j < i; j++)
+    free_gen_expr(expr_list[j]);
       free(expr_list);
       return NULL;
     }
     /* Assign entry in expression list */
     expr_list[i++] = gen_expr;
   }
-  
-  //if (PARSE_DEBUG) printf("parse_prefix_args: finished parsing %d arguments (LINE %d)\n", num_args, line_count);     
+  //if (PARSE_DEBUG) printf("parse_prefix_args: finished parsing %d arguments (LINE %d)\n", num_args, line_count);    
   /* Finally, return the resulting expression list */
   return expr_list;
-  
 }
 
 /* Parses a comment at the top of the file. Stops when left bracket is found */
@@ -329,16 +329,16 @@ int parse_top_comment(FILE * fs) {
 
   char string[MAX_TOKEN_SIZE];
   token_t token;
-         
+    
   /* Process tokens until left bracket is found */
   while ((token = parseToken(fs, string)) != tLBr) {
-    if (token == tEOF) 
+    if (token == tEOF)
       return PARSE_ERROR;
   }
 
  /* Done, return success */
- return SUCCESS; 
-}      
+ return SUCCESS;
+}    
 
 /* Right Bracket is parsed by this function.
    puts a new string into name */
@@ -347,13 +347,13 @@ int parse_preset_name(FILE * fs, char * name) {
   token_t token;
 
   if (name == NULL)
-       return FAILURE;
+    return FAILURE;
 
   if ((token = parseToken(fs, name)) != tRBr)
     return PARSE_ERROR;
-       
+     
   //if (PARSE_DEBUG) printf("parse_preset_name: parsed preset (name = \"%s\")\n", name);
-  
   return SUCCESS;
 }
 
@@ -368,17 +368,17 @@ int parse_per_pixel_eqn(FILE * fs, preset_t * preset) {
   if (PARSE_DEBUG) printf("parse_per_pixel: per_pixel equation parsing start...(LINE %d)\n", line_count);
 
   if (parseToken(fs, string) != tEq) { /* parse per pixel operator  name */
-    if (PARSE_DEBUG) printf("parse_per_pixel: equal operator expected after per pixel operator \"%s\", but not found (LINE %d)\n", 
-                           string, line_count);
+    if (PARSE_DEBUG) printf("parse_per_pixel: equal operator expected after per pixel operator \"%s\", but not found (LINE %d)\n",
+                    string, line_count);
     return PARSE_ERROR;
   }
-  
   /* Parse right side of equation as an expression */
   if ((gen_expr = parse_gen_expr(fs, NULL, preset)) == NULL) {
     if (PARSE_DEBUG) printf("parse_per_pixel: equation evaluated to null? (LINE %d)\n", line_count);
     return PARSE_ERROR;
   }
-  
   /* Add the per pixel equation */
   if (add_per_pixel_eqn(string, gen_expr, preset) < 0) {
     free_gen_expr(gen_expr);
@@ -395,14 +395,14 @@ int parse_line(FILE * fs, struct PRESET_T * preset) {
   token_t token;
   init_cond_t * init_cond;
   per_frame_eqn_t * per_frame_eqn;
-  
   /* Clear the string line buffer */
   memset(string_line_buffer, 0, STRING_LINE_SIZE);
   string_line_buffer_index = 0;
-  
-  
   switch (token = parseToken(fs, eqn_string)) {
-    
     /* Invalid Cases */
   case tRBr:
   case tLPr:
@@ -416,222 +416,222 @@ int parse_line(FILE * fs, struct PRESET_T * preset) {
   case tOr:
   case tAnd:
   case tDiv:
-    
     //    if (PARSE_DEBUG) printf("parse_line: invalid token found at start of line (LINE %d)\n", line_count);
     /* Invalid token found, return a parse error */
     return PARSE_ERROR;
-    
-    
   case tEOL:  /* Empty line */
     line_mode = NORMAL_LINE_MODE;
     return SUCCESS;
-    
   case tEOF: /* End of File */
     line_mode = NORMAL_LINE_MODE;
     line_count = 1;
     return EOF;
-    
   case tSemiColon: /* Indicates end of expression */
     return SUCCESS;
-    
     /* Valid Case, either an initial condition or equation should follow */
   case tEq:
-    
-    /* CASE: PER FRAME INIT EQUATION */            
+    /* CASE: PER FRAME INIT EQUATION */    
     if (!strncmp(eqn_string, PER_FRAME_INIT_STRING, PER_FRAME_INIT_STRING_LENGTH)) {
-      
       //if (PARSE_DEBUG) printf("parse_line: per frame init equation found...(LINE %d)\n", line_count);
-      
       /* Set the line mode to normal */
       line_mode = NORMAL_LINE_MODE;
-      
       /* Parse the per frame equation */
       if ((init_cond = parse_per_frame_init_eqn(fs, preset, NULL)) == NULL) {
-       //if (PARSE_DEBUG) printf("parse_line: per frame init equation parsing failed (LINE %d)\n", line_count);
-       return PARSE_ERROR;
-      }        
-      
+    //if (PARSE_DEBUG) printf("parse_line: per frame init equation parsing failed (LINE %d)\n", line_count);
+    return PARSE_ERROR;
+      }    
       /* Insert the equation in the per frame equation tree */
       if (splay_insert(init_cond, init_cond->param->name, preset->per_frame_init_eqn_tree) < 0) {
-       //if (PARSE_DEBUG) printf("parse_line: failed to add a perframe equation (ERROR)\n");
-       free_init_cond(init_cond); /* will free the gen expr too */             
-       return ERROR;
+    //if (PARSE_DEBUG) printf("parse_line: failed to add a perframe equation (ERROR)\n");
+    free_init_cond(init_cond); /* will free the gen expr too */        
+    return ERROR;
       }
-      
-     
-      if (update_string_buffer(preset->per_frame_init_eqn_string_buffer, 
-                              &preset->per_frame_init_eqn_string_index) < 0)
-       {       return FAILURE;}
-      
+      if (update_string_buffer(preset->per_frame_init_eqn_string_buffer,
+                   &preset->per_frame_init_eqn_string_index) < 0)
+    {    return FAILURE;}
       return SUCCESS;
-      
     }
 
-    /* Per frame equation case */          
+    /* Per frame equation case */    
     if (!strncmp(eqn_string, PER_FRAME_STRING, PER_FRAME_STRING_LENGTH)) {
-      
       /* Sometimes per frame equations are implicitly defined without the
-        per_frame_ prefix. This informs the parser that one could follow */
+     per_frame_ prefix. This informs the parser that one could follow */
       line_mode = PER_FRAME_LINE_MODE;
-      
       //if (PARSE_DEBUG) printf("parse_line: per frame equation found...(LINE %d)\n", line_count);
-      
       /* Parse the per frame equation */
       if ((per_frame_eqn = parse_per_frame_eqn(fs, ++per_frame_eqn_count, preset)) == NULL) {
-       if (PARSE_DEBUG) printf("parse_line: per frame equation parsing failed (LINE %d)\n", line_count);
-       return PARSE_ERROR;
-      }        
-      
+    if (PARSE_DEBUG) printf("parse_line: per frame equation parsing failed (LINE %d)\n", line_count);
+    return PARSE_ERROR;
+      }    
       /* Insert the equation in the per frame equation tree */
       if (splay_insert(per_frame_eqn, &per_frame_eqn_count, preset->per_frame_eqn_tree) < 0) {
-       if (PARSE_DEBUG) printf("parse_line: failed to add a perframe equation (ERROR)\n");
-       free_per_frame_eqn(per_frame_eqn); /* will free the gen expr too */             
-       return ERROR;
+    if (PARSE_DEBUG) printf("parse_line: failed to add a perframe equation (ERROR)\n");
+    free_per_frame_eqn(per_frame_eqn); /* will free the gen expr too */        
+    return ERROR;
       }
-    
-      if (update_string_buffer(preset->per_frame_eqn_string_buffer, 
-                              &preset->per_frame_eqn_string_index) < 0)
-       return FAILURE;
-      
-      
-      
+      if (update_string_buffer(preset->per_frame_eqn_string_buffer,
+                   &preset->per_frame_eqn_string_index) < 0)
+    return FAILURE;
       return SUCCESS;
-      
     }
-    
     /* Wavecode initial condition case */
     if (!strncmp(eqn_string, WAVECODE_STRING, WAVECODE_STRING_LENGTH)) {
-      
           line_mode = CUSTOM_WAVE_WAVECODE_LINE_MODE;
 
-      //if (PARSE_DEBUG) 
+      //if (PARSE_DEBUG)
       //      printf("parse_line: wavecode prefix found: \"%s\"\n", eqn_string);
 
-         //      printf("string:%d\n", 5);
+      //      printf("string:%d\n", 5);
 
-         //SUPER MYSTERIO-BUG - Don't Remove
-         printf("");
-         
+      //SUPER MYSTERIO-BUG - Don't Remove
+      printf("");
+    
       return parse_wavecode(eqn_string, fs, preset);
     }
-    
     /* Custom Wave Prefix */
-    if ((!strncmp(eqn_string, WAVE_STRING, WAVE_STRING_LENGTH)) && 
-       ((eqn_string[5] >= 48) && (eqn_string[5] <= 57))) {
-      
+    if ((!strncmp(eqn_string, WAVE_STRING, WAVE_STRING_LENGTH)) &&
+    ((eqn_string[5] >= 48) && (eqn_string[5] <= 57))) {
       //    if (PARSE_DEBUG) printf("parse_line wave prefix found: \"%s\"\n", eqn_string);
-      
       return parse_wave(eqn_string, fs, preset);
-      
     }
-    
-    
     /* Shapecode initial condition case */
     if (!strncmp(eqn_string, SHAPECODE_STRING, SHAPECODE_STRING_LENGTH)) {
-      
       line_mode = CUSTOM_SHAPE_SHAPECODE_LINE_MODE;
-      
       if (PARSE_DEBUG) printf("parse_line: shapecode prefix found: \"%s\"\n", eqn_string);
-      
       return parse_shapecode(eqn_string, fs, preset);
     }
-    
     /* Custom Shape Prefix */
-    if ((!strncmp(eqn_string, SHAPE_STRING, SHAPE_STRING_LENGTH)) && 
-       ((eqn_string[6] >= 48) && (eqn_string[6] <= 57))) {
-      
+    if ((!strncmp(eqn_string, SHAPE_STRING, SHAPE_STRING_LENGTH)) &&
+    ((eqn_string[6] >= 48) && (eqn_string[6] <= 57))) {
       if (PARSE_DEBUG) printf("parse_line shape prefix found: \"%s\"\n", eqn_string);
       return parse_shape(eqn_string, fs, preset);
-      
     }
-    
     /* Per pixel equation case */
     if (!strncmp(eqn_string, PER_PIXEL_STRING, PER_PIXEL_STRING_LENGTH)) {
       line_mode = PER_PIXEL_LINE_MODE;
-      
       if (parse_per_pixel_eqn(fs, preset) < 0)
-       return PARSE_ERROR;
-      
-      
-      if (update_string_buffer(preset->per_pixel_eqn_string_buffer, 
-                              &preset->per_pixel_eqn_string_index) < 0)
-       return FAILURE;
-      
+    return PARSE_ERROR;
+      if (update_string_buffer(preset->per_pixel_eqn_string_buffer,
+                   &preset->per_pixel_eqn_string_index) < 0)
+    return FAILURE;
       if (PARSE_DEBUG) printf("parse_line: finished parsing per pixel equation (LINE %d)\n", line_count);
       return SUCCESS;
-    } 
-    
+    }
     /* Sometimes equations are written implicitly in milkdrop files, in the form
-       
-    per_frame_1 = p1 = eqn1; p2 = eqn2; p3 = eqn3;..; 
-    
+    per_frame_1 = p1 = eqn1; p2 = eqn2; p3 = eqn3;..;
     which is analagous to:
-    
     per_frame_1 = p1 = eqn1; per_frame_2 = p2 = eqn2; per_frame_3 = p3 = eqn3; ...;
-    
-    The following line mode hack allows such implicit declaration of the 
+    The following line mode hack allows such implicit declaration of the
     prefix that specifies the equation type. An alternative method
     may be to associate each equation line as list of equations separated
     by semicolons (and a new line ends the list). Instead, however, a global
     variable called "line_mode" specifies the last type of equation found,
     and bases any implicitly typed input on this fact
-    
     Note added by Carmelo Piccione (cep@andrew.cmu.edu) 10/19/03
     */
-    
     /* Per frame line mode previously, try to parse the equation implicitly */
     if (line_mode == PER_FRAME_LINE_MODE) {
       if ((per_frame_eqn = parse_implicit_per_frame_eqn(fs, eqn_string, ++per_frame_eqn_count, preset)) == NULL)
-       return PARSE_ERROR;
-      
+    return PARSE_ERROR;
       /* Insert the equation in the per frame equation tree */
       if (splay_insert(per_frame_eqn, &per_frame_eqn_count, preset->per_frame_eqn_tree) < 0) {
-       if (PARSE_DEBUG) printf("parse_line: failed to add a perframe equation (ERROR)\n");
-       free_per_frame_eqn(per_frame_eqn); /* will free the gen expr too */             
-       return ERROR;
+    if (PARSE_DEBUG) printf("parse_line: failed to add a perframe equation (ERROR)\n");
+    free_per_frame_eqn(per_frame_eqn); /* will free the gen expr too */        
+    return ERROR;
       }
-      
-      
-      if (update_string_buffer(preset->per_frame_eqn_string_buffer, 
-                              &preset->per_frame_eqn_string_index) < 0)
-       return FAILURE;
-      
-      
-      
+      if (update_string_buffer(preset->per_frame_eqn_string_buffer,
+                   &preset->per_frame_eqn_string_index) < 0)
+    return FAILURE;
       return SUCCESS;
     }
-    
     //if (PARSE_DEBUG) printf("parse_line: found initial condition: name = \"%s\" (LINE %d)\n", eqn_string, line_count);
-    
     /* Evaluate the initial condition */
     if ((init_cond = parse_init_cond(fs, eqn_string, preset)) == NULL) {
        if (PARSE_DEBUG) printf("parse_line: failed to parse initial condition (LINE %d)\n", line_count);
-      return PARSE_ERROR; 
-    }  
-    
+      return PARSE_ERROR;
+    }    
     /* Add equation to initial condition tree */
     if (splay_insert(init_cond, init_cond->param->name, preset->init_cond_tree) < 0) {
-      if (PARSE_DEBUG) printf("parse_line: failed to add initial condition \"%s\" to equation tree (LINE %d)\n", 
-                     init_cond->param->name, line_count);
+      if (PARSE_DEBUG) printf("parse_line: failed to add initial condition \"%s\" to equation tree (LINE %d)\n",
+                    init_cond->param->name, line_count);
       free_init_cond(init_cond);
       return FAILURE;
     }
-    
     /* Finished with initial condition line */
     //    if (PARSE_DEBUG) printf("parse_line: initial condition parsed successfully\n");
-    
     return SUCCESS;
-    
     /* END INITIAL CONDITIONING PARSING */
-    
-    
   default: /* an uncaught type or an error has occurred */
-    if (PARSE_DEBUG) printf("parse_line: uncaught case, token val = %d\n", token); 
+    if (PARSE_DEBUG) printf("parse_line: uncaught case, token val = %d\n", token);
     return PARSE_ERROR;
   }
-  
-  /* Because of the default in the case statement, 
-     control flow should never actually reach here */ 
+  /* Because of the default in the case statement,
+     control flow should never actually reach here */
   return PARSE_ERROR;
 }
 
@@ -639,7 +639,7 @@ int parse_line(FILE * fs, struct PRESET_T * preset) {
 
 /* Parses a general expression, this function is the meat of the parser */
 gen_expr_t * parse_gen_expr (FILE * fs, tree_expr_t * tree_expr, struct PRESET_T * preset) {
-  
   int i;
   char string[MAX_TOKEN_SIZE];
   token_t token;
@@ -652,101 +652,101 @@ gen_expr_t * parse_gen_expr (FILE * fs, tree_expr_t * tree_expr, struct PRESET_T
   switch (token = parseToken(fs,string)) {
   /* Left Parentice Case */
   case tLPr:
-    
     /* CASE 1 (Left Parentice): See if the previous string before this parentice is a function name */
     if ((func = find_func(string)) != NULL) {
         if (PARSE_DEBUG) printf("parse_gen_expr: found prefix function (name = %s) (LINE %d)\n", func->name, line_count);
-      
       /* Parse the functions arguments */
       if ((expr_list = parse_prefix_args(fs, func->num_args, preset)) == NULL) {
-       if (PARSE_DEBUG) printf("parse_prefix_args: failed to generate an expresion list! (LINE %d) \n", line_count);
-       free_tree_expr(tree_expr);
-       return NULL;
+    if (PARSE_DEBUG) printf("parse_prefix_args: failed to generate an expresion list! (LINE %d) \n", line_count);
+    free_tree_expr(tree_expr);
+    return NULL;
       }
-      
       /* Convert function to expression */
-      if ((gen_expr = prefun_to_expr((void*)func->func_ptr, expr_list, func->num_args)) == NULL)  {    
-         if (PARSE_DEBUG) printf("parse_prefix_args: failed to convert prefix function to general expression (LINE %d) \n", 
-                                       line_count);
-       free_tree_expr(tree_expr);
-       for (i = 0; i < func->num_args;i++)
-         free_gen_expr(expr_list[i]);
-       free(expr_list);
-       return NULL;
+      if ((gen_expr = prefun_to_expr((void*)func->func_ptr, expr_list, func->num_args)) == NULL)  {     
+      if (PARSE_DEBUG) printf("parse_prefix_args: failed to convert prefix function to general expression (LINE %d) \n",
+                      line_count);
+    free_tree_expr(tree_expr);
+    for (i = 0; i < func->num_args;i++)
+      free_gen_expr(expr_list[i]);
+    free(expr_list);
+    return NULL;
       }
-    
-      
-      
       token = parseToken(fs, string);
 
       if (*string != 0) {
-       if (PARSE_DEBUG) printf("parse_prefix_args: empty string expected, but not found...(LINE %d)\n", line_count);
-       /* continue anyway for now, could be implicit multiplication */                         
-      }                
-      
+    if (PARSE_DEBUG) printf("parse_prefix_args: empty string expected, but not found...(LINE %d)\n", line_count);
+    /* continue anyway for now, could be implicit multiplication */                
+      }        
       return parse_infix_op(fs, token, insert_gen_expr(gen_expr, &tree_expr), preset);
     }
-     
-    
-    /* Case 2: (Left Parentice), a string coupled with a left parentice. Either an error or implicit 
+    /* Case 2: (Left Parentice), a string coupled with a left parentice. Either an error or implicit
        multiplication operator. For now treat it as an error */
     if (*string != 0) {
       if (PARSE_DEBUG) printf("parse_gen_expr: implicit multiplication case unimplemented!\n");
       free_tree_expr(tree_expr);
       return NULL;
     }
-    
     /* CASE 3 (Left Parentice): the following is enclosed parentices to change order
        of operations. So we create a new expression tree */
-    
     if ((gen_expr = parse_gen_expr(fs, NULL, preset)) == NULL) {
       //if (PARSE_DEBUG) printf("parse_gen_expr:  found left parentice, but failed to create new expression tree \n");
       free_tree_expr(tree_expr);
       return NULL;
     }
-    
-    if (PARSE_DEBUG) printf("parse_gen_expr: finished enclosed expression tree...\n"); 
+    if (PARSE_DEBUG) printf("parse_gen_expr: finished enclosed expression tree...\n");    
     token = parseToken(fs, string);
     return parse_infix_op(fs, token, insert_gen_expr(gen_expr, &tree_expr), preset);
 
     /* Plus is a prefix operator check */
   case tPlus:
     if (*string == 0) {
-      
       //if (PARSE_DEBUG) printf("parse_gen_expr: plus used as prefix (LINE %d)\n", line_count);
 
-         /* Treat prefix plus as implict 0 preceding operator */
+      /* Treat prefix plus as implict 0 preceding operator */
       gen_expr = const_to_expr(0);
 
-      return parse_infix_op(fs, tPositive, insert_gen_expr(gen_expr, &tree_expr), preset);     
+      return parse_infix_op(fs, tPositive, insert_gen_expr(gen_expr, &tree_expr), preset);    
     }
-    
     /* Minus is a prefix operator check */
   case tMinus:
     if (*string == 0) {
-     
       /* Use the negative infix operator, but first add an implicit zero to the operator tree */
       gen_expr = const_to_expr(0);
       //return parse_gen_expr(fs, insert_gen_expr(gen_expr, &tree_expr), preset);
-               return parse_infix_op(fs, tNegative, insert_gen_expr(gen_expr, &tree_expr), preset);
+        return parse_infix_op(fs, tNegative, insert_gen_expr(gen_expr, &tree_expr), preset);
     }
-    
     /* All the following cases are strings followed by an infix operator or terminal */
   case tRPr:
-  case tEOL: 
+  case tEOL:
   case tEOF:
   case tSemiColon:
   case tComma:
-    
     /* CASE 1 (terminal): string is empty, but not null. Not sure if this will actually happen
        any more. */
     if (*string == 0) {
       //if (PARSE_DEBUG) printf("parse_gen_expr: empty string coupled with terminal (LINE %d) \n", line_count);
       return parse_infix_op(fs, token, tree_expr, preset);
-      
     }
-    
-  default:  
+  default:
 
     /* CASE 0: Empty string, parse error */
     if (*string == 0) {
@@ -758,100 +758,100 @@ gen_expr_t * parse_gen_expr (FILE * fs, tree_expr_t * tree_expr, struct PRESET_T
     /* CASE 1: Check if string is a just a floating point number */
     if (string_to_float(string, &val) != PARSE_ERROR) {
       if ((gen_expr = const_to_expr(val)) == NULL) {
-       free_tree_expr(tree_expr);
-       return NULL;
+    free_tree_expr(tree_expr);
+    return NULL;
       }
-      
       /* Parse the rest of the line */
-      return parse_infix_op(fs, token, insert_gen_expr(gen_expr, &tree_expr), preset);          
-    
+      return parse_infix_op(fs, token, insert_gen_expr(gen_expr, &tree_expr), preset);
     }
 
-      
     /* CASE 4: custom shape variable */
     if (current_shape != NULL) {
       if ((param = find_param_db(string, current_shape->param_tree, FALSE)) == NULL) {
-       if ((param = find_builtin_param(string)) == NULL)
-         if ((param = find_param_db(string, current_shape->param_tree, TRUE)) == NULL) {
-           free_tree_expr(tree_expr);
-           return NULL;
-         }
+    if ((param = find_builtin_param(string)) == NULL)
+      if ((param = find_param_db(string, current_shape->param_tree, TRUE)) == NULL) {
+        free_tree_expr(tree_expr);
+        return NULL;
       }
-      
+      }
       if (PARSE_DEBUG) {
-       printf("parse_gen_expr: custom shape parameter (name = %s)... ", param->name);
-       fflush(stdout);
-      }  
-      
+    printf("parse_gen_expr: custom shape parameter (name = %s)... ", param->name);
+    fflush(stdout);
+      }
       /* Convert parameter to an expression */
       if ((gen_expr = param_to_expr(param)) == NULL) {
-       free_tree_expr(tree_expr);
-       return NULL;
+    free_tree_expr(tree_expr);
+    return NULL;
       }
-      
       //if (PARSE_DEBUG) printf("converted to expression (LINE %d)\n", line_count);
-      
       /* Parse the rest of the line */
       return parse_infix_op(fs, token, insert_gen_expr(gen_expr, &tree_expr), preset);
     }
-    
     /* CASE 5: custom wave variable */
     if (current_wave != NULL) {
       if ((param = find_param_db(string, current_wave->param_tree, FALSE)) == NULL) {
-       if ((param = find_builtin_param(string)) == NULL) 
-         if ((param = find_param_db(string, current_wave->param_tree, TRUE)) == NULL) {
-           free_tree_expr(tree_expr);
-           return NULL;
-         }
-        
+    if ((param = find_builtin_param(string)) == NULL)
+      if ((param = find_param_db(string, current_wave->param_tree, TRUE)) == NULL) {
+        free_tree_expr(tree_expr);
+        return NULL;
+      }
       }
 
       if (PARSE_DEBUG) {
-       printf("parse_gen_expr: custom wave parameter (name = %s)... ", param->name);
-       fflush(stdout);
+    printf("parse_gen_expr: custom wave parameter (name = %s)... ", param->name);
+    fflush(stdout);
       }
-       
-       /* Convert parameter to an expression */
-       if ((gen_expr = param_to_expr(param)) == NULL) {
-         free_tree_expr(tree_expr);
-         return NULL;
-       }
-       
-       if (PARSE_DEBUG) printf("converted to expression (LINE %d)\n", line_count);
-       
-       /* Parse the rest of the line */
-       return parse_infix_op(fs, token, insert_gen_expr(gen_expr, &tree_expr), preset);
-      
+    
+    /* Convert parameter to an expression */
+    if ((gen_expr = param_to_expr(param)) == NULL) {
+      free_tree_expr(tree_expr);
+      return NULL;
+    }
+    
+    if (PARSE_DEBUG) printf("converted to expression (LINE %d)\n", line_count);
+    
+    /* Parse the rest of the line */
+    return parse_infix_op(fs, token, insert_gen_expr(gen_expr, &tree_expr), preset);
     }
 
     /* CASE 6: regular parameter. Will be created if necessary and the string has no invalid characters */
     if ((param = find_param(string, preset, P_CREATE)) != NULL) {
-      
       if (PARSE_DEBUG) {
-       printf("parse_gen_expr: parameter (name = %s)... ", param->name);
-       fflush(stdout);
-      }  
-    
-               /* Convert parameter to an expression */
+    printf("parse_gen_expr: parameter (name = %s)... ", param->name);
+    fflush(stdout);
+      }
+        /* Convert parameter to an expression */
       if ((gen_expr = param_to_expr(param)) == NULL) {
-       free_tree_expr(tree_expr);
-       return NULL;
+    free_tree_expr(tree_expr);
+    return NULL;
       }
-      
       if (PARSE_DEBUG) printf("converted to expression (LINE %d)\n", line_count);
-      
       /* Parse the rest of the line */
       return parse_infix_op(fs, token, insert_gen_expr(gen_expr, &tree_expr), preset);
-          
     }
-   
     /* CASE 7: Bad string, give up */
     if (PARSE_DEBUG) printf("parse_gen_expr: syntax error [string = \"%s\"] (LINE %d)\n", string, line_count);
     free_tree_expr(tree_expr);
     return NULL;
   }
 }
-  
 
 
 /* Inserts expressions into tree according to operator precedence.
@@ -860,70 +860,70 @@ gen_expr_t * parse_gen_expr (FILE * fs, tree_expr_t * tree_expr, struct PRESET_T
 tree_expr_t * insert_infix_op(infix_op_t * infix_op, tree_expr_t **root) {
 
   tree_expr_t * new_root;
-  
   /* Sanity check */
   if (infix_op == NULL)
     return NULL;
-  
   /* The root is null, so make this operator
      the new root */
-  
   if (*root == NULL) {
     new_root = new_tree_expr(infix_op, NULL, NULL, NULL);
     *root = new_root;
-    return new_root;           
+    return new_root;        
   }
-  
   /* The root node is not an infix function,
-     so we make this infix operator the new root  */ 
-  
+     so we make this infix operator the new root  */
   if ((*root)->infix_op == NULL) {
     new_root = new_tree_expr(infix_op, NULL, *root, NULL);
     (*root) = new_root;
     return new_root;
   }
-  
   /* The root is an infix function. If the precedence
      of the item to be inserted is greater than the root's
      precedence, then make gen_expr the root */
-  
   if (infix_op->precedence > (*root)->infix_op->precedence) {
     new_root = new_tree_expr(infix_op, NULL, *root, NULL);
     (*root) = new_root;
       return new_root;
   }
-  
   /* If control flow reaches here, use a recursive helper
      with the knowledge that the root is higher precedence
      than the item to be inserted */
-  
   insert_infix_rec(infix_op, *root);
   return *root;
-  
 }
 
 
 tree_expr_t * insert_gen_expr(gen_expr_t * gen_expr, tree_expr_t ** root) {
 
   tree_expr_t * new_root;
-  
   /* If someone foolishly passes a null
      pointer to insert, return the original tree */
-  
   if (gen_expr == NULL) {
     return *root;
   }
 
   /* If the root is null, generate a new expression tree,
      using the passed expression as the root element */
-  
   if (*root == NULL) {
     new_root = new_tree_expr(NULL, gen_expr, NULL, NULL);
     *root = new_root;
     return new_root;
   }
-  
-  
   /* Otherwise. the new element definitely will not replace the current root.
      Use a recursive helper function to do insertion */
 
@@ -933,45 +933,45 @@ tree_expr_t * insert_gen_expr(gen_expr_t * gen_expr, tree_expr_t ** root) {
 
 /* A recursive helper function to insert general expression elements into the operator tree */
 int insert_gen_rec(gen_expr_t * gen_expr, tree_expr_t * root) {
-  
   /* Trivial Case: root is null */
-  
   if (root == NULL) {
     ////if (PARSE_DEBUG) printf("insert_gen_rec: root is null, returning failure\n");
     return FAILURE;
   }
-  
-  
   /* The current node's left pointer is null, and this
      current node is an infix operator, so insert the
      general expression at the left pointer */
-  
   if ((root->left == NULL) && (root->infix_op != NULL)) {
     root->left = new_tree_expr(NULL, gen_expr, NULL, NULL);
     return SUCCESS;
   }
-  
   /* The current node's right pointer is null, and this
      current node is an infix operator, so insert the
      general expression at the right pointer */
-  
   if ((root->right == NULL) && (root->infix_op != NULL)) {
     root->right = new_tree_expr(NULL, gen_expr, NULL, NULL);
     return SUCCESS;
   }
-  
   /* Otherwise recurse down to the left. If
      this succeeds then return. If it fails, try
      recursing down to the right */
-  
-  if (insert_gen_rec(gen_expr, root->left) == FAILURE) 
+  if (insert_gen_rec(gen_expr, root->left) == FAILURE)
     return insert_gen_rec(gen_expr, root->right);
 
   /* Impossible for control flow to reach here, but in
      the world of C programming, who knows... */
-  //if (PARSE_DEBUG) printf("insert_gen_rec: should never reach here!\n");  
-  return FAILURE;      
-}      
+  //if (PARSE_DEBUG) printf("insert_gen_rec: should never reach here!\n");
+  return FAILURE;    
+}    
 
 
 /* A recursive helper function to insert infix arguments by operator precedence */
@@ -981,13 +981,13 @@ int insert_infix_rec(infix_op_t * infix_op, tree_expr_t * root) {
 
   if (root == NULL)
     return FAILURE;
-  
   /* Also shouldn't happen, also implies a (different) parse error */
 
   if (root->infix_op == NULL)
     return FAILURE;
 
-  /* Left tree is empty, attach this operator to it. 
+  /* Left tree is empty, attach this operator to it.
      I don't think this will ever happen */
   if (root->left == NULL) {
     root->left = new_tree_expr(infix_op, NULL, root->left, NULL);
@@ -1011,14 +1011,14 @@ int insert_infix_rec(infix_op_t * infix_op, tree_expr_t * root) {
     root->right = new_tree_expr(infix_op, NULL, root->right, NULL);
     return SUCCESS;
   }
-  
   /* Traverse deeper if the inserting operator precedence is less than the
      the root's right operator precedence */
-  if (infix_op->precedence < root->right->infix_op->precedence) 
+  if (infix_op->precedence < root->right->infix_op->precedence)
     return insert_infix_rec(infix_op, root->right);
 
   /* Otherwise, insert the operator here */
-  
   root->right = new_tree_expr(infix_op, NULL, root->right, NULL);
   return SUCCESS;
 
@@ -1026,11 +1026,11 @@ int insert_infix_rec(infix_op_t * infix_op, tree_expr_t * root) {
 
 /* Parses an infix operator */
 gen_expr_t * parse_infix_op(FILE * fs, token_t token, tree_expr_t * tree_expr, struct PRESET_T * preset) {
-       
+    
   gen_expr_t * gen_expr;
 
   switch (token) {
-       /* All the infix operators */
+     /* All the infix operators */
   case tPlus:
     //if (PARSE_DEBUG) printf("parse_infix_op: found addition operator (LINE %d)\n", line_count);
     return parse_gen_expr(fs, insert_infix_op(infix_add, &tree_expr), preset);
@@ -1041,41 +1041,41 @@ gen_expr_t * parse_infix_op(FILE * fs, token_t token, tree_expr_t * tree_expr, s
     //if (PARSE_DEBUG) printf("parse_infix_op: found multiplication operator (LINE %d)\n", line_count);
     return parse_gen_expr(fs, insert_infix_op(infix_mult, &tree_expr), preset);
   case tDiv:
-    //if (PARSE_DEBUG) printf("parse_infix_op: found division operator (LINE %d)\n", line_count);  
+    //if (PARSE_DEBUG) printf("parse_infix_op: found division operator (LINE %d)\n", line_count);
     return parse_gen_expr(fs, insert_infix_op(infix_div, &tree_expr), preset);
   case tMod:
-    //if (PARSE_DEBUG) printf("parse_infix_op: found modulo operator (LINE %d)\n", line_count);  
+    //if (PARSE_DEBUG) printf("parse_infix_op: found modulo operator (LINE %d)\n", line_count);
     return parse_gen_expr(fs, insert_infix_op(infix_mod, &tree_expr), preset);
-  case tOr:  
-    //if (PARSE_DEBUG) printf("parse_infix_op: found bitwise or operator (LINE %d)\n", line_count);      
+  case tOr:
+    //if (PARSE_DEBUG) printf("parse_infix_op: found bitwise or operator (LINE %d)\n", line_count);      
     return parse_gen_expr(fs, insert_infix_op(infix_or, &tree_expr), preset);
-  case tAnd:     
-    //if (PARSE_DEBUG) printf("parse_infix_op: found bitwise and operator (LINE %d)\n", line_count);     
+  case tAnd:     
+    //if (PARSE_DEBUG) printf("parse_infix_op: found bitwise and operator (LINE %d)\n", line_count);      
     return parse_gen_expr(fs, insert_infix_op(infix_and, &tree_expr), preset);
   case tPositive:
-    //if (PARSE_DEBUG) printf("parse_infix_op: found positive operator (LINE %d)\n", line_count);        
+    //if (PARSE_DEBUG) printf("parse_infix_op: found positive operator (LINE %d)\n", line_count);      
     return parse_gen_expr(fs, insert_infix_op(infix_positive, &tree_expr), preset);
   case tNegative:
-    //if (PARSE_DEBUG) printf("parse_infix_op: found negative operator (LINE %d)\n", line_count);        
+    //if (PARSE_DEBUG) printf("parse_infix_op: found negative operator (LINE %d)\n", line_count);      
     return parse_gen_expr(fs, insert_infix_op(infix_negative, &tree_expr), preset);
 
   case tEOL:
   case tEOF:
   case tSemiColon:
   case tRPr:
-  case tComma:   
-       //if (PARSE_DEBUG) printf("parse_infix_op: terminal found (LINE %d)\n", line_count);
-       gen_expr = new_gen_expr(TREE_T, (void*)tree_expr);
-       return gen_expr;
+  case tComma:    
+    //if (PARSE_DEBUG) printf("parse_infix_op: terminal found (LINE %d)\n", line_count);
+      gen_expr = new_gen_expr(TREE_T, (void*)tree_expr);
+      return gen_expr;
   default:
     //if (PARSE_DEBUG) printf("parse_infix_op: operator or terminal expected, but not found (LINE %d)\n", line_count);
     free_tree_expr(tree_expr);
     return NULL;
-  }  
+  }
 
   /* Will never happen */
   return NULL;
-  
 }
 
 /* Parses an integer, checks for +/- prefix */
@@ -1085,41 +1085,41 @@ char string[MAX_TOKEN_SIZE];
   token_t token;
   int sign;
   char * end_ptr = " ";
-       
+    
   token = parseToken(fs, string);
 
  
   switch (token) {
   case tMinus:
     sign = -1;
-    token = parseToken(fs, string); 
+    token = parseToken(fs, string);
     break;
   case tPlus:
     sign = 1;
     token = parseToken(fs, string);
     break;
-  default: 
+  default:
     sign = 1;
     break;
   }
 
  
-  if (string[0] == 0) 
+  if (string[0] == 0)
     return PARSE_ERROR;
-  
   /* Convert the string to an integer. *end_ptr
-     should end up pointing to null terminator of 'string' 
+     should end up pointing to null terminator of 'string'
      if the conversion was successful. */
   //  printf("STRING: \"%s\"\n", string);
 
   (*int_ptr) = sign*strtol(string, &end_ptr, 10);
 
   /* If end pointer is a return character or null terminator, all is well */
-  if ((*end_ptr == '\r') || (*end_ptr == '\0')) 
+  if ((*end_ptr == '\r') || (*end_ptr == '\0'))
     return SUCCESS;
 
     return PARSE_ERROR;
-  
 }
 /* Parses a floating point number */
 int string_to_float(char * string, double * float_ptr) {
@@ -1130,7 +1130,7 @@ int string_to_float(char * string, double * float_ptr) {
     return PARSE_ERROR;
 
   error_ptr = malloc(sizeof(char**));
-  
   (*float_ptr) = strtod(string, error_ptr);
  
   /* These imply a succesful parse of the string */
@@ -1138,10 +1138,10 @@ int string_to_float(char * string, double * float_ptr) {
     free(error_ptr);
     return SUCCESS;
   }
-    
   (*float_ptr) = 0;
   free(error_ptr);
-  return PARSE_ERROR;  
+  return PARSE_ERROR;
 }
 
 /* Parses a floating point number */
@@ -1151,7 +1151,7 @@ int parse_float(FILE * fs, double * float_ptr) {
   char ** error_ptr;
   token_t token;
   int sign;
-  
   error_ptr = malloc(sizeof(char**));
 
   token = parseToken(fs, string);
@@ -1159,14 +1159,14 @@ int parse_float(FILE * fs, double * float_ptr) {
   switch (token) {
   case tMinus:
   sign = -1;
-  token = parseToken(fs, string); 
+  token = parseToken(fs, string);
   break;
   case tPlus:
   sign = 1;
   token = parseToken(fs, string);
   break;
-  default: 
-    sign = 1;  
+  default:
+    sign = 1;
   }
  
   if (string[0] == 0) {
@@ -1181,68 +1181,68 @@ int parse_float(FILE * fs, double * float_ptr) {
     free(error_ptr);
     return SUCCESS;
   }
-    
   //if (PARSE_DEBUG) printf("parse_float: double conversion failed for string \"%s\"\n", string);
 
   (*float_ptr) = 0;
   free(error_ptr);
   return PARSE_ERROR;
-  
 
-  
 }
 
 /* Parses a per frame equation. That is, interprets a stream of data as a per frame equation */
 per_frame_eqn_t * parse_per_frame_eqn(FILE * fs, int index, struct PRESET_T * preset) {
-  
   char string[MAX_TOKEN_SIZE];
   param_t * param;
   per_frame_eqn_t * per_frame_eqn;
   gen_expr_t * gen_expr;
-  
   if (parseToken(fs, string) != tEq) {
     //if (PARSE_DEBUG) printf("parse_per_frame_eqn: no equal sign after string \"%s\" (LINE %d)\n", string, line_count);
-    return NULL;                       
+    return NULL;            
   }
-  
   /* Find the parameter associated with the string, create one if necessary */
-  if ((param = find_param(string, preset, P_CREATE)) == NULL) { 
-    return NULL;       
+  if ((param = find_param(string, preset, P_CREATE)) == NULL) {
+    return NULL;    
   }
-  
   /* Make sure parameter is writable */
   if (param->flags & P_FLAG_READONLY) {
-      //if (PARSE_DEBUG) printf("parse_per_frame_eqn: parameter %s is marked as read only (LINE %d)\n", param->name, line_count);  
+      //if (PARSE_DEBUG) printf("parse_per_frame_eqn: parameter %s is marked as read only (LINE %d)\n", param->name, line_count);
       return NULL;
   }
-  
   /* Parse right side of equation as an expression */
   if ((gen_expr = parse_gen_expr(fs, NULL, preset)) == NULL) {
     //if (PARSE_DEBUG) printf("parse_per_frame_eqn: equation evaluated to null (LINE %d)\n", line_count);
     return NULL;
   }
-  
   //if (PARSE_DEBUG) printf("parse_per_frame_eqn: finished per frame equation evaluation (LINE %d)\n", line_count);
-  
   /* Create a new per frame equation */
   if ((per_frame_eqn = new_per_frame_eqn(index, param, gen_expr)) == NULL) {
     //if (PARSE_DEBUG) printf("parse_per_frame_eqn: failed to create a new per frame eqn, out of memory?\n");
     free_gen_expr(gen_expr);
     return NULL;
   }
-  
   //if (PARSE_DEBUG) printf("parse_per_frame_eqn: per_frame eqn parsed succesfully\n");
-  
   return per_frame_eqn;
 }
 
 /* Parses an 'implicit' per frame equation. That is, interprets a stream of data as a per frame equation without a prefix */
 per_frame_eqn_t * parse_implicit_per_frame_eqn(FILE * fs, char * param_string, int index, struct PRESET_T * preset) {
-  
   param_t * param;
   per_frame_eqn_t * per_frame_eqn;
   gen_expr_t * gen_expr;
-  
   if (fs == NULL)
     return NULL;
   if (param_string == NULL)
@@ -1252,35 +1252,35 @@ per_frame_eqn_t * parse_implicit_per_frame_eqn(FILE * fs, char * param_string, i
 
   //rintf("param string: %s\n", param_string);
   /* Find the parameter associated with the string, create one if necessary */
-  if ((param = find_param(param_string, preset, P_CREATE)) == NULL) { 
-    return NULL;       
+  if ((param = find_param(param_string, preset, P_CREATE)) == NULL) {
+    return NULL;    
   }
-  
   //printf("parse_implicit_per_frame_eqn: param is %s\n", param->name);
 
   /* Make sure parameter is writable */
   if (param->flags & P_FLAG_READONLY) {
-    //if (PARSE_DEBUG) printf("parse_implicit_per_frame_eqn: parameter %s is marked as read only (LINE %d)\n", param->name, line_count);  
+    //if (PARSE_DEBUG) printf("parse_implicit_per_frame_eqn: parameter %s is marked as read only (LINE %d)\n", param->name, line_count);
     return NULL;
   }
-  
   /* Parse right side of equation as an expression */
   if ((gen_expr = parse_gen_expr(fs, NULL, preset)) == NULL) {
     //if (PARSE_DEBUG) printf("parse_implicit_per_frame_eqn: equation evaluated to null (LINE %d)\n", line_count);
     return NULL;
   }
-  
   //if (PARSE_DEBUG) printf("parse_implicit_per_frame_eqn: finished per frame equation evaluation (LINE %d)\n", line_count);
-  
   /* Create a new per frame equation */
   if ((per_frame_eqn = new_per_frame_eqn(index, param, gen_expr)) == NULL) {
     //if (PARSE_DEBUG) printf("parse_implicit_per_frame_eqn: failed to create a new per frame eqn, out of memory?\n");
     free_gen_expr(gen_expr);
     return NULL;
   }
-  
   //if (PARSE_DEBUG) printf("parse_implicit_per_frame_eqn: per_frame eqn parsed succesfully\n");
-  
   return per_frame_eqn;
 }
 
@@ -1290,37 +1290,37 @@ init_cond_t * parse_init_cond(FILE * fs, char * name, struct PRESET_T * preset)
   param_t * param;
   value_t init_val;
   init_cond_t * init_cond;
-       
+    
   if (name == NULL)
     return NULL;
   if (preset == NULL)
     return NULL;
-  
   /* Search for the paramater in the database, creating it if necessary */
   if ((param = find_param(name, preset, P_CREATE)) == NULL) {
     return NULL;
   }
-  
   //if (PARSE_DEBUG) printf("parse_init_cond: parameter = \"%s\" (LINE %d)\n", param->name, line_count);
-  
   if (param->flags & P_FLAG_READONLY) {
     //if (PARSE_DEBUG) printf("parse_init_cond: builtin parameter \"%s\" marked as read only!\n", param->name);
     return NULL;
-  }            
-  
+  }        
   /* At this point, a parameter has been created or was found
      in the database. */
-  
   //if (PARSE_DEBUG) printf("parse_init_cond: parsing initial condition value... (LINE %d)\n", line_count);
-  
   /* integer value (boolean is an integer in C) */
   if ((param->type == P_TYPE_INT) || (param->type == P_TYPE_BOOL)) {
-    if ((parse_int(fs, (int*)&init_val.int_val)) == PARSE_ERROR) {     
+    if ((parse_int(fs, (int*)&init_val.int_val)) == PARSE_ERROR) {    
       //if (PARSE_DEBUG) printf("parse_init_cond: error parsing integer!\n");
       return NULL;
     }
   }
-  
   /* double value */
   else if (param->type == P_TYPE_DOUBLE) {
     if ((parse_float(fs, (double*)&init_val.double_val)) == PARSE_ERROR) {
@@ -1328,26 +1328,26 @@ init_cond_t * parse_init_cond(FILE * fs, char * name, struct PRESET_T * preset)
       return NULL;
     }
   }
-  
   /* Unknown value */
   else {
     //if (PARSE_DEBUG) printf("parse_init_cond: unknown parameter type!\n");
     return NULL;
   }
-  
   /* Create new initial condition */
   if ((init_cond = new_init_cond(param, init_val)) == NULL) {
       //if (PARSE_DEBUG) printf("parse_init_cond: new_init_cond failed!\n");
       return NULL;
   }
-  
   /* Finished */
   return init_cond;
 }
 
 /* Parses a per frame init equation, not sure if this works right now */
 init_cond_t * parse_per_frame_init_eqn(FILE * fs, struct PRESET_T * preset, splaytree_t * database) {
-  
   char name[MAX_TOKEN_SIZE];
   param_t * param = NULL;
   value_t init_val;
@@ -1364,7 +1364,7 @@ init_cond_t * parse_per_frame_init_eqn(FILE * fs, struct PRESET_T * preset, spla
 
   if ((token = parseToken(fs, name)) != tEq)
     return NULL;
-  
 
   /* If a database was specified,then use find_param_db instead */
   if ((database != NULL) && ((param = find_param_db(name, database, TRUE)) == NULL)) {
@@ -1375,19 +1375,19 @@ init_cond_t * parse_per_frame_init_eqn(FILE * fs, struct PRESET_T * preset, spla
   if ((param == NULL) && ((param = find_param(name, preset, P_CREATE)) == NULL)) {
     return NULL;
   }
-  
   //if (PARSE_DEBUG) printf("parse_per_frame_init_eqn: parameter = \"%s\" (LINE %d)\n", param->name, line_count);
-  
   if (param->flags & P_FLAG_READONLY) {
     //if (PARSE_DEBUG) printf("pars_per_frame_init_eqn: builtin parameter \"%s\" marked as read only!\n", param->name);
     return NULL;
-  }            
-  
+  }        
   /* At this point, a parameter has been created or was found
      in the database. */
-  
   //if (PARSE_DEBUG) printf("parse_per_frame_init_eqn: parsing right hand side of per frame init equation.. (LINE %d)\n", line_count);
-  
   if ((gen_expr = parse_gen_expr(fs, NULL, preset)) == NULL) {
     //if (PARSE_DEBUG) printf("parse_per_frame_init_eqn: failed to parse general expresion!\n");
     return NULL;
@@ -1395,7 +1395,7 @@ init_cond_t * parse_per_frame_init_eqn(FILE * fs, struct PRESET_T * preset, spla
  
   /* Compute initial condition value */
   val = eval_gen_expr(gen_expr);
-  
   /* Free the general expression now that we are done with it */
   free_gen_expr(gen_expr);
 
@@ -1403,18 +1403,18 @@ init_cond_t * parse_per_frame_init_eqn(FILE * fs, struct PRESET_T * preset, spla
   if ((param->type == P_TYPE_INT) || (param->type == P_TYPE_BOOL)) {
     init_val.int_val = (int)val;
   }
-  
   /* double value */
   else if (param->type == P_TYPE_DOUBLE) {
     init_val.double_val = val;
   }
-  
   /* Unknown value */
   else {
     //if (PARSE_DEBUG) printf("parse_per_frame_init_eqn: unknown parameter type!\n");
     return NULL;
   }
-  
 
   /* Create new initial condition */
   if ((init_cond = new_init_cond(param, init_val)) == NULL) {
@@ -1445,11 +1445,11 @@ int parse_wavecode(char * token, FILE * fs, preset_t * preset) {
     return FAILURE;
 
   /* token should be in the form wavecode_N_var, such as wavecode_1_samples */
-  
   /* Get id and variable name from token string */
-  if (parse_wavecode_prefix(token, &id, &var_string) < 0)   
+  if (parse_wavecode_prefix(token, &id, &var_string) < 0)
     return PARSE_ERROR;
-  
   //if (PARSE_DEBUG) printf("parse_wavecode: wavecode id = %d, parameter = \"%s\"\n", id, var_string);
 
   /* Retrieve custom wave information from preset. The 3rd argument
@@ -1468,12 +1468,12 @@ int parse_wavecode(char * token, FILE * fs, preset_t * preset) {
 
   /* integer value (boolean is an integer in C) */
   if ((param->type == P_TYPE_INT) || (param->type == P_TYPE_BOOL)) {
-    if ((parse_int(fs, (int*)&init_val.int_val)) == PARSE_ERROR) {     
+    if ((parse_int(fs, (int*)&init_val.int_val)) == PARSE_ERROR) {    
       //if (PARSE_DEBUG) printf("parse_wavecode: error parsing integer!\n");
       return PARSE_ERROR;
     }
   }
-  
   /* double value */
   else if (param->type == P_TYPE_DOUBLE) {
     if ((parse_float(fs, (double*)&init_val.double_val)) == PARSE_ERROR) {
@@ -1481,19 +1481,19 @@ int parse_wavecode(char * token, FILE * fs, preset_t * preset) {
       return PARSE_ERROR;
     }
   }
-  
   /* Unknown value */
   else {
     //if (PARSE_DEBUG) printf("parse_wavecode: unknown parameter type!\n");
     return PARSE_ERROR;
   }
-  
   /* Create new initial condition */
   if ((init_cond = new_init_cond(param, init_val)) == NULL) {
       //if (PARSE_DEBUG) printf("parse_wavecode: new_init_cond failed!\n");
       return FAILURE;
   }
-  
   if (splay_insert(init_cond, param->name, custom_wave->init_cond_tree) < 0) {
     free_init_cond(init_cond);
     return PARSE_ERROR;
@@ -1521,11 +1521,11 @@ int parse_shapecode(char * token, FILE * fs, preset_t * preset) {
     return FAILURE;
 
   /* token should be in the form shapecode_N_var, such as shapecode_1_samples */
-  
   /* Get id and variable name from token string */
-  if (parse_shapecode_prefix(token, &id, &var_string) < 0)   
+  if (parse_shapecode_prefix(token, &id, &var_string) < 0)
     return PARSE_ERROR;
-  
   //if (PARSE_DEBUG) printf("parse_shapecode: shapecode id = %d, parameter = \"%s\"\n", id, var_string);
 
   /* Retrieve custom shape information from preset. The 3rd argument
@@ -1545,12 +1545,12 @@ int parse_shapecode(char * token, FILE * fs, preset_t * preset) {
 
   /* integer value (boolean is an integer in C) */
   if ((param->type == P_TYPE_INT) || (param->type == P_TYPE_BOOL)) {
-    if ((parse_int(fs, (int*)&init_val.int_val)) == PARSE_ERROR) {     
+    if ((parse_int(fs, (int*)&init_val.int_val)) == PARSE_ERROR) {    
       //if (PARSE_DEBUG) printf("parse_shapecode: error parsing integer!\n");
       return PARSE_ERROR;
     }
   }
-  
   /* double value */
   else if (param->type == P_TYPE_DOUBLE) {
     if ((parse_float(fs, (double*)&init_val.double_val)) == PARSE_ERROR) {
@@ -1558,13 +1558,13 @@ int parse_shapecode(char * token, FILE * fs, preset_t * preset) {
       return PARSE_ERROR;
     }
   }
-  
   /* Unknown value */
   else {
     //if (PARSE_DEBUG) printf("parse_shapecode: unknown parameter type!\n");
     return PARSE_ERROR;
   }
-  
   /* Create new initial condition */
   if ((init_cond = new_init_cond(param, init_val)) == NULL) {
       //if (PARSE_DEBUG) printf("parse_shapecode: new_init_cond failed!\n");
@@ -1585,14 +1585,14 @@ int parse_shapecode(char * token, FILE * fs, preset_t * preset) {
 int parse_wavecode_prefix(char * token, int * id, char ** var_string) {
 
   int len, i, j;
-  
   if (token == NULL)
     return FAILURE;
   if (*var_string == NULL)
     return FAILURE;
   if (id == NULL)
     return FAILURE;
-  
   len = strlen(token);
 
   /* Move pointer passed "wavecode_" prefix */
@@ -1601,12 +1601,12 @@ int parse_wavecode_prefix(char * token, int * id, char ** var_string) {
   i = WAVECODE_STRING_LENGTH;
   j = 0;
   (*id) = 0;
-  
   /* This loop grabs the integer id for this custom wave */
   while ((i < len) && (token[i] >=  48) && (token[i] <= 57)) {
     if (j >= MAX_TOKEN_SIZE)
       return FAILURE;
-    
     (*id) = 10*(*id) + (token[i]-48);
     j++;
     i++;
@@ -1615,7 +1615,7 @@ int parse_wavecode_prefix(char * token, int * id, char ** var_string) {
  
   if (i > (len - 2))
     return FAILURE;
-  
   *var_string = token + i + 1;
  
   return SUCCESS;
@@ -1626,14 +1626,14 @@ int parse_wavecode_prefix(char * token, int * id, char ** var_string) {
 int parse_shapecode_prefix(char * token, int * id, char ** var_string) {
 
   int len, i, j;
-  
   if (token == NULL)
     return FAILURE;
   if (*var_string == NULL)
     return FAILURE;
   if (id == NULL)
     return FAILURE;
-  
   len = strlen(token);
 
   /* Move pointer passed "shapecode_" prefix */
@@ -1642,12 +1642,12 @@ int parse_shapecode_prefix(char * token, int * id, char ** var_string) {
   i = SHAPECODE_STRING_LENGTH;
   j = 0;
   (*id) = 0;
-  
   /* This loop grabs the integer id for this custom shape */
   while ((i < len) && (token[i] >=  48) && (token[i] <= 57)) {
     if (j >= MAX_TOKEN_SIZE)
       return FAILURE;
-    
     (*id) = 10*(*id) + (token[i]-48);
     j++;
     i++;
@@ -1656,7 +1656,7 @@ int parse_shapecode_prefix(char * token, int * id, char ** var_string) {
  
   if (i > (len - 2))
     return FAILURE;
-  
   *var_string = token + i + 1;
  
   return SUCCESS;
@@ -1666,14 +1666,14 @@ int parse_shapecode_prefix(char * token, int * id, char ** var_string) {
 int parse_wave_prefix(char * token, int * id, char ** eqn_string) {
 
   int len, i, j;
-  
   if (token == NULL)
     return FAILURE;
   if (eqn_string == NULL)
     return FAILURE;
   if (id == NULL)
     return FAILURE;
-  
   len = strlen(token);
  
   if (len <= WAVE_STRING_LENGTH)
@@ -1683,12 +1683,12 @@ int parse_wave_prefix(char * token, int * id, char ** eqn_string) {
   i = WAVE_STRING_LENGTH;
   j = 0;
   (*id) = 0;
-  
   /* This loop grabs the integer id for this custom wave */
   while ((i < len) && (token[i] >=  48) && (token[i] <= 57)) {
     if (j >= MAX_TOKEN_SIZE)
       return FAILURE;
-    
     (*id) = 10*(*id) + (token[i]-48);
     j++;
     i++;
@@ -1706,14 +1706,14 @@ int parse_wave_prefix(char * token, int * id, char ** eqn_string) {
 int parse_shape_prefix(char * token, int * id, char ** eqn_string) {
 
   int len, i, j;
-  
   if (token == NULL)
     return FAILURE;
   if (eqn_string == NULL)
     return FAILURE;
   if (id == NULL)
     return FAILURE;
-  
   len = strlen(token);
  
   if (len <= SHAPE_STRING_LENGTH)
@@ -1723,12 +1723,12 @@ int parse_shape_prefix(char * token, int * id, char ** eqn_string) {
   i = SHAPE_STRING_LENGTH;
   j = 0;
   (*id) = 0;
-  
   /* This loop grabs the integer id for this custom wave */
   while ((i < len) && (token[i] >=  48) && (token[i] <= 57)) {
     if (j >= MAX_TOKEN_SIZE)
       return FAILURE;
-    
     (*id) = 10*(*id) + (token[i]-48);
     j++;
     i++;
@@ -1745,7 +1745,7 @@ int parse_shape_prefix(char * token, int * id, char ** eqn_string) {
 
 /* Parses custom wave equations */
 int parse_wave(char * token, FILE * fs, preset_t * preset) {
-  
   int id;
   char * eqn_type;
   char string[MAX_TOKEN_SIZE];
@@ -1761,7 +1761,7 @@ int parse_wave(char * token, FILE * fs, preset_t * preset) {
     return FAILURE;
   if (preset == NULL)
     return FAILURE;
-  
   /* Grab custom wave id and equation type (per frame or per point) from string token */
   if (parse_wave_prefix(token, &id, &eqn_type) < 0) {
     //if (PARSE_DEBUG) printf("parse_wave: syntax error in custom wave prefix!\n");
@@ -1772,7 +1772,7 @@ int parse_wave(char * token, FILE * fs, preset_t * preset) {
     return FAILURE;
 
 
-  /* per frame init equation case */       
+  /* per frame init equation case */    
   if (!strncmp(eqn_type, WAVE_INIT_STRING, WAVE_INIT_STRING_LENGTH)) {
 
     //if (PARSE_DEBUG) printf("parse_wave (per frame init): [begin] (LINE %d)\n", line_count);
@@ -1781,46 +1781,46 @@ int parse_wave(char * token, FILE * fs, preset_t * preset) {
     if ((init_cond = parse_per_frame_init_eqn(fs, preset, custom_wave->param_tree)) == NULL) {
       //if (PARSE_DEBUG) printf("parse_wave (per frame init): equation parsing failed (LINE %d)\n", line_count);
       return PARSE_ERROR;
-    }  
+    }    
 
     /* Insert the equation in the per frame equation tree */
     if (splay_insert(init_cond, init_cond->param->name, custom_wave->per_frame_init_eqn_tree) < 0) {
       //if (PARSE_DEBUG) printf("parse_wave (per frame init): failed to add equation (ERROR)\n");
-       free_init_cond(init_cond); /* will free the gen expr too */             
+       free_init_cond(init_cond); /* will free the gen expr too */        
       return FAILURE;
     }
-   
-    if (update_string_buffer(custom_wave->per_frame_init_eqn_string_buffer, 
-                            &custom_wave->per_frame_init_eqn_string_index) < 0)
+    if (update_string_buffer(custom_wave->per_frame_init_eqn_string_buffer,
+                 &custom_wave->per_frame_init_eqn_string_index) < 0)
       return FAILURE;
-       
+    
     return SUCCESS;
-  
   }
 
   /* per frame equation case */
   if (!strncmp(eqn_type, PER_FRAME_STRING_NO_UNDERSCORE, PER_FRAME_STRING_NO_UNDERSCORE_LENGTH)) {
 
     //if (PARSE_DEBUG) printf("parse_wave (per_frame): [start] (custom wave id = %d)\n", custom_wave->id);
-    
     if (parseToken(fs, string) != tEq) {
       //if (PARSE_DEBUG) printf("parse_wave (per_frame): no equal sign after string \"%s\" (LINE %d)\n", string, line_count);
-      return PARSE_ERROR;                      
+      return PARSE_ERROR;            
     }
-  
     /* Find the parameter associated with the string in the custom wave database */
-    if ((param = find_param_db(string, custom_wave->param_tree, TRUE)) == NULL) { 
+    if ((param = find_param_db(string, custom_wave->param_tree, TRUE)) == NULL) {
       //if (PARSE_DEBUG) printf("parse_wave (per_frame): parameter \"%s\" not found or cannot be malloc'ed!!\n", string);
-      return FAILURE;  
+      return FAILURE;    
     }
-  
-    
     /* Make sure parameter is writable */
     if (param->flags & P_FLAG_READONLY) {
-      //if (PARSE_DEBUG) printf("parse_wave (per_frame): parameter %s is marked as read only (LINE %d)\n", param->name, line_count);  
+      //if (PARSE_DEBUG) printf("parse_wave (per_frame): parameter %s is marked as read only (LINE %d)\n", param->name, line_count);
       return FAILURE;
     }
-  
     /* Parse right side of equation as an expression */
 
     current_wave = custom_wave;
@@ -1833,7 +1833,7 @@ int parse_wave(char * token, FILE * fs, preset_t * preset) {
     current_wave = NULL;
 
     //if (PARSE_DEBUG) printf("parse_wave (per_frame): [finished parsing equation] (LINE %d)\n", line_count);
-  
     /* Create a new per frame equation */
     if ((per_frame_eqn = new_per_frame_eqn(custom_wave->per_frame_count++, param, gen_expr)) == NULL) {
       //if (PARSE_DEBUG) printf("parse_wave (per_frame): failed to create a new per frame eqn, out of memory?\n");
@@ -1845,15 +1845,15 @@ int parse_wave(char * token, FILE * fs, preset_t * preset) {
       free_per_frame_eqn(per_frame_eqn);
       return FAILURE;
     }
-       
-    //if (PARSE_DEBUG) printf("parse_wave (per_frame): equation %d associated with custom wave %d [success]\n", 
-    //                     per_frame_eqn->index, custom_wave->id);
+    //if (PARSE_DEBUG) printf("parse_wave (per_frame): equation %d associated with custom wave %d [success]\n",
+    //                per_frame_eqn->index, custom_wave->id);
 
-    
-    /* Need to add stuff to string buffer so the editor can read the equations. 
+    /* Need to add stuff to string buffer so the editor can read the equations.
        Why not make a nice little helper function for this? - here it is: */
 
-   
     if (update_string_buffer(custom_wave->per_frame_eqn_string_buffer, &custom_wave->per_frame_eqn_string_index) < 0)
       return FAILURE;
 
@@ -1871,7 +1871,7 @@ int parse_wave(char * token, FILE * fs, preset_t * preset) {
       //if (PARSE_DEBUG) printf("parse_wave (per_point): equal operator missing after per pixel operator! (LINE %d)\n", line_count);
       return PARSE_ERROR;
     }
-    
     /* Parse right side of equation as an expression */
     current_wave = custom_wave;
     if ((gen_expr = parse_gen_expr(fs, NULL, preset)) == NULL) {
@@ -1886,7 +1886,7 @@ int parse_wave(char * token, FILE * fs, preset_t * preset) {
       return PARSE_ERROR;
     }
 
-   
     if (update_string_buffer(custom_wave->per_point_eqn_string_buffer, &custom_wave->per_point_eqn_string_index) < 0)
       return FAILURE;
 
@@ -1903,7 +1903,7 @@ int parse_wave(char * token, FILE * fs, preset_t * preset) {
 
 /* Parses custom shape equations */
 int parse_shape(char * token, FILE * fs, preset_t * preset) {
-  
   int id;
   char * eqn_type;
   char string[MAX_TOKEN_SIZE];
@@ -1920,7 +1920,7 @@ int parse_shape(char * token, FILE * fs, preset_t * preset) {
     return FAILURE;
   if (preset == NULL)
     return FAILURE;
-  
   /* Grab custom shape id and equation type (per frame or per point) from string token */
   if (parse_shape_prefix(token, &id, &eqn_type) < 0) {
     //if (PARSE_DEBUG) printf("parse_shape: syntax error in custom shape prefix!\n");
@@ -1931,7 +1931,7 @@ int parse_shape(char * token, FILE * fs, preset_t * preset) {
     return FAILURE;
 
 
-  /* per frame init equation case */       
+  /* per frame init equation case */    
   if (!strncmp(eqn_type, SHAPE_INIT_STRING, SHAPE_INIT_STRING_LENGTH)) {
 
     //if (PARSE_DEBUG) printf("parse_shape (per frame init): [begin] (LINE %d)\n", line_count);
@@ -1940,46 +1940,46 @@ int parse_shape(char * token, FILE * fs, preset_t * preset) {
     if ((init_cond = parse_per_frame_init_eqn(fs, preset, custom_shape->param_tree)) == NULL) {
       //if (PARSE_DEBUG) printf("parse_shape (per frame init): equation parsing failed (LINE %d)\n", line_count);
       return PARSE_ERROR;
-    }  
-    
+    }    
     /* Insert the equation in the per frame equation tree */
     if (splay_insert(init_cond, init_cond->param->name, custom_shape->per_frame_init_eqn_tree) < 0) {
       //if (PARSE_DEBUG) printf("parse_shape (per frame init): failed to add equation (ERROR)\n");
-      free_init_cond(init_cond); /* will free the gen expr too */              
+      free_init_cond(init_cond); /* will free the gen expr too */        
       return ERROR;
     }
 
-    if (update_string_buffer(custom_shape->per_frame_init_eqn_string_buffer, 
-                            &custom_shape->per_frame_init_eqn_string_index) < 0)
+    if (update_string_buffer(custom_shape->per_frame_init_eqn_string_buffer,
+                 &custom_shape->per_frame_init_eqn_string_index) < 0)
       return FAILURE;
-       
+    
     return SUCCESS;
-  
   }
 
   /* per frame equation case */
   if (!strncmp(eqn_type, PER_FRAME_STRING_NO_UNDERSCORE, PER_FRAME_STRING_NO_UNDERSCORE_LENGTH)) {
 
     //if (PARSE_DEBUG) printf("parse_shape (per_frame): [start] (custom shape id = %d)\n", custom_shape->id);
-    
     if (parseToken(fs, string) != tEq) {
       //if (PARSE_DEBUG) printf("parse_shape (per_frame): no equal sign after string \"%s\" (LINE %d)\n", string, line_count);
-      return PARSE_ERROR;                      
+      return PARSE_ERROR;            
     }
-  
     /* Find the parameter associated with the string in the custom shape database */
-    if ((param = find_param_db(string, custom_shape->param_tree, TRUE)) == NULL) { 
+    if ((param = find_param_db(string, custom_shape->param_tree, TRUE)) == NULL) {
       //if (PARSE_DEBUG) printf("parse_shape (per_frame): parameter \"%s\" not found or cannot be malloc'ed!!\n", string);
-      return FAILURE;  
+      return FAILURE;    
     }
-  
-    
     /* Make sure parameter is writable */
     if (param->flags & P_FLAG_READONLY) {
-      //if (PARSE_DEBUG) printf("parse_shape (per_frame): parameter %s is marked as read only (LINE %d)\n", param->name, line_count);  
+      //if (PARSE_DEBUG) printf("parse_shape (per_frame): parameter %s is marked as read only (LINE %d)\n", param->name, line_count);
       return FAILURE;
     }
-  
     /* Parse right side of equation as an expression */
 
     current_shape = custom_shape;
@@ -1992,7 +1992,7 @@ int parse_shape(char * token, FILE * fs, preset_t * preset) {
     current_shape = NULL;
 
     //if (PARSE_DEBUG) printf("parse_shape (per_frame): [finished parsing equation] (LINE %d)\n", line_count);
-  
     /* Create a new per frame equation */
     if ((per_frame_eqn = new_per_frame_eqn(custom_shape->per_frame_count++, param, gen_expr)) == NULL) {
       //if (PARSE_DEBUG) printf("parse_shape (per_frame): failed to create a new per frame eqn, out of memory?\n");
@@ -2004,14 +2004,14 @@ int parse_shape(char * token, FILE * fs, preset_t * preset) {
       free_per_frame_eqn(per_frame_eqn);
       return FAILURE;
     }
-       
-    //if (PARSE_DEBUG) printf("parse_shape (per_frame): equation %d associated with custom shape %d [success]\n", 
-    //                     per_frame_eqn->index, custom_shape->id);
+    //if (PARSE_DEBUG) printf("parse_shape (per_frame): equation %d associated with custom shape %d [success]\n",
+    //                per_frame_eqn->index, custom_shape->id);
 
-    
     /* Need to add stuff to string buffer so the editor can read the equations.
        Why not make a nice little helper function for this? - here it is: */
-    
     if (update_string_buffer(custom_shape->per_frame_eqn_string_buffer, &custom_shape->per_frame_eqn_string_index) < 0)
       return FAILURE;
 
@@ -2035,7 +2035,7 @@ int update_string_buffer(char * buffer, int * index) {
   if (!index)
     return FAILURE;
 
-  
   /* If the string line buffer used by the parser is already full then quit */
   if (string_line_buffer_index == (STRING_LINE_SIZE-1))
     return FAILURE;
@@ -2055,20 +2055,20 @@ int update_string_buffer(char * buffer, int * index) {
     return FAILURE;
 
   /* Add line to string buffer */
-  strncpy(buffer + (*index), 
-         string_line_buffer + skip_size, string_length);
-  
+  strncpy(buffer + (*index),
+      string_line_buffer + skip_size, string_length);
   /* Buffer full, quit */
   if ((*index) > (STRING_BUFFER_SIZE - 1)) {
     //if (PARSE_DEBUG) printf("update_string_buffer: string buffer full!\n");
     return FAILURE;
-  }    
-  
+  }    
   /* Otherwise, increment string index by the added string length */
   (*index)+=string_length;
-    
   return SUCCESS;
-  
 }
 
 
@@ -2079,14 +2079,14 @@ int update_string_buffer(char * buffer, int * index) {
 */
 
 int get_string_prefix_len(char * string) {
-  
   int i = 0;
 
   /* Null argument check */
   if (string == NULL)
     return FAILURE;
 
-  
   /* First find the equal sign */
   while (string[i] != '=') {
     if (string[i] == 0)