From 0b99bef5b1367674d02eaab92f5d92cecbbff4c8 Mon Sep 17 00:00:00 2001 From: kvigor Date: Tue, 9 Jan 2001 16:27:23 +0000 Subject: [PATCH] Rename type addr_t to Addr_T to avoid conflict with Cygwin git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@526 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- as/z80/asdata.c | 12 +- as/z80/asexpr.c | 6 +- as/z80/aslex.c | 506 ------------------------------------------------ as/z80/asm.h | 20 +- as/z80/asmain.c | 14 +- 5 files changed, 26 insertions(+), 532 deletions(-) diff --git a/as/z80/asdata.c b/as/z80/asdata.c index 4731d1d9..82060ae9 100644 --- a/as/z80/asdata.c +++ b/as/z80/asdata.c @@ -91,10 +91,10 @@ int xflag; /* -x, listing radix flag */ int fflag; /* -f(f), relocations flagged flag */ -addr_t laddr; /* address of current assembler line +Addr_T laddr; /* address of current assembler line * or value of .if argument */ -addr_t fuzz; /* tracks pass to pass changes in the +Addr_T fuzz; /* tracks pass to pass changes in the * address of symbols caused by * variable length instruction formats */ @@ -151,7 +151,7 @@ char module[NCPS]; /* module name string * char m_id[NCPS]; Mnemonic * char m_type; Mnemonic subtype * char m_flag; Mnemonic flags - * addr_t m_valu; Value + * Addr_T m_valu; Value * }; */ struct mne *mnehash[NHASH]; @@ -178,7 +178,7 @@ struct mne *mnehash[NHASH]; * char s_flag; Symbol flags * struct area *s_area; Area line, 0 if absolute * int s_ref; Ref. number - * addr_t s_addr; Address + * Addr_T s_addr; Address * }; */ struct sym sym[] = { @@ -210,8 +210,8 @@ struct sym *symhash[NHASH]; /* array of pointers to NHASH * struct area *a_ap; Area link * char a_id[NCPS]; Area Name * int a_ref; Reference number - * addr_t a_size; Area size - * addr_t a_fuzz; Area fuzz + * Addr_T a_size; Area size + * Addr_T a_fuzz; Area fuzz * int a_flag; Area flags * }; */ diff --git a/as/z80/asexpr.c b/as/z80/asexpr.c index 4490cdc3..d65ae50e 100644 --- a/as/z80/asexpr.c +++ b/as/z80/asexpr.c @@ -32,7 +32,7 @@ * * asexpr.c contains the following functions: * VOID abscheck() - * addr_t absexpr() + * Addr_T absexpr() * VOID clrexpr() * int digit() * VOID expr() @@ -190,7 +190,7 @@ int n; unget(c); } -/*)Function addr_t absexpr() +/*)Function Addr_T absexpr() * * The function absexpr() evaluates an expression, verifies it * is absolute (i.e. not position dependent or relocatable), and @@ -212,7 +212,7 @@ int n; * a 'r' error is reported. */ -addr_t +Addr_T absexpr() { struct expr e; diff --git a/as/z80/aslex.c b/as/z80/aslex.c index 4f764dd6..e69de29b 100644 --- a/as/z80/aslex.c +++ b/as/z80/aslex.c @@ -1,506 +0,0 @@ -/* aslex.c */ - -/* - * (C) Copyright 1989-1995 - * All Rights Reserved - * - * Alan R. Baldwin - * 721 Berkeley St. - * Kent, Ohio 44240 - */ - -/* - * Extensions: P. Felber, M. Hope - */ - -#include -#include -#include - -#if !defined(_MSC_VER) -#include -#endif - -#include "asm.h" - -/*)Module aslex.c - * - * The module aslex.c includes the general lexical - * analysis routines for the assembler. - * - * aslex.c contains the following functions: - * char endline() - * char get() - * VOID getid(id,c) - * int getline() - * int getmap() - * char getnb() - * VOID getst() - * int more() - * VOID unget(c) - * - * aslex.c contains no local/static variables - */ - -/*)Function VOID getid(id,c) - * - * char * id a pointer to a string of - * maximum length NCPS - * int c mode flag - * >=0 this is first character to - * copy to the string buffer - * <0 skip white space, first - * character must be a LETTER - * - * The function getid() scans the current assembler-source text line - * from the current position copying the next LETTER | DIGIT string - * into the external string buffer (id). The string ends when a non - * LETTER or DIGIT character is found. The maximum number of - * characters copied is NCPS. If the input string is larger than - * NCPS characters then the string is truncated, if the input string - * is shorter than NCPS characters then the string is NULL filled. - * If the mode argument (c) is >=0 then (c) is the first character - * copied to the string buffer, if (c) is <0 then intervening white - * space (SPACES and TABS) are skipped and the first character found - * must be a LETTER else a 'q' error terminates the parse of this - * assembler-source text line. - * - * local variables: - * char * p pointer to external string buffer - * int c current character value - * - * global variables: - * char ctype[] a character array which defines the - * type of character being processed. - * This index is the character - * being processed. - * - * called functions: - * char get() aslex.c - * char getnb() aslex.c - * VOID unget() aslex.c - * - * side effects: - * use of getnb(), get(), and unget() updates the - * global pointer ip, the position in the current - * assembler-source text line. - */ - -VOID -getid(id, c) -register int c; -char *id; -{ - register char *p; - - if (c < 0) { - c = getnb(); - if ((ctype[c] & LETTER) == 0) - qerr(); - } - p = id; - do { - if (p < &id[NCPS]) - *p++ = c; - } while (ctype[c=get()] & (LETTER|DIGIT)); - unget(c); - while (p < &id[NCPS]) - *p++ = 0; -} - -/*)Function VOID getst(id,c) - * - * char * id a pointer to a string of - * maximum length NCPS - * int c mode flag - * >=0 this is first character to - * copy to the string buffer - * <0 skip white space, first - * character must be a LETTER - * - * The function getnbid() scans the current assembler-source text line - * from the current position copying the next character string into - * the external string buffer (id). The string ends when a SPACE or - * ILL character is found. The maximum number of - * characters copied is NCPS. If the input string is larger than - * NCPS characters then the string is truncated, if the input string - * is shorter than NCPS characters then the string is NULL filled. - * If the mode argument (c) is >=0 then (c) is the first character - * copied to the string buffer, if (c) is <0 then intervening white - * space (SPACES and TABS) are skipped and the first character found - * must be a LETTER else a 'q' error terminates the parse of this - * assembler-source text line. - * - * local variables: - * char * p pointer to external string buffer - * int c current character value - * - * global variables: - * char ctype[] a character array which defines the - * type of character being processed. - * This index is the character - * being processed. - * - * called functions: - * char get() aslex.c - * char getnb() aslex.c - * VOID unget() aslex.c - * - * side effects: - * use of getnb(), get(), and unget() updates the - * global pointer ip, the position in the current - * assembler-source text line. - */ - -VOID -getst(id, c) -register int c; -char *id; -{ - register char *p; - - if (c < 0) { - c = getnb(); - if ((ctype[c] & LETTER) == 0) - qerr(); - } - p = id; - do { - if (p < &id[NCPS]) - *p++ = c; - } while (ctype[c=get()] & ~(SPACE|ILL)); - unget(c); - while (p < &id[NCPS]) - *p++ = 0; -} - -/*)Function char getnb() - * - * The function getnb() scans the current assembler-source - * text line returning the first character not a SPACE or TAB. - * - * local variables: - * int c current character from - * assembler-source text line - * - * global variables: - * none - * - * called functions: - * char get() aslex.c - * - * side effects: - * use of get() updates the global pointer ip, the position - * in the current assembler-source text line - */ - -char -getnb() -{ - register int c; - - while ((c=get()) == ' ' || c == '\t') - ; - return (c); -} - -/*)Function char get() - * - * The function get() returns the next character in the - * assembler-source text line, at the end of the line a - * NULL character is returned. - * - * local variables: - * int c current character from - * assembler-source text line - * - * global variables: - * char * ip pointer into the current - * assembler-source text line - * - * called functions: - * none - * - * side effects: - * updates ip to the next character position in the - * assembler-source text line. If ip is at the end of the - * line, ip is not updated. - */ - -char -get() -{ - register int c; - - if ((c = *ip) != 0) - ++ip; - return (c); -} - -/*)Function VOID unget(c) - * - * int c value of last character read from - * assembler-source text line - * - * If (c) is not a NULL character then the global pointer ip - * is updated to point to the preceeding character in the - * assembler-source text line. - * - * NOTE: This function does not push the character (c) - * back into the assembler-source text line, only - * the pointer ip is changed. - * - * local variables: - * int c last character read from - * assembler-source text line - * - * global variables: - * char * ip position into the current - * assembler-source text line - * - * called functions: - * none - * - * side effects: - * ip decremented by 1 character position - */ - -VOID -unget(c) -{ - if (c) - if (ip != ib) - --ip; -} - -/*)Function int getmap(d) - * - * int d value to compare with the - * assembler-source text line character - * - * The function getmap() converts the 'C' style characters \b, \f, - * \n, \r, and \t to their equivalent ascii values and also - * converts 'C' style octal constants '\123' to their equivalent - * numeric values. If the first character is equivalent to (d) then - * a (-1) is returned, if the end of the line is detected then - * a 'q' error terminates the parse for this line, or if the first - * character is not a \ then the character value is returned. - * - * local variables: - * int c value of character from the - * assembler-source text line - * int n looping counter - * int v current value of numeric conversion - * - * global variables: - * none - * - * called functions: - * char get() aslex.c - * - * side effects: - * use of get() updates the global pointer ip the position - * in the current assembler-source text line - */ - -int -getmap(d) -{ - register int c, n, v; - - if ((c=get()) == '\0') - qerr(); - if (c == d) - return (-1); - if (c == '\\') { - c = get(); - switch (c) { - - case 'b': - c = '\b'; - break; - - case 'f': - c = '\f'; - break; - - case 'n': - c = '\n'; - break; - - case 'r': - c = '\r'; - break; - - case 't': - c = '\t'; - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - n = 0; - v = 0; - while (++n<=3 && c>='0' && c<='7') { - v = (v<<3) + c - '0'; - c = get(); - } - unget(c); - c = v; - break; - } - } - return (c); -} - -/*)Function int getline() - * - * The function getline() reads a line of assembler-source text - * from an assembly source text file or an include file. - * Lines of text are processed from assembler-source files until - * all files have been read. If an include file is opened then - * lines of text are read from the include file (or nested - * include file) until the end of the include file is found. - * The input text line is copied into the global string ib[] - * and converted to a NULL terminated string. The function - * getline() returns a (1) after succesfully reading a line - * or a (0) if all files have been read. - * - * local variables: - * int i string length - * - * global variables: - * char ib[] string buffer containing - * assembler-source text line - * char ifp[] array of file handles for - * include files - * int incfil index for ifp[] specifies - * active include file - * int incline[] array of include file - * line numbers - * char sfp[] array of file handles for - * assembler source files - * int cfile index for sfp[] specifies - * active source file - * int srcline[] array of source file - * line numbers - * int inpfil maximum input file index - * - * called functions: - * int fclose() c-library - * char * fgets() c-library - * int strlen() c-library - * - * side effects: - * include file will be closed at detection of end of file. - * the next sequential source file may be selected. - * the global file indexes incfil or cfile may be changed. - * The respective source line or include line counter - * will be updated. - */ - -int -getline() -{ -register int i; - -loop: if (incfil >= 0) { - if (fgets(ib, sizeof ib, ifp[incfil]) == NULL) { -#ifdef SDK - fclose(ifp[incfil]); - ifp[incfil--] = NULL; -#else /* SDK */ - fclose(ifp[incfil--]); -#endif /* SDK */ - lop = NLPP; - goto loop; - } else { - ++incline[incfil]; - } - } else { - if (fgets(ib, sizeof ib, sfp[cfile]) == NULL) { - if (++cfile <= inpfil) { - srcline[cfile] = 0; - goto loop; - } - return (0); - } else { - ++srcline[cfile]; - } - } - i = strlen(ib) - 1; - if (ib[i] == '\n') - ib[i] = 0; - if (i >= 1 && ib[i-1] == '\r') - ib[i-1] = 0; - return (1); -} - -/*)Function int more() - * - * The function more() scans the assembler-source text line - * skipping white space (SPACES and TABS) and returns a (0) - * if the end of the line or a comment delimeter (;) is found, - * or a (1) if their are additional characters in the line. - * - * local variables: - * int c next character from the - * assembler-source text line - * - * global variables: - * none - * - * called functions: - * char getnb() aslex.c - * VOID unget() aslex.c - * - * side effects: - * use of getnb() and unget() updates the global pointer ip - * the position in the current assembler-source text line - */ - -int -more() -{ - register int c; - - c = getnb(); - unget(c); - return( (c == '\0' || c == ';') ? 0 : 1 ); -} - -/*)Function char endline() - * - * The function endline() scans the assembler-source text line - * skipping white space (SPACES and TABS) and returns the next - * character or a (0) if the end of the line is found or a - * comment delimiter (;) is found. - * - * local variables: - * int c next character from the - * assembler-source text line - * - * global variables: - * none - * - * called functions: - * char getnb() aslex.c - * - * side effects: - * use of getnb() updates the global pointer ip the - * position in the current assembler-source text line - */ - -char -endline() -{ - register int c; - - c = getnb(); - return( (c == '\0' || c == ';') ? 0 : c ); -} diff --git a/as/z80/asm.h b/as/z80/asm.h index 1ad722ec..734aaa20 100644 --- a/as/z80/asm.h +++ b/as/z80/asm.h @@ -95,7 +95,7 @@ #define dca area[0] /* Dca, default code area */ -typedef unsigned int addr_t; +typedef unsigned int Addr_T; /* * The area structure contains the parameter values for a @@ -116,8 +116,8 @@ struct area struct area *a_ap; /* Area link */ char a_id[NCPS]; /* Area Name */ int a_ref; /* Ref. number */ - addr_t a_size; /* Area size */ - addr_t a_fuzz; /* Area fuzz */ + Addr_T a_size; /* Area size */ + Addr_T a_fuzz; /* Area fuzz */ int a_flag; /* Area flags */ }; @@ -208,7 +208,7 @@ struct mne char m_id[NCPS]; /* Mnemonic */ char m_type; /* Mnemonic subtype */ char m_flag; /* Mnemonic flags */ - addr_t m_valu; /* Value */ + Addr_T m_valu; /* Value */ }; /* @@ -233,7 +233,7 @@ struct sym char s_flag; /* Symbol flags */ struct area *s_area; /* Area line, 0 if absolute */ int s_ref; /* Ref. number */ - addr_t s_addr; /* Address */ + Addr_T s_addr; /* Address */ }; #define S_GBL 01 /* Global */ @@ -289,7 +289,7 @@ struct tsym int t_num; /* 0-lots$ */ char t_flg; /* flags */ struct area *t_area; /* Area */ - addr_t t_addr; /* Address */ + Addr_T t_addr; /* Address */ }; /* @@ -365,10 +365,10 @@ extern int xflag; /* -x, listing radix flag */ extern int fflag; /* -f(f), relocations flagged flag */ -extern addr_t laddr; /* address of current assembler line +extern Addr_T laddr; /* address of current assembler line * or value of .if argument */ -extern addr_t fuzz; /* tracks pass to pass changes in the +extern Addr_T fuzz; /* tracks pass to pass changes in the * address of symbols caused by * variable length instruction formats */ @@ -479,7 +479,7 @@ struct expr { char e_mode; /* Address mode */ char e_flag; /* Symbol flag */ - addr_t e_addr; /* Address */ + Addr_T e_addr; /* Address */ union { struct area *e_ap; struct sym *e_sp; @@ -549,7 +549,7 @@ extern VOID rerr(); /* asexpr.c */ extern VOID abscheck(); -extern addr_t absexpr(); +extern Addr_T absexpr(); extern VOID clrexpr(); extern int digit(); extern int is_abs(); diff --git a/as/z80/asmain.c b/as/z80/asmain.c index 6bde5db2..0da2d11a 100644 --- a/as/z80/asmain.c +++ b/as/z80/asmain.c @@ -91,7 +91,7 @@ * int fflag -f(f), relocations flagged flag * int flevel IF-ELSE-ENDIF flag will be non * zero for false conditional case - * addr_t fuzz tracks pass to pass changes in the + * Addr_T fuzz tracks pass to pass changes in the * address of symbols caused by * variable length instruction formats * int gflag -g, make undefined symbols global flag @@ -405,7 +405,7 @@ int i; * ASCII character * int flevel IF-ELSE-ENDIF flag will be non * zero for false conditional case - * addr_t fuzz tracks pass to pass changes in the + * Addr_T fuzz tracks pass to pass changes in the * address of symbols caused by * variable length instruction formats * int ifcnd[] array of IF statement condition @@ -417,7 +417,7 @@ int i; * int incline[] current include file line * int incfil current file handle index * for include files - * addr_t laddr address of current assembler line + * Addr_T laddr address of current assembler line * or value of .if argument * int lmode listing mode * int lop current line number on page @@ -432,7 +432,7 @@ int i; * int tlevel current conditional level * * functions called: - * addr_t absexpr() asexpr.c + * Addr_T absexpr() asexpr.c * area * alookup() assym.c * VOID clrexpr() asexpr.c * int digit() asexpr.c @@ -1074,7 +1074,7 @@ int wf; * * global variables: * sym dot defined as sym[0] - * addr_t fuzz tracks pass to pass changes in the + * Addr_T fuzz tracks pass to pass changes in the * address of symbols caused by * variable length instruction formats * @@ -1103,7 +1103,7 @@ register struct area *nap; /*)Function VOID phase(ap, a) * * area * ap pointer to area - * addr_t a address in area + * Addr_T a address in area * * Function phase() compares the area ap and address a * with the current area dot.s_area and address dot.s_addr @@ -1127,7 +1127,7 @@ register struct area *nap; VOID phase(ap, a) struct area *ap; -addr_t a; +Addr_T a; { if (ap != dot.s_area || a != dot.s_addr) err('p'); -- 2.39.5