* as/hc08/aslex.c,
[fw/sdcc] / as / mcs51 / lklex.c
index 7003ab2de6c07ee50564f828cda022fc128645b5..7c481300bbd6c595a0f7e1dc4592c82f4b0d0ac3 100644 (file)
@@ -24,7 +24,7 @@
  *             VOID    getfid()
  *             VOID    getid()
  *             VOID    getSid()
- *             int     getline()
+ *             int     as_getline()
  *             int     getmap()
  *             char    getnb()
  *             int     more()
@@ -160,13 +160,13 @@ char *id;
  *             int     c               this is first character to
  *                                     copy to the string buffer
  *
- *     The function getfid() scans the current input text line
- *     from the current position copying the next string
- *     into the external string buffer (str).  The string ends when a
- *     non SPACE type character is found. The maximum number of
- *     characters copied is PATH_MAX. If the input string is larger than
- *     PATH_MAX characters then the string is truncated, if the input string
- *     is shorter than PATH_MAX characters then the string is NULL filled.
+ *     The function getfid() scans the current input text line from
+ *     the current position copying the next string into the external
+ *     string buffer (str).  The string ends when end of line is found.
+ *     Trailing spacers are removed. The maximum number of characters
+ *     copied is PATH_MAX. If the input string is larger than PATH_MAX
+ *     characters then the string is truncated. The string is NULL
+ *     terminated.
  *
  *     local variables:
  *             char *  p               pointer to external string buffer
@@ -194,16 +194,21 @@ char *str;
        register char *p;
 
        p = str;
-       do {
+       do
+       {
                if (p < &str[PATH_MAX-1])
                        *p++ = c;
                c = get();
+               if (c == ';')
+                       while (c)
+                               c = get();
        } while (c);
-        /* trim trailing spaces */
-        while (ctype[*(--p)] == SPACE)
-          ;
-        /* terminate the string */
-        *(++p) = '\0';
+       /* trim trailing spaces */
+       --p;
+       while (p >= str && ctype[(int)*p] == SPACE)
+               --p;
+       /* terminate the string */
+       *(++p) = '\0';
 }
 
 /*)Function    char    getnb()
@@ -420,15 +425,15 @@ getmap(d)
        return (c);
 }
 
-/*)Function    int     getline()
+/*)Function    int     as_getline()
  *
- *     The function getline() reads a line of input text from a
+ *     The function as_getline() reads a line of input text from a
  *     .rel source text file, a .lnk command file or from stdin.
  *     Lines of text are processed from a single .lnk file or
  *     multiple .rel files until all files have been read.
  *     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
+ *     as_getline() returns a (1) after succesfully reading a line
  *     or a (0) if all files have been read.
  *     This function also opens each input .lst file and output
  *     .rst file as each .rel file is processed.
@@ -474,7 +479,7 @@ getmap(d)
  */
 
 int
-getline()
+as_getline()
 {
        register int ftype;
        register char *fid;