*/
#define NO_SHORTNAMES /* Tell config not to load remap.h */
-#include <../src/config.h>
+#include <config.h>
#include <stdio.h>
#include <errno.h>
c_file
} Current_file_type;
-static int scan_file (CONST char *filename);
+static int scan_file (const char *filename);
static int read_c_string (FILE *, int, int);
-static void write_c_args (FILE *out, CONST char *func, char *buf, int minargs,
+static void write_c_args (FILE *out, const char *func, char *buf, int minargs,
int maxargs);
-static int scan_c_file (CONST char *filename, CONST char *mode);
+static int scan_c_file (const char *filename, const char *mode);
static void skip_white (FILE *);
static void read_lisp_symbol (FILE *, char *);
-static int scan_lisp_file (CONST char *filename, CONST char *mode);
+static int scan_lisp_file (const char *filename, const char *mode);
#define C_IDENTIFIER_CHAR_P(c) \
(('A' <= c && c <= 'Z') || \
/* Print error message. `s1' is printf control string, `s2' is arg for it. */
static void
-error (CONST char *s1, CONST char *s2)
+error (const char *s1, const char *s2)
{
fprintf (stderr, "%s: ", progname);
fprintf (stderr, s1, s2);
/* Print error message and exit. */
static void
-fatal (CONST char *s1, CONST char *s2)
+fatal (const char *s1, const char *s2)
{
error (s1, s2);
exit (1);
/* Return 1 if file is not found, 0 if it is found. */
static int
-scan_file (CONST char *filename)
+scan_file (const char *filename)
{
int len = strlen (filename);
if (ellcc == 0 && len > 4 && !strcmp (filename + len - 4, ".elc"))
Convert escape sequences \n and \t to newline and tab;
discard \ followed by newline. */
+#define MDGET do { prevc = c; c = getc (infile); } while (0)
static int
read_c_string (FILE *infile, int printflag, int c_docstring)
{
- register int c;
+ register int prevc = 0, c = 0;
char *p = buf;
int start = -1;
- c = getc (infile);
+ MDGET;
while (c != EOF)
{
while ((c_docstring || c != '"') && c != EOF)
{
- if (start)
+ if (c == '*')
{
- if (c == '*')
+ int cc = getc (infile);
+ if (cc == '/')
{
- int cc = getc (infile);
- if (cc == '/')
- break;
- else
- ungetc (cc, infile);
+ if (prevc != '\n')
+ {
+ if (printflag > 0)
+ {
+ if (ellcc)
+ fprintf (outfile, "\\n\\");
+ putc ('\n', outfile);
+ }
+ else if (printflag < 0)
+ *p++ = '\n';
+ }
+ break;
}
+ else
+ ungetc (cc, infile);
+ }
- if (start != -1)
+ if (start == 1)
+ {
+ if (printflag > 0)
{
- if (printflag > 0)
- {
- if (ellcc)
- fprintf (outfile, "\\n\\");
- putc ('\n', outfile);
- }
- else if (printflag < 0)
- *p++ = '\n';
+ if (ellcc)
+ fprintf (outfile, "\\n\\");
+ putc ('\n', outfile);
}
+ else if (printflag < 0)
+ *p++ = '\n';
}
if (c == '\\')
{
- c = getc (infile);
+ MDGET;
if (c == '\n')
{
- c = getc (infile);
+ MDGET;
start = 1;
continue;
}
else
{
start = 0;
- if (printflag > 0) {
- if (ellcc && c == '"')
- putc ('\\', outfile);
- putc (c, outfile);
- }
+ if (printflag > 0)
+ {
+ if (ellcc && c == '"')
+ putc ('\\', outfile);
+ putc (c, outfile);
+ }
else if (printflag < 0)
*p++ = c;
}
- c = getc (infile);
+ MDGET;
}
/* look for continuation of string */
if (Current_file_type == c_file)
{
- while (isspace (c = getc (infile)))
- ;
+ do
+ {
+ MDGET;
+ }
+ while (isspace (c));
if (c != '"')
break;
}
else
{
- c = getc (infile);
+ MDGET;
if (c != '"')
break;
/* If we had a "", concatenate the two strings. */
}
- c = getc (infile);
+ MDGET;
}
if (printflag < 0)
MINARGS and MAXARGS are the minimum and maximum number of arguments. */
static void
-write_c_args (FILE *out, CONST char *func, char *buff, int minargs,
+write_c_args (FILE *out, const char *func, char *buff, int minargs,
int maxargs)
{
register char *p;
static char lo[] = "Lisp_Object";
if ((C_IDENTIFIER_CHAR_P (c) != in_ident) && !in_ident &&
(strncmp (p, lo, sizeof (lo) - 1) == 0) &&
- isspace(*(p + sizeof (lo) - 1)))
+ isspace((unsigned char) (* (p + sizeof (lo) - 1))))
{
p += (sizeof (lo) - 1);
- while (isspace (*p))
+ while (isspace ((unsigned char) (*p)))
p++;
c = *p;
}
Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */
static int
-scan_c_file (CONST char *filename, CONST char *mode)
+scan_c_file (const char *filename, const char *mode)
{
FILE *infile;
register int c;
}
static int
-scan_lisp_file (CONST char *filename, CONST char *mode)
+scan_lisp_file (const char *filename, const char *mode)
{
FILE *infile;
register int c;
/* Skip until the first newline; remember the two previous chars. */
while (c != '\n' && c >= 0)
{
- /* ### Kludge -- Ignore any ESC x x ISO2022 sequences */
+ /* #### Kludge -- Ignore any ESC x x ISO2022 sequences */
if (c == 27)
{
getc (infile);