1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
/*
* compiler/core/snacc_util.h
*
* Copyright (C) 1992 Michael Sample and the University of British Columbia
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* $Header: /usr/app/odstb/CVS/snacc/compiler/core/snacc-util.h,v 1.3 1995/07/25 19:41:46 rj Exp $
* $Log: snacc-util.h,v $
* Revision 1.3 1995/07/25 19:41:46 rj
* changed `_' to `-' in file names.
*
* Revision 1.2 1994/09/01 00:46:41 rj
* snacc_config.h's 2nd last macro, PrintErrLoc(), got here.
*
* Revision 1.1 1994/08/28 09:49:41 rj
* first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
*
*/
#define PrintErrLoc( fileName, lineNo)\
fprintf (stderr, "file \"%s\", line %d: ", fileName, lineNo)
/*
* macro to allocate room for str & null & put in give STR*
*/
#define SETUP_STR( strPtr, string)\
(strPtr)->str = Malloc (strlen (string) + 1);\
strcpy ((strPtr)->str, string);\
(strPtr)->len = strlen (string) + 1
/*
* Create a new list type such that each elmt has space
* to hold a pointer
*/
#define NEWLIST() AsnListNew (sizeof (void *))
/*
* macro to append an element to the end of linked list
* - helps on left recursion when order must be maintained
*
* be careful of calling context if list is null
* that is, make sure the change to list is not lost.
*/
#define APPEND( elmt, list) \
{\
void **tmpPtr;\
if ((list) == NULL)\
(list) = NEWLIST();\
tmpPtr = (void **) AsnListAppend ((AsnList *)list);\
*tmpPtr = (void *) (elmt);\
}
/*
* like APPEND except puts elmt at head of list
*/
#define PREPEND( elmt, list) \
{\
void **tmpPtr;\
if ((list) == NULL)\
(list) = NEWLIST();\
tmpPtr = (void **)AsnListPrepend ((AsnList *)list);\
*tmpPtr = (void *) (elmt);\
}
void SetupType PROTO ((Type **t, enum BasicTypeChoiceId typeId, unsigned long lineNum));
void SetupMacroType PROTO ((Type **t, enum MacroTypeChoiceId macroTypeId, unsigned long lineNum));
void SetupValue PROTO ((Value **v, enum BasicValueChoiceId valId, unsigned long lineNum));
void AddPrivateImportElmt PROTO ((Module *m, char *name, char *refModuleName, long int lineNo));
ImportElmt *LookupImportElmtInModule PROTO ((Module *m, char *name, ImportModule **importModule));
ImportElmt *LookupImportElmtInImportElmtList PROTO ((ImportElmtList *importElmtList, char *name));
ImportModule *LookupImportModule PROTO ((Module *m, char *importModuleName));
TypeDef *LookupType PROTO ((TypeDefList *t, char *typeName));
Module *LookupModule PROTO ((ModuleList *m, char *modName, OID *oid));
NamedType *LookupFieldInType PROTO ((Type *t, char *fieldName));
Type *GetType PROTO ((Type *t));
Type *ParanoidGetType PROTO ((Type *t));
enum BasicTypeChoiceId GetBuiltinType PROTO ((Type *t));
NamedNumberList *GetNamedElmts PROTO ((Type *t));
NamedNumberList *GetAllNamedElmts PROTO ((Type *t));
Type *GetParent PROTO ((Type *ancestor, Type *child));
ValueDef *LookupValue PROTO ((ValueDefList *v, char *valueName));
Value *GetValue PROTO ((Value *v));
int CompareOids PROTO ((OID *oid1, OID *oid2));
int HasNamedElmts PROTO ((Type *t));
int TagsAreIdentical PROTO ((TagList *t1, TagList *t2));
int HasDefaultTag PROTO ((Type *t));
int IsPrimitiveByDefOrRef PROTO ((Type *t));
int IsPrimitiveByDef PROTO ((Type *t));
int IsDefinedByLibraryType PROTO ((Type *t));
int IsTypeRef PROTO ((Type *t));
int IsNewType PROTO ((Type *t));
int IsTailOptional PROTO ((NamedTypeList *e));
int NextIsTailOptional PROTO ((NamedTypeList *e));
int AllElmtsOptional PROTO ((NamedTypeList *e));
AnyRefList **GetAnyRefListHndl PROTO ((Type *t));
void AppendSubtype PROTO ((Subtype **s, Subtype *newSubtype, enum SubtypeChoiceId op));
|