type fixes
authorken <ken@mihrtec.com>
Sat, 17 Dec 2016 00:25:12 +0000 (16:25 -0800)
committerken <ken@mihrtec.com>
Sat, 17 Dec 2016 00:25:12 +0000 (16:25 -0800)
src/lexer.c
src/scanner.c

index c22525a..b01b292 100644 (file)
@@ -127,7 +127,7 @@ int lexer
    start:
   while (DE_LEN() > 0)//lex any directory entries in our stack
     {
-      if (lexer_lexfile(DE_POP()->d_name) == 0)
+      if (lexer_lexfile((uint8_t*)DE_POP()->d_name) == 0)
        FAIL("Lexer failed to tokenize [%s]\n",(*DE_STACKB)->d_name);
     }
   if (TK_EMPTY)           //if there are no tokens,
@@ -197,7 +197,7 @@ uint8_t const* lexer_get_current_filepath
 { static uint8_t        current_path[FPATH_MAX];
   static uint8_t const* last_filename;
   if ((!last_filename || last_filename != current_filename) &&
-      ((uint8_t*) realpath(current_filename, current_path) != (uint8_t*) current_path))
+      ((uint8_t*) realpath((char*)current_filename, (char*)current_path) != (uint8_t*) current_path))
     { perror("realpath: ");
       return NULL;
     }
index 36a2050..5c06a4e 100644 (file)
@@ -31,7 +31,7 @@ int   scanner(void);
 int   scanner_scanpixels(int*,int);
 /* Private */
 extern //lexer.c
-int   lexer_lexstring(const uint8_t*);
+int   lexer_lexstring(const char*);
 extern //lexer.c
 void  lexer_pushtok(int, int);
 static
@@ -41,12 +41,9 @@ extern //lexer.c
 struct dirent* lexer_direntpa[], **lexer_direntpp;
 extern //SRC_DIR/bin/tools/apc.c
 const char* cargs['Z'];
-#ifndef DL_STACKSIZE
 #define DL_STACKSIZE     64
-#endif
-#ifndef DL_CD_STACKSIZE
 #define DL_CD_STACKSIZE  DL_STACKSIZE //square tree
-#endif
+
 static
 struct dirlist
 { DIR*           dirp;
@@ -74,8 +71,8 @@ FILE* current_open_file = NULL;
 #define DL_CD_STACK     ((*DL_STACKP).child_directory_stack)
 #define DL_CD_STACKP    ((*DL_STACKP).cds)
 #define DL_CURDIR()     ((*DL_STACKP).dirp)
-#define DL_LEN()        (DL_STACKP - DL_STACK)
-#define DL_CD_LEN()     (DL_CD_STACKP - DL_CD_STACK)
+#define DL_LEN()        ((int)(DL_STACKP - DL_STACK))
+#define DL_CD_LEN()     ((int)(DL_CD_STACKP - DL_CD_STACK))
 #define DL_INIT()       (DL_STACKP = DL_STACK)
 #define DL_CD_INIT()    (DL_CD_STACKP = DL_CD_STACK)
 #define DL_POP()        ((*DL_STACKP--).dirp)
@@ -127,12 +124,11 @@ void scanner_quit
 */
 int scanner
 #define $($)#$ //stringifier
-#define ERR_CHILD  "Fatal: Maximum of " $(DL_CD_STACKSIZE)                  \
-  " child directories exceeded for directory at depth %i\n"                \
-  ,DL_LEN()
-#define ERR_DEPTH  "Fatal: Maximum directory depth of " $(DL_STACKSIZE)     \
+#define ERR_CHILD  "Fatal: Maximum of " $(DL_CD_STACKSIZE) " child "   \
+  "directories exceeded for directory at depth %i\n",DL_LEN()
+#define ERR_DEPTH  "Fatal: Maximum directory depth of " $(DL_STACKSIZE)        \
   " exceeded during directory scan\n"
-#define ERR_DL     "Fatal: Directory List Stack Corruption %x\n", DL_LEN()
+#define ERR_DL     "Fatal: Directory List Stack Corruption %i\n", DL_LEN()
 ()
 { int ntok = 0;
  scan:
@@ -183,7 +179,7 @@ int scanner_scanpixels
 ( int*  buf,
   int   max_len
 )
-{ static int col_len, row_len, row;
+{ static int /*col_len,*/ row_len = 0, row;
   //Open the current file if not yet open
   if (current_open_file == NULL) 
     { if ((current_open_file = fopen(DL_CD_CURNAME(),"rb")) == NULL)
@@ -223,9 +219,8 @@ int dredge_current_depth
 #define DPS_LEN()     (lexer_direntpp - lexer_direntpa)
 #define DPS_PUSH(E)   (*lexer_direntpp++ = E)
 ()
-{ struct dirent**  direntpp = lexer_direntpa;
-  DIR*             cwd      = DL_CURDIR();
-  struct dirent*   direntp;
+{ DIR*           cwd      = DL_CURDIR();
+  struct dirent* direntp;
   DL_CD_INIT();
  scan_next:
   if ((direntp = readdir(cwd)) != NULL)