dthelp: Convert all K&R function definitions to ANSI (C90) standard

This commit is contained in:
Peter Howkins
2018-06-24 00:50:56 +01:00
parent f89139dd84
commit 5aa1fed48b
172 changed files with 547 additions and 1308 deletions

View File

@@ -44,8 +44,7 @@ in the interface definition.*/
#include "signon.h"
/* When an explicit or implied end-tag occurs */
void m_endaction(m_elt)
M_ELEMENT m_elt;
void m_endaction(M_ELEMENT m_elt)
{
M_ELEMENT m_action;
char buffer[2*MAXD+M_NAMELEN+1];
@@ -76,9 +75,7 @@ void m_endaction(m_elt)
}
/* Find appropriate action according to current stack */
int m_findact(elt, array)
M_ELEMENT elt;
int *array;
int m_findact(M_ELEMENT elt, int *array)
{
int chainlen = 0;
int index;
@@ -156,8 +153,7 @@ m_free(wc_string,"wide character string");
}
/* When an explicit or implied start-tag occurs */
void m_strtaction(m_elt)
M_ELEMENT m_elt;
void m_strtaction(M_ELEMENT m_elt)
{
int m_par, m_i;
M_WCHAR *m_p;

View File

@@ -28,8 +28,7 @@
#include "userinc.h"
#include "globdec.h"
void m_closent(m_ptr)
void *m_ptr ;
void m_closent(void *m_ptr)
{
fclose((FILE *) m_ptr) ;
}

View File

@@ -37,8 +37,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
#include "entfile.c"
/* When a reference to a CODE entity is encountered */
void m_codeent(m_ent)
int m_ent ;
void m_codeent(int m_ent)
{
(*m_ctable[m_ent])() ;
}

View File

@@ -29,9 +29,7 @@ Copyright 1988, 1989 Hewlett-Packard Co.
#include "globdec.h"
/* Displays current element after some error messages */
void m_dispcurelt(file, line)
M_WCHAR *file ;
int line ;
void m_dispcurelt(M_WCHAR *file, int line)
{
char *mb_parent;

View File

@@ -37,8 +37,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
/* Perform the m_action-th end-code in the interface */
void m_endcase(m_action)
int m_action ;
void m_endcase(int m_action)
{
(*m_etable[m_action])() ;
}

View File

@@ -52,8 +52,7 @@ void m_ckmap(M_WCHAR *name, LOGICAL useoradd)
/* Check type specified in entity declaration for previously defined
entity. Testing to see if the new declaration is identical to the
original one. */
void m_eduptype(type)
int type ;
void m_eduptype(int type)
{
if ((int) m_entity->type != type) {
m_err1("Redefinition of entity %s ignored", m_entity->name) ;
@@ -63,8 +62,7 @@ void m_eduptype(type)
}
/* Tests if an entity is too long */
void m_longent(context)
int context ;
void m_longent(int context)
{
if (m_entclen >= M_LITLEN) {
m_curcon = context ;
@@ -74,8 +72,7 @@ void m_longent(context)
}
/* Enters an entity name into the entity name tree */
void m_ntrent(p)
M_WCHAR *p ;
void m_ntrent(M_WCHAR *p)
{
M_ENTITY *new ;

View File

@@ -40,8 +40,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
/* Issue error message (no arguments) */
void m_error(text)
char *text;
void m_error(char *text)
{
m_startmsg();
m_errline(text);
@@ -316,9 +315,7 @@ void m_err7(
/* Getline.c returns the name of the current input file and the number
of the current line */
void m_getline(file, line)
M_WCHAR **file;
int *line;
void m_getline(M_WCHAR **file, int *line)
{
int i;

View File

@@ -64,8 +64,7 @@ void m_etcomplete(void)
/* M_frcend is called after a syntax error to end element VAL even
if more content for that element is expected */
void m_frcend(val)
M_ELEMENT val ;
void m_frcend(M_ELEMENT val)
{
M_PARSE *stackptr ;
M_ELEMENT poppedval ;

View File

@@ -33,8 +33,7 @@
/* Procedure callable by interface designer. Returns number of occurrences
of element on parse stack */
int m_level(elt)
M_WCHAR *elt ;
int m_level(M_WCHAR *elt)
{
int i = 0 ;
M_PARSE *stackptr ;
@@ -48,8 +47,7 @@ int m_level(elt)
}
int m_mblevel(elt)
char *elt ;
int m_mblevel(char *elt)
{
int retval;
M_WCHAR *wc_elt;

View File

@@ -38,11 +38,8 @@ This product and information is proprietary of Tandem Computers Incorporated.
#include "parser.h"
#include "entext.h"
LOGICAL m_lookent(name, type, content, wheredef)
M_WCHAR *name ;
unsigned char *type ;
M_WCHAR **content ;
unsigned char *wheredef ;
LOGICAL m_lookent(M_WCHAR *name, unsigned char *type, M_WCHAR **content,
unsigned char *wheredef)
{
M_ENTITY *entity ;

View File

@@ -99,11 +99,7 @@ void m_expecting(void)
/* Recursive procedure first called from expecting() to display
names of elements reachable from a particular node */
void m_expexpand(expstart, node, required, data)
LOGICAL *expstart ;
M_STATE node ;
LOGICAL *required ;
LOGICAL *data ;
void m_expexpand(LOGICAL *expstart, M_STATE node, LOGICAL *required, LOGICAL *data)
{
M_ARC parc ;
M_ANDGROUP pand ;
@@ -125,10 +121,7 @@ void m_expexpand(expstart, node, required, data)
}
/* M_expline writes one line for m_expecting() */
void m_expline(expstart, data, label)
LOGICAL *expstart ;
LOGICAL *data ;
M_ELEMENT label ;
void m_expline(LOGICAL *expstart, LOGICAL *data, M_ELEMENT label)
{
char buffer[M_NAMELEN + 2*MAXD + 1] ;
@@ -165,9 +158,7 @@ void m_expline(expstart, data, label)
/* M_exptend is called from m_expecting to inform the user after an
error if an end tag is permitted */
void m_exptend(expstart, stackptr)
LOGICAL *expstart ;
M_PARSE *stackptr ;
void m_exptend(LOGICAL *expstart, M_PARSE *stackptr)
{
char buffer[M_NAMELEN + 2*MAXD + 1] ;
@@ -216,9 +207,7 @@ void m_exptend(expstart, stackptr)
element, 1 if character data is expected, and 0 (FALSE) if there is
no unique element.
*/
M_ELEMENT m_findunique(from, newleft)
M_STATE from ;
int *newleft ;
M_ELEMENT m_findunique(M_STATE from, int *newleft)
{
M_ARC parc ;
M_ELEMENT cr = 0, minim = 0;
@@ -339,7 +328,7 @@ LOGICAL m_omitend(void)
/* Tests to see if a start tag may have been omitted at this point of
the parse. If so, saves the element name in the MINVAL array*/
LOGICAL m_omitstart()
LOGICAL m_omitstart(void)
{
M_ELEMENT c = M_NULLVAL ;
@@ -420,4 +409,3 @@ LOGICAL m_omitstart()
m_nextms = &(*m_nextms)->next ;
return(TRUE) ;
}

View File

@@ -33,8 +33,7 @@ Copyright 1988, 1989 Hewlett-Packard Co.
#include "parser.h"
/* Get program options from a string */
void m_optstring(p)
char *p ;
void m_optstring(char *p)
{
if (strchr(p, 'a')) m_malftrace = TRUE ;
if (strchr(p, 'c')) m_chtrace = TRUE ;

View File

@@ -42,8 +42,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
/* Process the value for the parameter whose index number was previously
saved in m_ppsave */
void m_attval(string)
M_WCHAR *string ;
void m_attval(M_WCHAR *string)
{
const M_WCHAR *p ;
@@ -65,8 +64,7 @@ void m_attval(string)
/* Process a string that is a parameter value not prefixed by the parameter
name and value indicator */
LOGICAL m_attvonly(string)
M_WCHAR *string ;
LOGICAL m_attvonly(M_WCHAR *string)
{
const M_WCHAR *p ;
int par, i ;
@@ -152,8 +150,7 @@ void m_findatt(void)
}
/* Free the parameter storage associated with an element on the parse stack */
void m_freeparam(stackelt)
M_PARSE *stackelt ;
void m_freeparam(M_PARSE *stackelt)
{
int i ;
int par ;
@@ -173,9 +170,7 @@ void m_freeparam(stackelt)
/* Force a parameter value to uppercase, if appropriate for its type.
Also, if list-valued attribute, remove leading and trailing spaces,
and condense white-space sequences to a single blank*/
void m_parupper(par, string)
int par ;
M_WCHAR *string ;
void m_parupper(int par, M_WCHAR *string)
{
M_WCHAR *p ;
M_WCHAR *q ;
@@ -233,11 +228,7 @@ void m_stkdefaultparams(void)
}
/* Stack one default parameter */
void m_stkonedef(par, scanel, poccur, i)
int par ;
M_ELEMENT scanel ;
M_WCHAR **poccur ;
int i ;
void m_stkonedef(int par, M_ELEMENT scanel, M_WCHAR **poccur, int i)
{
if (m_parameter[par - 1].deftype == M_REQUIRED ||
(m_parameter[par - 1].deftype == M_CURRENT &&
@@ -313,8 +304,7 @@ void m_updatedefault(const int par , const M_WCHAR *string )
/* Check to see if a string that occurs after the element name in a start
tag is a valid parameter name or value; if not, assume tag is ended */
LOGICAL m_validinpar(string)
M_WCHAR *string ;
LOGICAL m_validinpar(M_WCHAR *string)
{
int par ;
M_WCHAR *p ;

View File

@@ -34,8 +34,7 @@
/* Procedure callable by interface designers. Returns pointer to name
of nth level parent of current element (0 is self, 1 is parent, 2
is grandparent, etc.) */
M_WCHAR *m_parent(n)
int n ;
M_WCHAR *m_parent(int n)
{
M_PARSE *stackptr ;

View File

@@ -36,9 +36,7 @@
#include "entext.h"
/* Main procedure */
void main(argc, argv)
int argc ;
char **argv ;
void main(int argc, char **argv)
{
static char parserr[] = "\nM_token=%d, m_prevcon=%d, m_scanval=%d\n" ;
static char sopt[] =

View File

@@ -87,7 +87,7 @@ M_ELEMENT m_eltname(void)
}
}
int get_mb_cur_max()
int get_mb_cur_max(void)
{
char *l;
int i;

View File

@@ -38,10 +38,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
/* When a processing instruction or SDATA entity other than a CODE entity
occurs */
void m_piaction(m_pi, m_entname, m_enttype)
M_WCHAR *m_pi ;
M_WCHAR *m_entname ;
int m_enttype ;
void m_piaction(M_WCHAR *m_pi, M_WCHAR *m_entname, int m_enttype)
{
m_stackpar = m_stacktop->piparam ;
(*m_ptable[m_stacktop->picase])(m_pi, m_entname, m_enttype) ;

View File

@@ -62,8 +62,7 @@ int m_actgetc(void)
}
/* Expand an entity reference */
void m_entexpand(openent)
M_ENTITY *openent ;
void m_entexpand(M_ENTITY *openent)
{
M_WCHAR *p ;
M_HOLDTYPE dchar ;
@@ -231,9 +230,7 @@ void m_entexpand(openent)
/* An srlen-character long short-reference delimiter has been found. Verify
that it is not the prefix of a general delimiter recognized in context*/
LOGICAL m_gendelim(srlen, context)
int srlen ;
int context ;
LOGICAL m_gendelim(int srlen, int context)
{
int ghold[MAXD + 1] ;
int ucase ;
@@ -321,8 +318,7 @@ LOGICAL m_gendelim(srlen, context)
/* Reads next input character from the current source file or from an
entity expansion */
int m_getachar(dchar)
M_HOLDTYPE *dchar ;
int m_getachar(M_HOLDTYPE *dchar)
{
int c ;
int i ;
@@ -427,10 +423,7 @@ void m_getname(M_WCHAR first)
}
/* Reads the next token */
int m_gettoken(c, dchar, context)
int *c ;
M_HOLDTYPE *dchar ;
int context ;
int m_gettoken(int *c, M_HOLDTYPE *dchar, int context)
{
int hold[MAXD + 1], next ;
int ucase ;
@@ -554,8 +547,7 @@ int m_gettoken(c, dchar, context)
}
/* Reads a literal */
void m_litproc(delim)
int delim ;
void m_litproc(int delim)
{
int n, i ;
M_HOLDTYPE dchar ;
@@ -886,8 +878,7 @@ void m_setmap(int map, LOGICAL useoradd)
}
/* Check for short reference delimiters */
void m_shortref(context)
int context ;
void m_shortref(int context)
{
int n = 0 ;
int i ;

View File

@@ -35,9 +35,7 @@
#include "parser.h"
/* Set a user-defined C variable to the corresponding parameter value */
void m_setparam(cvar, par)
M_WCHAR **cvar ;
int par ;
void m_setparam(M_WCHAR **cvar, int par)
{
*cvar = m_stackpar->param[par] ;
}

View File

@@ -36,8 +36,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
#include "sfile.c"
/* Perform the m_action-th start-code in the interface */
void m_strtcase(m_action)
int m_action ;
void m_strtcase(int m_action)
{
(*m_stable[m_action])() ;
}

View File

@@ -46,8 +46,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
is valid input. It returns TRUE, FALSE, or M_NONCONTEXTUAL respectively
if the element is allowed by content, not allowed, or allowed by an
inclusion exception. */
int m_checkstart(val)
M_ELEMENT val ;
int m_checkstart(M_ELEMENT val)
{
M_PARSE *stackptr ;
int except ;
@@ -238,8 +237,7 @@ void m_done(void)
}
/* Process the endtag (implied, abbreviated, or explicit) for element C*/
void m_endtag(c)
M_ELEMENT c ;
void m_endtag(M_ELEMENT c)
{
m_endaction(c) ;
m_pop() ;
@@ -251,8 +249,7 @@ void m_endtag(c)
/* Check that the identified element is not prohibited in the current context
by an exclusion exception */
LOGICAL m_excluded(elt)
M_ELEMENT elt ;
LOGICAL m_excluded(M_ELEMENT elt)
{
M_PARSE *stackptr ;
int except ;
@@ -270,8 +267,7 @@ LOGICAL m_excluded(elt)
/* Free the OPEN FSA substructures associated with an element on
the parse stack */
void m_freeFSA(stackelt)
M_PARSE *stackelt ;
void m_freeFSA(M_PARSE *stackelt)
{
M_OPENFSA *fsastack ;
M_ANDLIST *usedand ;
@@ -290,9 +286,7 @@ void m_freeFSA(stackelt)
}
/* Free storage used for tentative chain of tag minimizations */
void m_freemin(min, msg)
M_MIN *min ;
char *msg ;
void m_freemin(M_MIN *min, char *msg)
{
M_MIN *discard ;
@@ -307,9 +301,7 @@ void m_freemin(min, msg)
in the current content model by starting a new submodel of the and-group
indicated by fsastack, or (if the and-group is within a seq-group) by
continuing past the and-group */
LOGICAL m_nextand(thisfsa, label)
M_OPENFSA *thisfsa ;
M_ELEMENT label ;
LOGICAL m_nextand(M_OPENFSA *thisfsa, M_ELEMENT label)
{
M_ANDLIST *newgroup ;
M_ANDGROUP pand ;
@@ -461,8 +453,7 @@ void m_push(M_ELEMENT elt, M_STATE current, LOGICAL need)
character is treated differently so that if character data is not
allowed in the current context, an error message is issued with the
first character only and not with every character. */
void m_strtcdata(scanval)
int scanval ;
void m_strtcdata(int scanval)
{
if (! m_strtproc(M_NULLVAL))
if (m_whitespace((M_WCHAR) scanval)) {
@@ -493,8 +484,7 @@ void m_strtcdata(scanval)
to an element that was within #PCDATA, m_strtproc saves the current context
and restores it after returning from the last call to m_endtag.)
*/
LOGICAL m_strtproc(scanval)
M_ELEMENT scanval ;
LOGICAL m_strtproc(M_ELEMENT scanval)
{
int check ;
M_PARSE *original ;