From e447dd1d43345ebb77560103e61b1335ca728e43 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20D=C5=82ugo=C5=82=C4=99cki?= Date: Mon, 22 Jul 2013 05:34:50 +0200 Subject: [PATCH] vlp-10 using coding style in genint1.h --- src/global/genint1.h | 193 +++++++++++++++++++++++++++++++------------ 1 file changed, 138 insertions(+), 55 deletions(-) diff --git a/src/global/genint1.h b/src/global/genint1.h index e013135..60434b2 100644 --- a/src/global/genint1.h +++ b/src/global/genint1.h @@ -33,15 +33,35 @@ or Andrzej Salwicki #endif -/* Appetites of values : */ -#define APINT 1 /* integer,boolean,string,char */ -#define APREAL sizeof(real)/sizeof(word) /* real */ -#define APVIRT 4 /* TO TELL APART A VIRTUAL ADDRESS */ - /* (ANY REFERENCE TYPE) FROM ANY OTHER TYPE */ -#define APREF 2 /* ACTUAL SIZE OF REFERENCE TYPE */ -#define APFMTYPE 2 /* FORMAL TYPE VALUE */ -#define APFMPROC 3 /* FORMAL PROCEURE OR FUNCTION VALUE, = APREF+1*/ -#define APOPCODE (sizeof(extopcode)+sizeof(word)-1)/sizeof(word) +/** + * Appetites of values + * \defgroup AppetitesOfValues Appetites of values + * @{ + */ +/** integer,boolean,string,char */ +#define APINT 1 + +/** real */ +#define APREAL sizeof(real)/sizeof(word) + +/** + * To tell apart a virtual address + * (any reference type) from any other type + */ +#define APVIRT 4 + +/** actual size of reference type */ +#define APREF 2 + +/** formal type value */ +#define APFMTYPE 2 + +/** formal procedure or function value, = apref + 1 */ +#define APFMPROC 3 + +#define APOPCODE (sizeof(extopcode) + sizeof(word) - 1) / sizeof(word) + +/** @} */ #ifndef __cplusplus typedef int bool; @@ -51,7 +71,8 @@ typedef int bool; #define TRUE 1 -/* Values identifying types and formal parameters : */ +/* Values identifying types and formal parameters: */ +/** @{ */ #define FORMFUNC 7 /* parameter "function" */ #define FORMPROC 8 /* parameter "procedure" */ @@ -64,10 +85,10 @@ typedef int bool; #define PRIMITIVETYPE 15 /* simple type */ #define CLASSTYPE 17 /* class type */ #define FILETYPE 18 /* file type */ - +/** @} */ /* Values to identify kinds of array elements : */ - +/** @{ */ #define AINT -1 /* arrayof integer */ #define AREAL -3 /* arrayof real */ #define AVIRT -2 /* arrayof reference */ @@ -75,6 +96,7 @@ typedef int bool; #define FILEOBJECT -11 /* file object */ #define SKILLED -99 /* killed object, only for compactification */ +/** @} */ #define DUMMY -1 /* dummy unit or prefix : SL for main block */ #define MAINBLOCK 0 /* main block prototype number */ @@ -82,7 +104,7 @@ typedef int bool; /* L-code instruction addressing modes : */ - +/** @{ */ #define GLOBAL 0 /* M[ N ] */ #define LOCAL 1 /* M[ c1+N ] */ #define TEMPLOCAL 2 /* M[ c2+N ] */ @@ -92,10 +114,11 @@ typedef int bool; #define CONSTANT 6 /* M[ N ] */ #define DOTACCESS 7 /* M[ M[ display+K ]+N ] */ #define NOARGUMENT 8 /* ------ */ +/** @} */ /* Prototype kind : */ - +/** @{ */ #define CLASS 0 #define RECORD 1 #define COROUTINE 2 @@ -105,6 +128,7 @@ typedef int bool; #define FUNCTION 6 #define PROCEDURE 7 #define HANDLER 8 +/** @} */ #if GEN #define LRECORD RECORD @@ -114,57 +138,116 @@ typedef int bool; #if GEN -typedef int protaddr; /* mainblock..maxprot ; mainblock = 0; */ +typedef int protaddr; /* mainblock..maxprot ; mainblock = 0; */ /* INDIRECT ADDRESS OF PROTOTYPE */ -typedef int dprotaddr; /* PROTADDR + DUMMY */ -typedef int protkind; +typedef int dprotaddr; /* PROTADDR + DUMMY */ +typedef int protkind; #else #define protaddr int #define dprotaddr int #define protkind int #endif -typedef int word; -/* Prototype : */ +/* TODO: Conditionally restore it:*/ +/*typedef int word;*/ +/** + * Prototype: + * \defgroup Prototype Prototype + * @{ + */ typedef struct { - dprotaddr slprototype; /* PROTOTYPE OF SYNTACTIC FATHER */ - /* OR DUMMY FOR THE MAIN BLOCK */ - word codeaddr; /* address of code */ - word appetite; /* object's total length */ - word span; /* distance from beginning of object to */ - /* temporary reference variables */ - word reflist; /* beginning and length of table with */ - - int lthreflist; /* offsets of reference values in object; */ - /* without SL, DL, CL and temporary values */ - word parlist; /* beginning and length of table with */ - int lthparlist; /* offsets of parameters */ - - word preflist; /* beginning and length of table with */ - int lthpreflist; /* prototype numbers of prefix sequence */ - - word lastwill; /* lastwill code address */ - word handlerlist; /* list of handlers, 0 if empty */ - word virtlist; /* address of table for conversion: */ - /* virtual number --> prototype */ - - /* only for processes : */ - protaddr maskbase; /* lowest procedure prototype number */ - int masksize; /* size of RPC mask for that process */ - - /* for procedures and functions */ - int virtnumber; /* virtual number or -1 if not virtual */ - - /* for all : */ - protkind kind; /* kind of unit */ - - /* only for procedures, functions and processes : */ - word pfdescr; /* address of table with parameters descr. addresses */ - - /* only for functions : */ + /** + * Prototype of syntactic father + * or dummy for the main block + */ + dprotaddr slprototype; + + /** address of code */ + word codeaddr; + /** object's total length */ + word appetite; + /** + * distance from beginning of object to + * temporary reference variables + */ + word span; + + /** beginning and length of table with */ + word reflist; + + /** + * offsets of reference values in object; + * without SL, DL, CL and temporary values + */ + int lthreflist; + /** beginning and length of table with */ + word parlist; + /** offsets of parameters */ + int lthparlist; + + /** beginning and length of table with */ + word preflist; + /** prototype numbers of prefix sequence */ + int lthpreflist; + + /** lastwill code address */ + word lastwill; + /** list of handlers, 0 if empty */ + word handlerlist; + /** + * address of table for conversion: + * virtual number --> prototype + */ + word virtlist; + + /** + * only for processes: + * @{ + */ + /** lowest procedure prototype number */ + protaddr maskbase; + /** size of RPC mask for that process */ + int masksize; + /** @} */ + + /** + * for procedures and functions + * \defgroup PrototypeForFunctions + * @{ + */ + /* virtual number or -1 if not virtual */ + int virtnumber; + /** @} */ + + /** + * for all : + * \defgroup PrototypeForAll + * @{ + */ + /** kind of unit */ + protkind kind; + /** @} */ + + /** + * only for procedures, functions and processes: + * \defgroup PrototypeForProceduresFunctionsProcesses + * @{ + */ + /** address of table with parameters descr. addresses */ + word pfdescr; + /** @} */ + + /** + * only for functions: + * \defgroup PrototypeForFunctions + * @{ + */ int nrarray; - word finaltype; /* type of result */ + /** @} */ + /* type of result */ + word finaltype; } protdescr,*pointprdsc; +/** @} */ -- 2.30.2