From: borutr Date: Sat, 16 Sep 2006 14:10:20 +0000 (+0000) Subject: * debugger/mcs51/sdcdb.c: partially fixed X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=218c0cb45cb377b23593125418f8e837ee0f72d5;p=fw%2Fsdcc * debugger/mcs51/sdcdb.c: partially fixed [ 1203664 ] sdcdb fails to open files w. two "." periods * debugger/mcs51/simi.c, debugger/mcs51/symtab.c, debugger/mcs51/symtab.h: fixed indenting * configure.in, configure: up to date with latest Maarten's changes git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4379 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 0207c575..aa11c5f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-09-16 Borut Razem + + * debugger/mcs51/sdcdb.c: partially fixed + [ 1203664 ] sdcdb fails to open files w. two "." periods + * debugger/mcs51/simi.c, debugger/mcs51/symtab.c, + debugger/mcs51/symtab.h: fixed indenting + * configure.in, configure: up to date with latest Maarten's changes + 2006-09-15 Maarten Brock as/link/mcs51 diff --git a/configure b/configure index 6d3de06d..fd3d0f97 100755 --- a/configure +++ b/configure @@ -8135,7 +8135,7 @@ if test $OPT_DISABLE_HC08 = 0; then fi if test $OPT_DISABLE_MCS51 = 0; then - ac_config_files="$ac_config_files src/mcs51/Makefile as/mcs51/Makefile as/link/mcs51/Makefile debugger/mcs51/Makefile" + ac_config_files="$ac_config_files src/mcs51/Makefile as/mcs51/Makefile as/link/mcs51/Makefile debugger/mcs51/Makefile" test $OPT_DISABLE_DEVICE_LIB = 0 && ac_config_files="$ac_config_files device/lib/mcs51/Makefile device/lib/small/Makefile device/lib/medium/Makefile device/lib/large/Makefile" @@ -8710,6 +8710,7 @@ do "device/lib/hc08/Makefile" ) CONFIG_FILES="$CONFIG_FILES device/lib/hc08/Makefile" ;; "src/mcs51/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/mcs51/Makefile" ;; "as/mcs51/Makefile" ) CONFIG_FILES="$CONFIG_FILES as/mcs51/Makefile" ;; + "as/link/mcs51/Makefile" ) CONFIG_FILES="$CONFIG_FILES as/link/mcs51/Makefile" ;; "debugger/mcs51/Makefile" ) CONFIG_FILES="$CONFIG_FILES debugger/mcs51/Makefile" ;; "device/lib/mcs51/Makefile" ) CONFIG_FILES="$CONFIG_FILES device/lib/mcs51/Makefile" ;; "device/lib/small/Makefile" ) CONFIG_FILES="$CONFIG_FILES device/lib/small/Makefile" ;; @@ -8721,8 +8722,8 @@ do "src/z80/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/z80/Makefile" ;; "as/Makefile" ) CONFIG_FILES="$CONFIG_FILES as/Makefile" ;; "as/z80/Makefile" ) CONFIG_FILES="$CONFIG_FILES as/z80/Makefile" ;; - "link/Makefile" ) CONFIG_FILES="$CONFIG_FILES link/Makefile" ;; - "link/z80/Makefile" ) CONFIG_FILES="$CONFIG_FILES link/z80/Makefile" ;; + "as/link/Makefile" ) CONFIG_FILES="$CONFIG_FILES as/link/Makefile" ;; + "as/link/z80/Makefile" ) CONFIG_FILES="$CONFIG_FILES as/link/z80/Makefile" ;; "device/lib/z80/Makefile" ) CONFIG_FILES="$CONFIG_FILES device/lib/z80/Makefile" ;; "device/lib/gbz80/Makefile" ) CONFIG_FILES="$CONFIG_FILES device/lib/gbz80/Makefile" ;; "device/lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES device/lib/Makefile" ;; diff --git a/configure.in b/configure.in index 65596ecf..4d22c749 100755 --- a/configure.in +++ b/configure.in @@ -672,6 +672,7 @@ fi if test $OPT_DISABLE_MCS51 = 0; then AC_CONFIG_FILES([src/mcs51/Makefile as/mcs51/Makefile + as/link/mcs51/Makefile debugger/mcs51/Makefile]) test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_FILES([device/lib/mcs51/Makefile device/lib/small/Makefile @@ -694,8 +695,8 @@ if test $OPT_DISABLE_Z80 = 0; then AC_CONFIG_FILES([src/z80/Makefile as/Makefile as/z80/Makefile - link/Makefile - link/z80/Makefile]) + as/link/Makefile + as/link/z80/Makefile]) test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_FILES([device/lib/z80/Makefile device/lib/gbz80/Makefile]) fi diff --git a/debugger/mcs51/sdcdb.c b/debugger/mcs51/sdcdb.c index 5f764b30..87dee32f 100644 --- a/debugger/mcs51/sdcdb.c +++ b/debugger/mcs51/sdcdb.c @@ -433,7 +433,7 @@ static void loadModules (void) switch (loop->type) { /* for module records do */ case MOD_REC: - currMod = parseModule(loop->line,TRUE); + currMod = parseModule(loop->line, TRUE); currModName = currMod->name ; currMod->cfullname = searchDirsFname(currMod->c_name); @@ -690,7 +690,11 @@ int cmdFile (char *s,context *cctxt) specialFunctionRegs(); /* start the simulator & setup connection to it */ +#ifdef _WIN32 + if (INVALID_SOCKET == sock) +#else if ( sock == -1 ) +#endif openSimulator((char **)simArgs,nsimArgs); fprintf(stdout,"%s",simResponse()); /* now send the filename to be loaded to the simulator */ @@ -1095,7 +1099,16 @@ static void parseCmdLine (int argc, char **argv) continue ; } - filename = strtok(argv[i],"."); + if (-1 != access(argv[i], 0)) { + /* file exists: strip the cdb or ihx externsion */ + filename = argv[i]; + char *p = strrchr(argv[i], '.'); + + if (NULL != p && + (0 == strcmp(p, ".dcb") || 0 == strcmp(p, ".ihx"))) + *p = '\0'; + } + filename = argv[i]; } } diff --git a/debugger/mcs51/simi.c b/debugger/mcs51/simi.c index 09f63ca3..1e9089e5 100644 --- a/debugger/mcs51/simi.c +++ b/debugger/mcs51/simi.c @@ -315,7 +315,7 @@ void openSimulator (char **args, int nargs) fh = _open_osfhandle((intptr_t)sock, _O_TEXT); if (-1 == fh) { - perror("cannot _open_osfhandle"); + perror("cannot _open_osfhandle"); exit(1); } @@ -329,7 +329,7 @@ void openSimulator (char **args, int nargs) fh = _open_osfhandle((intptr_t)sock, _O_TEXT); if (-1 == fh) { - perror("cannot _open_osfhandle"); + perror("cannot _open_osfhandle"); exit(1); } diff --git a/debugger/mcs51/symtab.c b/debugger/mcs51/symtab.c index 13848cae..4e5165bc 100644 --- a/debugger/mcs51/symtab.c +++ b/debugger/mcs51/symtab.c @@ -35,50 +35,50 @@ unsigned int getSize ( link *p ) { /* if nothing return 0 */ if ( ! p ) - return 0 ; + return 0 ; if ( IS_SPEC(p) ) { /* if this is the specifier then */ - switch (SPEC_NOUN(p)) { /* depending on the specifier type */ - case V_INT: - return (IS_LONG(p) ? LONGSIZE : ( IS_SHORT(p) ? SHORTSIZE: INTSIZE)) ; - case V_FLOAT: - return FLOATSIZE ; - case V_CHAR: - return CHARSIZE ; - case V_VOID: - return 0 ; - case V_STRUCT: - return SPEC_STRUCT(p)->size ; - case V_LABEL: - return 0 ; - case V_SBIT: - return BITSIZE ; - case V_BIT: - return ((SPEC_BLEN(p) / 8) + (SPEC_BLEN(p) % 8 ? 1 : 0)) ; - default : - return 0 ; - } + switch (SPEC_NOUN(p)) { /* depending on the specifier type */ + case V_INT: + return (IS_LONG(p) ? LONGSIZE : ( IS_SHORT(p) ? SHORTSIZE: INTSIZE)) ; + case V_FLOAT: + return FLOATSIZE ; + case V_CHAR: + return CHARSIZE ; + case V_VOID: + return 0 ; + case V_STRUCT: + return SPEC_STRUCT(p)->size ; + case V_LABEL: + return 0 ; + case V_SBIT: + return BITSIZE ; + case V_BIT: + return ((SPEC_BLEN(p) / 8) + (SPEC_BLEN(p) % 8 ? 1 : 0)) ; + default : + return 0 ; + } } /* this is a specifier */ switch (DCL_TYPE(p)) { case FUNCTION: - return 2; + return 2; case ARRAY: - return DCL_ELEM(p) * getSize (p->next) ; + return DCL_ELEM(p) * getSize (p->next) ; case IPOINTER: case PPOINTER: case POINTER: - return ( PTRSIZE ) ; + return ( PTRSIZE ) ; case FPOINTER: case CPOINTER: - return ( FPTRSIZE ); + return ( FPTRSIZE ); case GPOINTER: - return ( GPTRSIZE ); + return ( GPTRSIZE ); default : - return 0 ; + return 0 ; } } @@ -106,8 +106,8 @@ void parseFunc (char *line) while(*rs && *rs != ',') rs++; rs++; sscanf(rs,"%d,%d,%d",&i, - &(SPEC_INTN(func->sym->etype)), - &(SPEC_BANK(func->sym->etype))); + &(SPEC_INTN(func->sym->etype)), + &(SPEC_BANK(func->sym->etype))); SPEC_INTRTN(func->sym->etype) = i; addSet(&functions,func); } @@ -127,111 +127,111 @@ static char *parseTypeInfo (symbol *sym, char *s) /* bp now points to '}' ... go past it */ s = ++bp; while (*s != ')') { /* till we reach the end */ - link *type; - type = Safe_calloc(1,sizeof(link)); - if (*s == ',') s++; - - /* is a declarator */ - if (*s == 'D') { - s++; - switch (*s) { - case 'F': - DCL_TYPE(type) = FUNCTION; - s++; - break; - case 'G': - DCL_TYPE(type) = GPOINTER; - s++; - break; - case 'C': - DCL_TYPE(type) = CPOINTER; - s++; - break; - case 'X': - DCL_TYPE(type) = FPOINTER; - s++; - break; - case 'D': - DCL_TYPE(type) = POINTER; - s++; - break; - case 'I': - DCL_TYPE(type) = IPOINTER; - s++; - break; - case 'P': - DCL_TYPE(type) = PPOINTER; - s++; - break; - case 'A': - s++; - DCL_TYPE(type) = ARRAY ; - DCL_ELEM(type) = strtol(s,&s,10); - break; - } - } else { - /* is a specifier */ - type->class = SPECIFIER ; - s++; - switch (*s) { - case 'L': - SPEC_NOUN(type) = V_INT; - SPEC_LONG(type) = 1; - s++; - break; - case 'I': - SPEC_NOUN(type) = V_INT; - s++; - break; - case 'S': - case 'C': - SPEC_NOUN(type) = V_CHAR ; - s++; - break; - case 'V': - SPEC_NOUN(type) = V_VOID; - s++; - break; - case 'F': - SPEC_NOUN(type) = V_FLOAT; - s++; - break; - case 'T': - s++; - SPEC_NOUN(type) = V_STRUCT; - { - char *ss = strtok(strdup(s),",):"); + link *type; + type = Safe_calloc(1,sizeof(link)); + if (*s == ',') s++; + + /* is a declarator */ + if (*s == 'D') { + s++; + switch (*s) { + case 'F': + DCL_TYPE(type) = FUNCTION; + s++; + break; + case 'G': + DCL_TYPE(type) = GPOINTER; + s++; + break; + case 'C': + DCL_TYPE(type) = CPOINTER; + s++; + break; + case 'X': + DCL_TYPE(type) = FPOINTER; + s++; + break; + case 'D': + DCL_TYPE(type) = POINTER; + s++; + break; + case 'I': + DCL_TYPE(type) = IPOINTER; + s++; + break; + case 'P': + DCL_TYPE(type) = PPOINTER; + s++; + break; + case 'A': + s++; + DCL_TYPE(type) = ARRAY ; + DCL_ELEM(type) = strtol(s,&s,10); + break; + } + } else { + /* is a specifier */ + type->class = SPECIFIER ; + s++; + switch (*s) { + case 'L': + SPEC_NOUN(type) = V_INT; + SPEC_LONG(type) = 1; + s++; + break; + case 'I': + SPEC_NOUN(type) = V_INT; + s++; + break; + case 'S': + case 'C': + SPEC_NOUN(type) = V_CHAR ; + s++; + break; + case 'V': + SPEC_NOUN(type) = V_VOID; + s++; + break; + case 'F': + SPEC_NOUN(type) = V_FLOAT; + s++; + break; + case 'T': + s++; + SPEC_NOUN(type) = V_STRUCT; + { + char *ss = strtok(strdup(s),",):"); + + SPEC_STRUCT(type) = structWithName(ss); + free(ss); + } + break; + case 'X': + s++; + SPEC_NOUN(type) = V_SBIT; + break; + case 'B': + SPEC_NOUN(type) = V_BIT; + s++; + SPEC_BSTR(type) = strtol(s,&s,10); + s++; + SPEC_BLEN(type) = strtol(s,&s,10); + break; + } + while (*s != ':') s++; + s++; + if (*s++ == 'S') + SPEC_USIGN(type) = 0; + else + SPEC_USIGN(type) = 1; - SPEC_STRUCT(type) = structWithName(ss); - free(ss); - } - break; - case 'X': - s++; - SPEC_NOUN(type) = V_SBIT; - break; - case 'B': - SPEC_NOUN(type) = V_BIT; - s++; - SPEC_BSTR(type) = strtol(s,&s,10); - s++; - SPEC_BLEN(type) = strtol(s,&s,10); - break; - } - while (*s != ':') s++; - s++; - if (*s++ == 'S') - SPEC_USIGN(type) = 0; - else - SPEC_USIGN(type) = 1; - - } - - /* add the type to the symbol's type chain */ - if (sym->type) - sym->etype = sym->etype->next = type; - else - sym->type = sym->etype = type; + } + + /* add the type to the symbol's type chain */ + if (sym->type) + sym->etype = sym->etype->next = type; + else + sym->type = sym->etype = type; } return ++s; @@ -275,10 +275,10 @@ symbol *parseSymbol (char *s, char **rs, int doadd) nsym->scopetype = *s; s++ ; if (nsym->scopetype != 'G') { - /* get the function name it is local to */ - bp = s; - while (*s != '$') s++; - nsym->sname = alloccpy(bp,s - bp); + /* get the function name it is local to */ + bp = s; + while (*s != '$') s++; + nsym->sname = alloccpy(bp,s - bp); } /* next get the name */ @@ -347,20 +347,20 @@ structdef *parseStruct (char *s) nsdef->size = 0; s++; while (*s && *s != ']') { - int offset ; - symbol *sym ; - while (!isdigit(*s)) s++; - offset = strtol(s,&s,10); - while (*s != ':') s++; - s++; - sym = parseSymbol(s,&s,0); - sym->offset = offset ; - s += 3; - if (!fields) - fields = nsdef->fields = sym; - else - fields = fields->next = sym; - nsdef->size += sym->size; + int offset ; + symbol *sym ; + while (!isdigit(*s)) s++; + offset = strtol(s,&s,10); + while (*s != ':') s++; + s++; + sym = parseSymbol(s,&s,0); + sym->offset = offset ; + s += 3; + if (!fields) + fields = nsdef->fields = sym; + else + fields = fields->next = sym; + nsdef->size += sym->size; } return nsdef; @@ -383,14 +383,14 @@ module *parseModule (char *s, bool createName ) nmod->name = s; if (createName) { - sprintf(buffer,"%s.c",s); + sprintf(buffer,"%s.c",s); - nmod->c_name = Safe_malloc(strlen(buffer)+1); - strcpy(nmod->c_name,buffer); + nmod->c_name = Safe_malloc(strlen(buffer)+1); + strcpy(nmod->c_name,buffer); - sprintf(buffer,"%s.asm",s); - nmod->asm_name = Safe_malloc(strlen(buffer)+1); - strcpy(nmod->asm_name,buffer); + sprintf(buffer,"%s.asm",s); + nmod->asm_name = Safe_malloc(strlen(buffer)+1); + strcpy(nmod->asm_name,buffer); } return nmod; @@ -406,11 +406,11 @@ DEFSETFUNC(moduleWithName) V_ARG(module **,rmod); if (*rmod) - return 0; + return 0; if (strcmp(mod->name,s) == 0) { - *rmod = mod ; - return 1; + *rmod = mod ; + return 1; } return 0; @@ -426,10 +426,10 @@ DEFSETFUNC(moduleWithCName) V_ARG(module **,rmod); if (*rmod) - return 0; + return 0; if (strcmp(mod->c_name,s) == 0) { - *rmod = mod; - return 1; + *rmod = mod; + return 1; } return 0; @@ -445,10 +445,10 @@ DEFSETFUNC(moduleWithAsmName) V_ARG(module **,rmod); if (*rmod) - return 0; + return 0; if (strcmp(mod->asm_name,s) == 0) { - *rmod = mod; - return 1; + *rmod = mod; + return 1; } return 0; @@ -466,9 +466,9 @@ structdef *structWithName (char *s) /* go thru the struct table looking for a match */ for ( i = 0 ; i < nStructs ; i++ ) { - if (strcmp(currModName,structs[i]->sname) == 0 && - strcmp(s,structs[i]->tag) == 0) - return structs[i]; + if (strcmp(currModName,structs[i]->sname) == 0 && + strcmp(s,structs[i]->tag) == 0) + return structs[i]; } nsdef = Safe_calloc(1,sizeof(structdef)); @@ -491,11 +491,11 @@ DEFSETFUNC(symWithRName) V_ARG(symbol **,rsym); if (*rsym) - return 0; + return 0; if (strcmp(sym->rname,s) == 0) { - *rsym = sym; - return 1; + *rsym = sym; + return 1; } return 0; @@ -511,11 +511,11 @@ DEFSETFUNC(funcWithRName) V_ARG(function **,rfunc); if (*rfunc) - return 0; + return 0; if (strcmp(func->sym->rname,s) == 0) { - *rfunc = func; - return 1; + *rfunc = func; + return 1; } return 0; @@ -534,20 +534,20 @@ DEFSETFUNC(symLocal) V_ARG(symbol **,rsym); if (strcmp(name,sym->name) == 0 && /* name matches */ - sym->scopetype != 'G' && /* local scope */ - (sym->sname && strcmp(sym->sname,sname) == 0) && /* scope == specified scope */ - sym->block <= block && /* block & level kindo matches */ - sym->level <= level) { - - /* if a symbol was previously found then - sure that ones block & level are less - then this one */ - if (*rsym && (*rsym)->block >= block && - (*rsym)->level >= level) - return 0; - - *rsym = sym; - return 1; + sym->scopetype != 'G' && /* local scope */ + (sym->sname && strcmp(sym->sname,sname) == 0) && /* scope == specified scope */ + sym->block <= block && /* block & level kindo matches */ + sym->level <= level) { + + /* if a symbol was previously found then + sure that ones block & level are less + then this one */ + if (*rsym && (*rsym)->block >= block && + (*rsym)->level >= level) + return 0; + + *rsym = sym; + return 1; } return 0; @@ -563,13 +563,13 @@ DEFSETFUNC(symGlobal) V_ARG(symbol **,rsym); if (*rsym) - return 0; + return 0; /* simple :: global & name matches */ if (sym->scopetype == 'G' && - strcmp(sym->name,name) == 0) { - *rsym = sym; - return 1; + strcmp(sym->name,name) == 0) { + *rsym = sym; + return 1; } return 0; @@ -584,15 +584,15 @@ symbol *symLookup (char *name, context *ctxt) if ((ctxt) && (ctxt->func) && (ctxt->func->sym) && (ctxt->func->sym->name)) { - /* first try & find a local variable for the given name */ - if ( applyToSet(symbols,symLocal, - name, - ctxt->func->sym->name, - ctxt->block, - ctxt->level, - &sym)) - return sym; - sym = NULL; + /* first try & find a local variable for the given name */ + if ( applyToSet(symbols,symLocal, + name, + ctxt->func->sym->name, + ctxt->block, + ctxt->level, + &sym)) + return sym; + sym = NULL; } if ((ctxt) && (ctxt->func) && @@ -602,13 +602,13 @@ symbol *symLookup (char *name, context *ctxt) name, ctxt->func->mod->name, 0,0,&sym)) - return sym; + return sym; sym = NULL; } /* no:: try global */ if ( applyToSet(symbols,symGlobal,name,&sym)) - return sym; + return sym; /* cannot find return null */ return NULL; @@ -624,13 +624,13 @@ static void lnkFuncEnd (char *s) /* copy till we get to a ':' */ while ( *s != ':' ) - *bp++ = *s++; + *bp++ = *s++; bp -= 1; *bp = '\0'; func = NULL; if (!applyToSet(functions,funcWithRName,sname,&func)) - return ; + return ; s++; sscanf(s,"%x",&func->sym->eaddr); @@ -683,21 +683,21 @@ static void lnkAsmSrc (char *s) /* input will be of format filename$:
*/ while (*s != '$' && *s != '.') - *bp++ = *s++; + *bp++ = *s++; *bp = '\0'; /* skip to line stuff */ while (*s != '$') s++; if (!applyToSet(modules,moduleWithName,mname,&mod)) - return ; + return ; if (sscanf(s,"$%d:%x",&line,&addr) != 2) - return ; + return ; line--; if (line < mod->nasmLines) { - mod->asmLines[line]->addr = addr; - Dprintf(D_symtab, ("symtab: asm %s(%d:0x%x) %s",mod->asm_name,line,addr,mod->asmLines[line]->src)); + mod->asmLines[line]->addr = addr; + Dprintf(D_symtab, ("symtab: asm %s(%d:0x%x) %s",mod->asm_name,line,addr,mod->asmLines[line]->src)); } } @@ -715,21 +715,21 @@ static void lnkCSrc (char *s) filename.ext$$$:
*/ /* get the module name */ while (*s != '$' ) - *bp++ = *s++; + *bp++ = *s++; *bp = '\0'; /* skip the extension */ while (*s != '$') s++; if (sscanf(s,"$%d$%d$%d:%x", - &line,&level,&block,&addr) != 4) - return ; + &line,&level,&block,&addr) != 4) + return ; mod = NULL; if (!applyToSet(modules,moduleWithCName,mname,&mod)) { - mod = parseModule(mname,FALSE); - mod->c_name = alloccpy(mname,strlen(mname)); - mod->cfullname=searchDirsFname(mod->c_name); - mod->cLines = loadFile(mod->c_name,&mod->ncLines); + mod = parseModule(mname, FALSE); + mod->c_name = alloccpy(mname,strlen(mname)); + mod->cfullname=searchDirsFname(mod->c_name); + mod->cLines = loadFile(mod->c_name,&mod->ncLines); } line--; @@ -773,19 +773,19 @@ void parseLnkRec (char *s) /* c source line address */ case 'C': - lnkCSrc(s+2); - break; + lnkCSrc(s+2); + break; /* assembler source address */ case 'A': - lnkAsmSrc(s+2); - break; + lnkAsmSrc(s+2); + break; case 'X': - lnkFuncEnd(s+1); - break; + lnkFuncEnd(s+1); + break; default : - lnkSymRec(s); - break; + lnkSymRec(s); + break; } } diff --git a/debugger/mcs51/symtab.h b/debugger/mcs51/symtab.h index 9ca40f30..80eff67d 100644 --- a/debugger/mcs51/symtab.h +++ b/debugger/mcs51/symtab.h @@ -138,7 +138,7 @@ typedef struct symbol { char addr_type ; /* which address space */ link *type ; /* start of type chain */ link *etype ; /* end of type chain */ - char scopetype ; /* 'G' global, 'F' - file, 'L' local */ + char scopetype ; /* 'G' global, 'F' - file, 'L' local */ char *sname ; /* if 'F' or 'L' then scope name */ char *rname ; /* real name i.e. mangled beyond recognition */ char addrspace ; /* address space designator */ @@ -158,90 +158,90 @@ typedef struct symbol { #define MAXBASESIZE 4 /* Easy Access Macros */ -#define DCL_TYPE(l) l->select.d.dcl_type -#define DCL_ELEM(l) l->select.d.num_elem +#define DCL_TYPE(l) l->select.d.dcl_type +#define DCL_ELEM(l) l->select.d.num_elem #define DCL_PTR_CONST(l) l->select.d.ptr_const #define DCL_PTR_VOLATILE(l) l->select.d.ptr_volatile -#define DCL_TSPEC(l) l->select.d.tspec -#define SPEC_NOUN(x) x->select.s.noun -#define SPEC_LONG(x) x->select.s._long -#define SPEC_SHORT(x) x->select.s._short -#define SPEC_USIGN(x) x->select.s._unsigned -#define SPEC_SCLS(x) x->select.s.sclass -#define SPEC_OCLS(x) x->select.s.oclass -#define SPEC_STAT(x) x->select.s._static -#define SPEC_EXTR(x) x->select.s._extern -#define SPEC_CODE(x) x->select.s._codesg -#define SPEC_RENT(x) x->select.s._reent -#define SPEC_INTN(x) x->select.s._IntNo -#define SPEC_ABSA(x) x->select.s._absadr -#define SPEC_BANK(x) x->select.s._regbank -#define SPEC_ADDR(x) x->select.s._addr -#define SPEC_STAK(x) x->select.s._stack -#define SPEC_CVAL(x) x->select.s.const_val -#define SPEC_BSTR(x) x->select.s._bitStart -#define SPEC_BLEN(x) x->select.s._bitLength -#define SPEC_BNKF(x) x->select.s._rbank -#define SPEC_INTRTN(x) x->select.s._intrtn -#define SPEC_CRTCL(x) x->select.s._critical +#define DCL_TSPEC(l) l->select.d.tspec +#define SPEC_NOUN(x) x->select.s.noun +#define SPEC_LONG(x) x->select.s._long +#define SPEC_SHORT(x) x->select.s._short +#define SPEC_USIGN(x) x->select.s._unsigned +#define SPEC_SCLS(x) x->select.s.sclass +#define SPEC_OCLS(x) x->select.s.oclass +#define SPEC_STAT(x) x->select.s._static +#define SPEC_EXTR(x) x->select.s._extern +#define SPEC_CODE(x) x->select.s._codesg +#define SPEC_RENT(x) x->select.s._reent +#define SPEC_INTN(x) x->select.s._IntNo +#define SPEC_ABSA(x) x->select.s._absadr +#define SPEC_BANK(x) x->select.s._regbank +#define SPEC_ADDR(x) x->select.s._addr +#define SPEC_STAK(x) x->select.s._stack +#define SPEC_CVAL(x) x->select.s.const_val +#define SPEC_BSTR(x) x->select.s._bitStart +#define SPEC_BLEN(x) x->select.s._bitLength +#define SPEC_BNKF(x) x->select.s._rbank +#define SPEC_INTRTN(x) x->select.s._intrtn +#define SPEC_CRTCL(x) x->select.s._critical #define SPEC_VOLATILE(x) x->select.s._volatile -#define SPEC_CONST(x) x->select.s._const -#define SPEC_STRUCT(x) x->select.s.v_struct -#define SPEC_TYPEDEF(x) x->select.s._typedef +#define SPEC_CONST(x) x->select.s._const +#define SPEC_STRUCT(x) x->select.s.v_struct +#define SPEC_TYPEDEF(x) x->select.s._typedef /* type check macros */ -#define IS_DECL(x) ( x && x->class == DECLARATOR ) -#define IS_SPEC(x) ( x && x->class == SPECIFIER ) -#define IS_ARRAY(x) (IS_DECL(x) && DCL_TYPE(x) == ARRAY) -#define IS_PTR(x) (IS_DECL(x) && (DCL_TYPE(x) == POINTER || \ +#define IS_DECL(x) ( x && x->class == DECLARATOR ) +#define IS_SPEC(x) ( x && x->class == SPECIFIER ) +#define IS_ARRAY(x) (IS_DECL(x) && DCL_TYPE(x) == ARRAY) +#define IS_PTR(x) (IS_DECL(x) && (DCL_TYPE(x) == POINTER || \ DCL_TYPE(x) == FPOINTER || \ DCL_TYPE(x) == GPOINTER || \ DCL_TYPE(x) == IPOINTER || \ DCL_TYPE(x) == PPOINTER || \ DCL_TYPE(x) == CPOINTER || \ DCL_TYPE(x) == UPOINTER )) -#define IS_PTR_CONST(x) (IS_PTR(x) && DCL_PTR_CONST(x)) -#define IS_FARPTR(x) (IS_DECL(x) && DCL_TYPE(x) == FPOINTER) -#define IS_GENPTR(x) (IS_DECL(x) && DCL_TYPE(x) == GPOINTER) -#define IS_FUNC(x) (IS_DECL(x) && DCL_TYPE(x) == FUNCTION) -#define IS_LONG(x) (IS_SPEC(x) && x->select.s._long) -#define IS_SHORT(x) (IS_SPEC(x) && x->select.s._short) -#define IS_TYPEDEF(x)(IS_SPEC(x) && x->select.s._typedef) -#define IS_CONSTANT(x) (IS_SPEC(x) && (x->select.s.sclass == S_CONSTANT ||\ +#define IS_PTR_CONST(x) (IS_PTR(x) && DCL_PTR_CONST(x)) +#define IS_FARPTR(x) (IS_DECL(x) && DCL_TYPE(x) == FPOINTER) +#define IS_GENPTR(x) (IS_DECL(x) && DCL_TYPE(x) == GPOINTER) +#define IS_FUNC(x) (IS_DECL(x) && DCL_TYPE(x) == FUNCTION) +#define IS_LONG(x) (IS_SPEC(x) && x->select.s._long) +#define IS_SHORT(x) (IS_SPEC(x) && x->select.s._short) +#define IS_TYPEDEF(x) (IS_SPEC(x) && x->select.s._typedef) +#define IS_CONSTANT(x) (IS_SPEC(x) && (x->select.s.sclass == S_CONSTANT ||\ x->select.s._const == 1)) -#define IS_STRUCT(x) (IS_SPEC(x) && x->select.s.noun == V_STRUCT) -#define IS_ABSOLUTE(x) (IS_SPEC(x) && x->select.s._absadr ) -#define IS_REGISTER(x) (IS_SPEC(x) && SPEC_SCLS(x) == S_REGISTER) -#define IS_RENT(x) (IS_SPEC(x) && x->select.s._reent ) -#define IS_STATIC(x) (IS_SPEC(x) && SPEC_STAT(x)) -#define IS_INT(x) (IS_SPEC(x) && x->select.s.noun == V_INT) -#define IS_VOID(x) (IS_SPEC(x) && x->select.s.noun == V_VOID) -#define IS_CHAR(x) (IS_SPEC(x) && x->select.s.noun == V_CHAR) -#define IS_EXTERN(x) (IS_SPEC(x) && x->select.s._extern) -#define IS_VOLATILE(x) (IS_SPEC(x) && x->select.s._volatile ) -#define IS_INTEGRAL(x) (IS_SPEC(x) && (x->select.s.noun == V_INT || \ +#define IS_STRUCT(x) (IS_SPEC(x) && x->select.s.noun == V_STRUCT) +#define IS_ABSOLUTE(x) (IS_SPEC(x) && x->select.s._absadr ) +#define IS_REGISTER(x) (IS_SPEC(x) && SPEC_SCLS(x) == S_REGISTER) +#define IS_RENT(x) (IS_SPEC(x) && x->select.s._reent ) +#define IS_STATIC(x) (IS_SPEC(x) && SPEC_STAT(x)) +#define IS_INT(x) (IS_SPEC(x) && x->select.s.noun == V_INT) +#define IS_VOID(x) (IS_SPEC(x) && x->select.s.noun == V_VOID) +#define IS_CHAR(x) (IS_SPEC(x) && x->select.s.noun == V_CHAR) +#define IS_EXTERN(x) (IS_SPEC(x) && x->select.s._extern) +#define IS_VOLATILE(x) (IS_SPEC(x) && x->select.s._volatile ) +#define IS_INTEGRAL(x) (IS_SPEC(x) && (x->select.s.noun == V_INT || \ x->select.s.noun == V_CHAR || \ x->select.s.noun == V_BIT || \ x->select.s.noun == V_SBIT )) -#define IS_BITFIELD(x) (IS_SPEC(x) && (x->select.s.noun == V_BIT)) -#define IS_BITVAR(x) (IS_SPEC(x) && (x->select.s.noun == V_BIT || \ +#define IS_BITFIELD(x) (IS_SPEC(x) && (x->select.s.noun == V_BIT)) +#define IS_BITVAR(x) (IS_SPEC(x) && (x->select.s.noun == V_BIT || \ x->select.s.noun == V_SBIT )) -#define IS_FLOAT(x) (IS_SPEC(x) && x->select.s.noun == V_FLOAT) +#define IS_FLOAT(x) (IS_SPEC(x) && x->select.s.noun == V_FLOAT) #define IS_ARITHMETIC(x) (IS_INTEGRAL(x) || IS_FLOAT(x)) -#define IS_AGGREGATE(x) (IS_ARRAY(x) || IS_STRUCT(x)) -#define IS_LITERAL(x) (IS_SPEC(x) && x->select.s.sclass == S_LITERAL) -#define IS_ISR(x) (IS_SPEC(x) && SPEC_INTRTN(x)) +#define IS_AGGREGATE(x) (IS_ARRAY(x) || IS_STRUCT(x)) +#define IS_LITERAL(x) (IS_SPEC(x) && x->select.s.sclass == S_LITERAL) +#define IS_ISR(x) (IS_SPEC(x) && SPEC_INTRTN(x)) -symbol *parseSymbol (char *, char **, int ); +symbol *parseSymbol (char *, char **, int); structdef *parseStruct (char *); void parseFunc (char *); -module *parseModule (char *, bool ); +module *parseModule (char *, bool); void parseLnkRec (char *); symbol *symLookup (char *,context *); DEFSETFUNC(moduleWithName); DEFSETFUNC(moduleWithCName); DEFSETFUNC(moduleWithAsmName); -unsigned int getSize ( link * ); +unsigned int getSize (link *); #endif