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

@@ -38,9 +38,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
#include "entdef.h"
/* Main procedure */
int main(argc, argv)
int argc ;
char **argv ;
int main(int argc, char **argv)
{
int m_prevcon ;

View File

@@ -38,9 +38,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
/* Verify that <PARAM>, <MIN> or <USEMAP> has not previously occurred in
this rule */
void found(flag, delim)
LOGICAL *flag;
char *delim;
void found(LOGICAL *flag, char *delim)
{
M_WCHAR wcbuff[129];
ssize_t length;

View File

@@ -34,8 +34,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
#include "build.h"
/* Enters an element name into the element name tree */
ELTSTRUCT *ntrelt(p)
M_WCHAR *p ;
ELTSTRUCT *ntrelt(M_WCHAR *p)
{
ELTSTRUCT *new ;
ELTSTRUCT *old ;

View File

@@ -58,11 +58,8 @@ int addarc(STATE *from, STATE *to, ELTSTRUCT *label, ANDGROUP *and, LOGICAL opti
/*checkand is used to verify nondeterminism from start and final states
of FSA's generated from and groups*/
void checkand(andstart, andptr, start, root, errelt)
ANDGROUP *andstart, *andptr ;
STATE *start ;
TREE *root ;
ELTSTRUCT **errelt ;
void checkand(ANDGROUP *andstart, ANDGROUP *andptr, STATE *start,
TREE *root, ELTSTRUCT **errelt)
{
ARC *parc ;
ANDGROUP *pand ;
@@ -86,12 +83,8 @@ void checkand(andstart, andptr, start, root, errelt)
/*Checkdfsa is called when adding an arc to an FSA in order to verify that
no existing arc from the same state (or from a start state of an and-group
FSA labelling an arc from the same state) has the same label. */
int checkdfsa(from, label, and, id, errelt)
STATE *from ;
ELTSTRUCT *label ;
ANDGROUP *and ;
int id ;
ELTSTRUCT **errelt ;
int checkdfsa(STATE *from, ELTSTRUCT *label, ANDGROUP *and, int id,
ELTSTRUCT **errelt)
{
int c ;
ARC *parc ;
@@ -116,10 +109,7 @@ int checkdfsa(from, label, and, id, errelt)
}
/* Check use of repeated models with and groups */
int checkrepeat(from, and, errelt)
STATE *from ;
ANDGROUP *and ;
ELTSTRUCT **errelt ;
int checkrepeat(STATE *from, ANDGROUP *and, ELTSTRUCT **errelt)
{
ARC *parc ;
int c ;
@@ -142,8 +132,7 @@ int checkrepeat(from, and, errelt)
}
/* Copyintolist copies one list of states into another */
void copyintolist(from, to)
STATELIST *from, **to ;
void copyintolist(STATELIST *from, STATELIST **to)
{
STATELIST **new, *old ;
@@ -161,8 +150,7 @@ void copyintolist(from, to)
}
/* Dellist deletes a list of states */
void dellist(list)
STATELIST **list ;
void dellist(STATELIST **list)
{
STATELIST *p, *q ;
@@ -220,10 +208,7 @@ STATE *getstate(void)
}
/* Makeand processes a submodel whose connector is & */
void makeand(canbenull, root, optional)
LOGICAL *canbenull ;
TREE *root ;
int optional ;
void makeand(LOGICAL *canbenull, TREE *root, int optional)
{
TREE *child ;
STATELIST *start, *final ;
@@ -308,9 +293,7 @@ void makeand(canbenull, root, optional)
allfinal is passed from model to submodel; information in newfinal
goes from submodel to model.
*/
LOGICAL makefsa(root, optional)
TREE *root ;
int optional ;
LOGICAL makefsa(TREE *root, int optional)
{
LOGICAL canbenull ;
@@ -344,9 +327,7 @@ LOGICAL makefsa(root, optional)
}
/* Makeor processes a submodel whose connector is | */
void makeor(canbenull, root)
LOGICAL *canbenull ;
TREE *root ;
void makeor(LOGICAL *canbenull, TREE *root)
{
TREE *child ;
STATELIST *final ;
@@ -368,10 +349,7 @@ void makeor(canbenull, root)
}
/* Makeseq processes a submodel whose connector is , */
void makeseq(canbenull, root, optional)
LOGICAL *canbenull ;
TREE *root ;
int optional ;
void makeseq(LOGICAL *canbenull, TREE *root, int optional)
{
LOGICAL branchnull ;
STATELIST *keepfinal = NULL, *final ;
@@ -409,10 +387,7 @@ void makeseq(canbenull, root, optional)
/* Nondeterm issues a diagnostic when a nondeterministic model is
encountered */
void nondeterm(root, c, eltp)
TREE *root ;
int c ;
ELTSTRUCT *eltp ;
void nondeterm(TREE *root, int c, ELTSTRUCT *eltp)
{
M_WCHAR *wtemp;
@@ -443,8 +418,7 @@ void nondeterm(root, c, eltp)
/* Notinlist returns TRUE iff item is not in list. If item is in list,
it makes sure that the stored nesting level is the smaller of the two */
LOGICAL notinlist(item, list)
STATELIST *item, *list ;
LOGICAL notinlist(STATELIST *item, STATELIST *list)
{
for ( ; list ; list = list->next)
if (list->value == item->value) {
@@ -456,8 +430,7 @@ LOGICAL notinlist(item, list)
/* Returns true if the arc is labeled #PCDATA or with an and-group that
has an arc labelled #PCDATA from a start state */
LOGICAL permitspcd(a)
ARC *a ;
LOGICAL permitspcd(ARC *a)
{
ANDGROUP *pand ;
ARC *b ;
@@ -507,8 +480,7 @@ void push(void)
/* Regenerate is used in error processing to print the portion of a grammar
rule preceding an error */
LOGICAL regenerate(start, stop)
TREE *start, *stop ;
LOGICAL regenerate(TREE *start, TREE *stop)
{
TREE *child ;
@@ -554,8 +526,7 @@ return(FALSE) ;
by adding arcs from all the final states to all the states reachable
in one transition from a start state, labelling them as arcs from
start states are labelled. */
void repeat(root)
TREE *root ;
void repeat(TREE *root)
{
STATELIST *final ;
ARC *a ;
@@ -606,9 +577,7 @@ void repeat(root)
/* Used during processing of occurrence indicators in content models such
as (a+)+ to prohibit duplicate arcs */
LOGICAL samelabelarc(a, s)
ARC *a ;
STATE *s ;
LOGICAL samelabelarc(ARC *a, STATE *s)
{
ARC *b ;
@@ -666,11 +635,8 @@ void savestartarcs(void)
/* Simplebranch adds a new state and transition to it in an FSA when a
submodel consists of a single element or of an and group */
void simplebranch(root, value, group, optional)
TREE *root ;
ELTSTRUCT *value ;
ANDGROUP *group ;
int optional ;
void simplebranch(TREE *root, ELTSTRUCT *value, ANDGROUP *group,
int optional)
{
STATE *new = NULL ;
STATELIST *index ;
@@ -718,9 +684,7 @@ void simplebranch(root, value, group, optional)
subtree in the tree representing the grammar rule being processed and
the pointer to a flag that is set to indicate whether or not the
submodel can be null. */
STATE *startfsa(root, canbenull)
TREE *root ;
LOGICAL *canbenull ;
STATE *startfsa(TREE *root, LOGICAL *canbenull)
{
STATELIST *item ;
STATE *first ;

View File

@@ -69,8 +69,7 @@ char mrequired[] = "M_REQUIRED" ;
/* Deftype returns a string indicating the default type of the nth parameter.
*/
char *deftype(n)
int n ;
char *deftype(int n)
{
switch (n) {
case NAME: return(mnamedef) ;
@@ -101,9 +100,7 @@ void done(void)
}
/* Prints data value of an entry in the element name tree */
void dumpentnode(file, value)
FILE *file ;
M_TRIE *value ;
void dumpentnode(FILE *file, M_TRIE *value)
{
fprintf(file, ", %d", ((ELTSTRUCT *) value)->eltno) ;
@@ -111,9 +108,7 @@ void dumpentnode(file, value)
/* Prints data value of an entry in the trie of short reference map names,
reporting any maps that are referenced but not defined */
void dumpmapnode(file, value)
FILE *file ;
M_TRIE *value ;
void dumpmapnode(FILE *file, M_TRIE *value)
{
fprintf(file, ", %d", ((MAP *) value)->map) ;
if (! ((MAP *) value)->defined)
@@ -123,9 +118,7 @@ void dumpmapnode(file, value)
/* Prints data value of an entry in the trie of short reference delimiters */
void dumpsrefnode(file, value)
FILE *file ;
M_TRIE *value ;
void dumpsrefnode(FILE *file, M_TRIE *value)
{
fprintf(file, ", %d", ((SREFSTRUCT *) value)->srefcnt) ;
}
@@ -133,8 +126,7 @@ void dumpsrefnode(file, value)
/* Controls printing of element blocks in alphabetical order to the
template file */
void eltblocks(tempfile)
FILE *tempfile ;
void eltblocks(FILE *tempfile)
{
int n ;
M_TRIE *node[M_NAMELEN + 1] ;
@@ -223,8 +215,7 @@ void eltreeout(void)
}
/* Enttype returns a string indicating the type of an entity */
char *enttype(n)
int n ;
char *enttype(int n)
{
switch(n) {
case M_GENERAL: return(mgeneral) ;
@@ -452,8 +443,7 @@ fprintf(dtd, "#define M_MAXPAR %d\n\n", maxpar) ;
}
/* Partype returns a string indicating the type of the nth parameter. */
char *partype(n)
int n ;
char *partype(int n)
{
switch(n) {
case GRPO: return(mkeyword) ;
@@ -546,9 +536,7 @@ void srefout(void)
}
/* Output one element block in a template */
void tempelt(eltp, tempfile)
ELTSTRUCT *eltp ;
FILE *tempfile ;
void tempelt(ELTSTRUCT *eltp, FILE *tempfile)
{
PARAMETER *paramp ;
PTYPE *ptypep ;
@@ -658,8 +646,7 @@ void template(void)
}
/* Typecon returns a string indicating the content type of the nth element.*/
char *typecon(n)
int n ;
char *typecon(int n)
{
switch(n) {
case GRPO: return(mregexp) ;

View File

@@ -38,8 +38,7 @@ This product and information is proprietary of Tandem Computers Incorporated.
#include "sref.h"
/* Reads a name */
LOGICAL getname(first)
int first;
LOGICAL getname(int first)
{
M_WCHAR *p;
int c;

View File

@@ -36,8 +36,7 @@ static M_WCHAR *wc_prefix = NULL;
/* Add an entity with the default name constructed by adding a suffix
to the name of the short reference map in which it is invoked, and
a prefix m- */
void adddefent(mapname)
M_WCHAR *mapname;
void adddefent(M_WCHAR *mapname)
{
M_WCHAR *p;
int n;
@@ -75,8 +74,7 @@ thissref->entidx = entity->index;
/* Add an entity, return FALSE if already there, TRUE if adding it.
Pointer to the entity structure is in global M_STRUCT *entity. */
LOGICAL addent(name)
M_WCHAR *name;
LOGICAL addent(M_WCHAR *name)
{
M_ENTITY *new;
@@ -128,16 +126,14 @@ return(TRUE);
}
/* Add a named entity to a short reference map */
void addndent(p)
M_WCHAR *p;
void addndent(M_WCHAR *p)
{
addent(p);
thissref->entidx = entity->index;
}
/* Add a short reference delimiter */
void addsref(p)
M_WCHAR *p;
void addsref(M_WCHAR *p)
{
SREFSTRUCT *delim;
SREFSTRUCT *prevsr;

View File

@@ -44,8 +44,7 @@ void endmodel(void)
}
/* Release storage used for the tree representation of a rule */
void freetree(treep)
TREE *treep ;
void freetree(TREE *treep)
{
TREE *child, *discard ;