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
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;
#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)
*/
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:
if (DL_CD_LEN() > 0) //There are entities to process
{ if (DL_CD_POP() == NULL) //If the dirent is null, then the
goto libfail; //lib function in dirent has failed
-<<<<<<< HEAD
ntok += lexer_lexstring(DL_CD_CURNAME());//lex the directory name
-=======
- ntok += lexer_lexstring(DL_CD_CURNAME()); //lex the directory name
->>>>>>> 15d3ab5e7871ff459af13089b82bf5f17f731ebd
if (DL_LEN() >= DL_STACKSIZE) //fail if maxdepth exceeded
{ fprintf(stderr, ERR_DEPTH);
goto fail;
( 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)
#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)
+ errno = 0;
+ direntp = readdir(cwd);
+ if (errno)
+ return -1;
+ if (direntp != NULL)
{ switch (direntp->d_type)
{ case DT_REG:
DPS_PUSH(direntp);
goto scan_next;
}
}
- if (errno)
- return -1;
qsort(lexer_direntpa, DPS_LEN(), sizeof direntp, (qcomp)alphasort);
return DPS_LEN();
}