dthelp: Convert all K&R function definitions to ANSI (C90) standard
This commit is contained in:
@@ -167,9 +167,7 @@ delim.h.
|
||||
#include "cont.h"
|
||||
|
||||
/* Main procedure */
|
||||
int main(argc, argv)
|
||||
int argc ;
|
||||
char **argv ;
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int n ;
|
||||
|
||||
|
||||
@@ -81,8 +81,7 @@ void dumptree(LOGICAL sparse)
|
||||
}
|
||||
|
||||
/* Enter a delimiter into the delimiter tree for a particular context */
|
||||
void enterdelim(n)
|
||||
int n;
|
||||
void enterdelim(int n)
|
||||
{
|
||||
if (! contree[n])
|
||||
{
|
||||
@@ -107,8 +106,7 @@ if (m_ntrtrie(dstruct->string,
|
||||
}
|
||||
|
||||
/* Read the code to be executed with a given state transition */
|
||||
void getcode(n)
|
||||
int n;
|
||||
void getcode(int n)
|
||||
{
|
||||
int c ; /* c is int instead of char for use with ungetc */
|
||||
int nested = 1;
|
||||
@@ -616,8 +614,7 @@ void nextcon(LOGICAL sparse)
|
||||
|
||||
/* If sparse matrix output option, generate a single element of transit
|
||||
array */
|
||||
void prtctxt(column, value)
|
||||
int column, value;
|
||||
void prtctxt(int column, int value)
|
||||
{
|
||||
static LOGICAL first = TRUE;
|
||||
|
||||
@@ -652,8 +649,7 @@ void skiptoend(void)
|
||||
}
|
||||
|
||||
/* Return a character to the input stream for re-reading */
|
||||
void unread(c)
|
||||
int c;
|
||||
void unread(int c)
|
||||
{
|
||||
M_WCHAR wnl;
|
||||
|
||||
|
||||
@@ -49,8 +49,7 @@ char xerror[] = "ERROR" ;
|
||||
|
||||
/* Outputs entity definitions */
|
||||
#define ENTFILENAME 12
|
||||
void entout(fname)
|
||||
char *fname ;
|
||||
void entout(char *fname)
|
||||
{
|
||||
char efilename[ENTFILENAME] ;
|
||||
int count = 1 ;
|
||||
@@ -173,15 +172,13 @@ void entout(fname)
|
||||
|
||||
/* Entptr is called by m_dumptrie to output the value stored with a
|
||||
particular entity in the entity trie */
|
||||
void entptr(data)
|
||||
M_ENTITY *data ;
|
||||
void entptr(M_ENTITY *data)
|
||||
{
|
||||
fprintf(entfile, "(M_TRIE *) &m_entities[%d]", data->index - 1) ;
|
||||
}
|
||||
|
||||
/* Typetype returns a string indicating the type of the nth entity.*/
|
||||
char *typetype(n)
|
||||
int n ;
|
||||
char *typetype(int n)
|
||||
{
|
||||
switch(n) {
|
||||
case M_GENERAL: return(xgeneral) ;
|
||||
|
||||
@@ -83,16 +83,14 @@ void eprefix(LOGICAL flag)
|
||||
/* Writes part of an error message. Called from m_malloc instead of
|
||||
m_err1, since PARSER's version of m_err1 calls m_malloc and recursive
|
||||
calls are possible when the heap is exhausted */
|
||||
void m_errline(text)
|
||||
char *text ;
|
||||
void m_errline(char *text)
|
||||
{
|
||||
fputs(text, stderr) ;
|
||||
fputs(text, m_errfile) ;
|
||||
}
|
||||
|
||||
/* Writes an error message to standard error and file "error" */
|
||||
void m_error(text)
|
||||
char *text ;
|
||||
void m_error(char *text)
|
||||
{
|
||||
eprefix(TRUE) ;
|
||||
fprintf(stderr,"%s", text) ;
|
||||
@@ -192,30 +190,26 @@ void esuffix(void)
|
||||
}
|
||||
|
||||
/* Print something to both stderr and m_errfile */
|
||||
void msgline(text)
|
||||
char *text ;
|
||||
void msgline(char *text)
|
||||
{
|
||||
fprintf(stderr, "%s", text) ;
|
||||
fprintf(m_errfile, "%s", text) ;
|
||||
}
|
||||
|
||||
/* Print something to both stderr and m_errfile */
|
||||
void msg1line(text, arg1)
|
||||
char *text, *arg1 ;
|
||||
void msg1line(char *text, char *arg1)
|
||||
{
|
||||
fprintf(stderr, text, arg1) ;
|
||||
fprintf(m_errfile, text, arg1) ;
|
||||
}
|
||||
|
||||
/* Trace used for m_malloc trace output */
|
||||
void m_trace(text)
|
||||
char *text ;
|
||||
void m_trace(char *text)
|
||||
{
|
||||
m_errline(text) ;
|
||||
}
|
||||
|
||||
void m_wctrace(text)
|
||||
M_WCHAR *text ;
|
||||
void m_wctrace(M_WCHAR *text)
|
||||
{
|
||||
char *mb_text;
|
||||
|
||||
@@ -225,8 +219,7 @@ m_free(mb_text,"multi-byte string");
|
||||
}
|
||||
|
||||
/* Writes a nonfatal error message to standard error and file "error" */
|
||||
void warning(text)
|
||||
char *text ;
|
||||
void warning(char *text)
|
||||
{
|
||||
eprefix(FALSE) ;
|
||||
fprintf(stderr,"%s", text) ;
|
||||
|
||||
@@ -31,8 +31,7 @@ void m_exit(int status);
|
||||
|
||||
/* Exit function called by utilities used in PARSER and other programs in
|
||||
the MARKUP system */
|
||||
void m_exit(status)
|
||||
int status ;
|
||||
void m_exit(int status)
|
||||
{
|
||||
exit(status) ;
|
||||
}
|
||||
|
||||
@@ -61,9 +61,7 @@ void copyfile(char *pfile1, char *pfile2);
|
||||
|
||||
int nextchar(FILE *file, struct data *data);
|
||||
|
||||
int main(argc, argv)
|
||||
int argc ;
|
||||
char **argv ;
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *one, *two ;
|
||||
int c1, c2 ;
|
||||
@@ -110,8 +108,7 @@ int main(argc, argv)
|
||||
}
|
||||
|
||||
/* copyfile inserted by ced, 12-1-89. */
|
||||
void copyfile(pfile1,pfile2)
|
||||
char *pfile1, *pfile2;
|
||||
void copyfile(char *pfile1, char *pfile2)
|
||||
{
|
||||
int ret;
|
||||
char *pcmd;
|
||||
@@ -128,9 +125,7 @@ void copyfile(pfile1,pfile2)
|
||||
free(pcmd);
|
||||
}
|
||||
|
||||
int nextchar(file, data)
|
||||
FILE *file ;
|
||||
struct data *data ;
|
||||
int nextchar(FILE *file, struct data *data)
|
||||
{
|
||||
while (data->linestart) {
|
||||
data->linestart = FALSE ;
|
||||
|
||||
@@ -34,10 +34,7 @@ void m_exit(int status);
|
||||
void m_inctest(int *count, int limit, char *message);
|
||||
|
||||
/* Increment a count and test against a limit */
|
||||
void m_inctest(count, limit, message)
|
||||
int *count ;
|
||||
int limit ;
|
||||
char *message ;
|
||||
void m_inctest(int *count, int limit, char *message)
|
||||
{
|
||||
if (++*count <= limit) return ;
|
||||
m_err1("Internal error: %s exceeded", message) ;
|
||||
|
||||
@@ -31,9 +31,7 @@ char *m_itoa(int n, char *s);
|
||||
|
||||
void reverse(char *s);
|
||||
|
||||
char *m_itoa(n, s) /* convert n to characters in s */
|
||||
char s[];
|
||||
int n;
|
||||
char *m_itoa(int n, char *s) /* convert n to characters in s */
|
||||
{
|
||||
int sign ;
|
||||
char *p = s ;
|
||||
@@ -51,8 +49,7 @@ int n;
|
||||
return(s) ;
|
||||
}
|
||||
|
||||
void reverse(s)
|
||||
char s[];
|
||||
void reverse(char s[])
|
||||
{
|
||||
int c, i, j;
|
||||
|
||||
|
||||
@@ -32,8 +32,7 @@ int m_lower(int c);
|
||||
|
||||
|
||||
/* Force a letter to lowercase */
|
||||
int m_lower(c)
|
||||
int c ;
|
||||
int m_lower(int c)
|
||||
{
|
||||
if (c >= 'A' && c <= 'Z') c += 'a' - 'A' ;
|
||||
return(c) ;
|
||||
|
||||
@@ -49,9 +49,7 @@ void *m_trace(char *text);
|
||||
|
||||
void *m_wctrace(M_WCHAR *text);
|
||||
|
||||
void m_free(block, msg)
|
||||
void *block ;
|
||||
char *msg ;
|
||||
void m_free(void *block, char *msg)
|
||||
{
|
||||
char buffer[32] ;
|
||||
|
||||
@@ -71,9 +69,7 @@ void m_free(block, msg)
|
||||
free(block) ;
|
||||
}
|
||||
|
||||
void *m_malloc(size, msg)
|
||||
int size ;
|
||||
char *msg ;
|
||||
void *m_malloc(int size, char *msg)
|
||||
{
|
||||
char buffer[32] ;
|
||||
void *p ;
|
||||
@@ -105,10 +101,7 @@ void *m_malloc(size, msg)
|
||||
return(p) ;
|
||||
}
|
||||
|
||||
void *m_realloc(ptr, size, msg)
|
||||
void *ptr ;
|
||||
int size ;
|
||||
char *msg ;
|
||||
void *m_realloc(void *ptr, int size, char *msg)
|
||||
{
|
||||
char buffer[32] ;
|
||||
void *p ;
|
||||
|
||||
@@ -35,9 +35,7 @@ void m_exit(int status);
|
||||
void m_openchk(FILE **ptr, char *name, char *mode);
|
||||
|
||||
/* Open a file and check that the open succeeded */
|
||||
void m_openchk(ptr, name, mode)
|
||||
FILE **ptr ;
|
||||
char *name, *mode ;
|
||||
void m_openchk(FILE **ptr, char *name, char *mode)
|
||||
{
|
||||
*ptr = fopen(name, mode) ;
|
||||
if (*ptr) return ;
|
||||
|
||||
@@ -72,9 +72,7 @@ return((int) wc);
|
||||
}
|
||||
|
||||
/* Reads the next token stored in a packed trie (as defined by context.dat) */
|
||||
int gettoken(c, context)
|
||||
int *c;
|
||||
int context;
|
||||
int gettoken(int *c, int context)
|
||||
{
|
||||
int hold[MAXD + 1];
|
||||
int ucase;
|
||||
@@ -123,8 +121,7 @@ return(M_NULLVAL);
|
||||
}
|
||||
|
||||
/* Reads a literal (called after the opening quotation mark is read) */
|
||||
LOGICAL litproc(delim)
|
||||
int delim;
|
||||
LOGICAL litproc(int delim)
|
||||
{
|
||||
int n, i, number;
|
||||
M_WCHAR *p, *pStart; /* bigger than wide versions of lit or lita */
|
||||
@@ -215,8 +212,7 @@ return(FALSE);
|
||||
|
||||
/* Returns a context-dependent delimiter string to input stream so
|
||||
characters can be reread one at a time in another context */
|
||||
void undodelim(delim)
|
||||
M_WCHAR *delim;
|
||||
void undodelim(M_WCHAR *delim)
|
||||
{
|
||||
M_WCHAR *p;
|
||||
|
||||
@@ -234,8 +230,7 @@ while (TRUE)
|
||||
/* Returns a character to the input stream to read again later. Unexplained
|
||||
problems occurred using standard ungetc procedure; hence
|
||||
explicit declaration of buffer for read-ahead characters */
|
||||
void ungetachar(c)
|
||||
int c;
|
||||
void ungetachar(int c)
|
||||
{
|
||||
M_WCHAR wnl;
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
/* Sparse.c has a procedure used with the tables generated by program
|
||||
CONTEXT when the sparse option is used */
|
||||
|
||||
int m_sprscon(i, j)
|
||||
int i, j ;
|
||||
int m_sprscon(int i, int j)
|
||||
{
|
||||
int k ;
|
||||
|
||||
|
||||
@@ -117,10 +117,7 @@ void *m_lookfortrie( const M_WCHAR *p , const M_TRIE *xtrie )
|
||||
}
|
||||
|
||||
/* Enters a string and associated data value into a trie */
|
||||
void *m_ntrtrie(p, xtrie, dataval)
|
||||
M_WCHAR *p ;
|
||||
M_TRIE *xtrie ;
|
||||
void *dataval ;
|
||||
void *m_ntrtrie(M_WCHAR *p, M_TRIE *xtrie, void *dataval)
|
||||
{
|
||||
M_TRIE *currentnode ;
|
||||
void *n ;
|
||||
|
||||
@@ -40,9 +40,7 @@ void printval(FILE *file, void *value);
|
||||
|
||||
/* Count the descendants of a node in order to generate declarations for
|
||||
the packed form of a trie*/
|
||||
void countdown(parent, count)
|
||||
M_TRIE *parent ;
|
||||
int *count ;
|
||||
void countdown(M_TRIE *parent, int *count)
|
||||
{
|
||||
M_TRIE *child ;
|
||||
|
||||
@@ -54,12 +52,8 @@ void countdown(parent, count)
|
||||
|
||||
/* Output descendants of a node for the declaration of a trie, in packed
|
||||
or normal format*/
|
||||
void dumpnode(first, file, trieptr, count, proc)
|
||||
LOGICAL *first ;
|
||||
FILE *file ;
|
||||
M_TRIE *trieptr ;
|
||||
int *count ;
|
||||
void (*proc) (FILE *file, void *value);
|
||||
void dumpnode(LOGICAL *first, FILE *file, M_TRIE *trieptr, int *count,
|
||||
void (*proc) (FILE *file, void *value))
|
||||
{
|
||||
M_TRIE *p ;
|
||||
int savecount ;
|
||||
@@ -89,9 +83,7 @@ void dumpnode(first, file, trieptr, count, proc)
|
||||
|
||||
|
||||
/* Most common procedure passed to dumpptrie */
|
||||
void printval(file, value)
|
||||
FILE *file ;
|
||||
void *value ;
|
||||
void printval(FILE *file, void *value)
|
||||
{
|
||||
fprintf(file, ", %ld", (long) value) ;
|
||||
}
|
||||
|
||||
@@ -35,12 +35,8 @@ void m_dumptrie(FILE *file, M_TRIE *xtrie, char *extname, int *count,
|
||||
void (*proc)(void *value));
|
||||
|
||||
/* Write the C declaration of a trie */
|
||||
void m_dumptrie(file, xtrie, extname, count, proc)
|
||||
FILE *file ;
|
||||
M_TRIE *xtrie ;
|
||||
char *extname ;
|
||||
int *count ;
|
||||
void (*proc)(void *value);
|
||||
void m_dumptrie(FILE *file, M_TRIE *xtrie, char *extname, int *count,
|
||||
void (*proc)(void *value))
|
||||
{
|
||||
int firstson ;
|
||||
M_TRIE *p ;
|
||||
|
||||
@@ -38,13 +38,9 @@ void dumpptrie(M_TRIE *intname, char *extname, FILE *file, char *externdef, char
|
||||
void (*proc)(FILE *file, void *value));
|
||||
|
||||
/* Write the declaration of a packed trie to the specified files */
|
||||
void dumpptrie(intname, extname, file, externdef, defdef, proc)
|
||||
M_TRIE *intname ;
|
||||
char *extname ;
|
||||
FILE *file ;
|
||||
char *externdef ;
|
||||
char *defdef ;
|
||||
void (*proc) (FILE *file, void *value);
|
||||
void dumpptrie(M_TRIE *intname, char *extname, FILE *file,
|
||||
char *externdef, char *defdef,
|
||||
void (*proc) (FILE *file, void *value))
|
||||
{
|
||||
LOGICAL first = TRUE ;
|
||||
int count = 0 ;
|
||||
|
||||
@@ -40,9 +40,7 @@ int m_packedlook(M_PTRIE *xptrie,
|
||||
M_WCHAR *name);
|
||||
|
||||
/* Look for the string NAME in the packed trie PTRIE */
|
||||
int m_packedlook(xptrie, name)
|
||||
M_PTRIE *xptrie ;
|
||||
M_WCHAR *name ;
|
||||
int m_packedlook(M_PTRIE *xptrie, M_WCHAR *name)
|
||||
{
|
||||
int current = 0 ;
|
||||
int i ;
|
||||
|
||||
@@ -33,10 +33,7 @@
|
||||
extern M_CHARTYPE m_ctarray[M_CHARSETLEN] ;
|
||||
|
||||
/* Changes the value associated with an entry in a trie. */
|
||||
void *m_resettrie(xtrie, p, value)
|
||||
M_TRIE *xtrie ;
|
||||
M_WCHAR *p ;
|
||||
void *value ;
|
||||
void *m_resettrie(M_TRIE *xtrie, M_WCHAR *p, void *value)
|
||||
{
|
||||
M_TRIE *currentnode ;
|
||||
|
||||
|
||||
@@ -214,8 +214,7 @@ return wc_stringStart;
|
||||
|
||||
|
||||
/* Get-wide-char procedure */
|
||||
int mb_getwc(m_ptr)
|
||||
void *m_ptr;
|
||||
int mb_getwc(void *m_ptr)
|
||||
{
|
||||
int c;
|
||||
M_WCHAR wc;
|
||||
|
||||
Reference in New Issue
Block a user