From 8a71ec32240de15a8302e1e976388a57ce408177 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20D=C5=82ugo=C5=82=C4=99cki?= Date: Sun, 21 Jul 2013 23:15:21 +0200 Subject: [PATCH] vlp-10 using coding style in process.h --- src/int/process.h | 249 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 177 insertions(+), 72 deletions(-) diff --git a/src/int/process.h b/src/int/process.h index 79435a0..22fe056 100644 --- a/src/int/process.h +++ b/src/int/process.h @@ -2,113 +2,218 @@ /* Process management definitions : */ +/* maximum number of processes on one node */ +#define MAXPROCESS 64 +/* maximum number of waiting messages */ +#define MAXMSGQUEUE 16 -#define MAXPROCESS 64 /* maximum number of processes on one node */ -#define MAXMSGQUEUE 16 /* maximum number of waiting messages */ - -#define MSGLENGTH 256 /* message length defined by me (PS) */ +/* message length defined by me (PS) */ +#define MSGLENGTH 256 /* Process state : */ -#define GENERATING 0 /* during generation of process object */ -#define STOPPED 1 /* non-active process (suspended by STOP) */ -#define EXECUTING 2 /* active process (ready to execute) */ -#define WAITFORNEW 3 /* waiting for NEW of another process */ -#define WAITFORRPC 4 /* waiting for remote procedure call */ -#define ACCEPTING 5 /* during execution of ACCEPT statement */ -#define WAITASKPRO 6 /* waiting for process prototype */ +/* during generation of process object */ +#define GENERATING 0 +/* non-active process (suspended by STOP) */ +#define STOPPED 1 +/* active process (ready to execute) */ +#define EXECUTING 2 +/* waiting for NEW of another process */ +#define WAITFORNEW 3 +/* waiting for remote procedure call */ +#define WAITFORRPC 4 +/* during execution of ACCEPT statement */ +#define ACCEPTING 5 +/* waiting for process prototype */ +#define WAITASKPRO 6 /* Process descriptor : */ typedef struct { - bool used; /* TRUE if in use by some process */ - word mark; /* process mark for proper detecting of none */ - int status; /* process state */ - word prot; /* process prototype number */ - memory M; /* pointer to memory array */ - union value param[ MAXPARAM ]; - word ic; /* instruction counter */ - word trlnumber; /* trace line number */ - word lower; /* first word of object area */ - word upper; /* last word in memory */ - word lastused; /* last word used by objects */ - word lastitem; /* first word used by dictionary */ - word freeitem; /* head of free dictionary item list */ - word headk; /* head of killed object list for size > 2 */ - word headk2; /* head of killed object list for size = 2 */ - word prochead; /* am of process object */ - virtaddr procref; /* process object virtual address */ - virtaddr template; /* remote process or procedure template */ - word c1, c2; /* pointers to current object */ - virtaddr backobj; /* adress of object just left */ - word blck1, blck2; /* used for LBLOCK1, LBLOCK2, LBLOCK3 */ - queue msgqueue; /* queue of messages for this process */ - queue rpcwait; /* queue of disabled RPC messages */ - stack rpcmask; /* stack of set of enabled remote procedures */ - bool force_compactification; /* next allocate will forace compact... */ - word *hash; /* table of pointers to processes in process */ - word hash_size; -} procdescr; + /* TRUE if in use by some process */ + bool used; + + /* process mark for proper detecting of none */ + word mark; + + /* process state */ + int status; + + /* process prototype number */ + word prot; + + /* pointer to memory array */ + memory M; + + union value param[MAXPARAM]; + + /* instruction counter */ + word ic; + + /* trace line number */ + word trlnumber; + + /* first word of object area */ + word lower; + + /* last word in memory */ + word upper; + + /* last word used by objects */ + word lastused; + + /* first word used by dictionary */ + word lastitem; + + /* head of free dictionary item list */ + word freeitem; + + /* head of killed object list for size > 2 */ + word headk; + + /* head of killed object list for size = 2 */ + word headk2; + + /* am of process object */ + word prochead; + + /* process object virtual address */ + virtaddr procref; + + /* remote process or procedure template */ + virtaddr template; + + /* pointers to current object */ + word c1, c2; + + /* adress of object just left */ + virtaddr backobj; + /* used for LBLOCK1, LBLOCK2, LBLOCK3 */ + word blck1, blck2; -/* Message type : */ + /* queue of messages for this process */ + queue msgqueue; -#define ERRSIG 0 /* error signal */ -#define RESUME 1 /* resume request */ -#define CREATE 2 /* create new process request */ -#define CREACK 3 /* create process acknowledge */ -#define KILLPR 4 /* kill process */ -#define RPCALL 5 /* remote procedure call request */ -#define RPCACK 6 /* remote procedure return */ -#define ASKPRO 7 /* ask for process prototype */ -#define PROACK 8 /* answer with process prototype */ + /* queue of disabled RPC messages */ + queue rpcwait; + + /* stack of set of enabled remote procedures */ + stack rpcmask; + + /* next allocate will forace compact */ + bool force_compactification; + + /* table of pointers to processes in process */ + word *hash; + word hash_size; +} procdescr; + + +/** + * Message type: + * \defgroup MessageType Message type + * @{ + */ + +/** error signal */ +#define ERRSIG 0 +/** resume request */ +#define RESUME 1 +/** create new process request */ +#define CREATE 2 +/** create process acknowledge */ +#define CREACK 3 +/** kill process */ +#define KILLPR 4 +/** remote procedure call request */ +#define RPCALL 5 +/** remote procedure return */ +#define RPCACK 6 +/** ask for process prototype */ +#define ASKPRO 7 +/** answer with process prototype */ +#define PROACK 8 + +/** @} */ typedef struct { - word node; - word pix; - word mark; + word node; + word pix; + word mark; } procaddr; struct ctrlmsg { - procaddr sender; /* address of the sender and */ - procaddr receiver; /* receiver of the message */ - int type; /* message type */ - int par; /* prototype or error signal number */ + /** address of the sender and */ + procaddr sender; + + /** receiver of the message */ + procaddr receiver; + + /** message type */ + int type; + + /** prototype or error signal number */ + int par; }; #define MAXPROCPAR (MSGLENGTH-sizeof(struct ctrlmsg)) typedef struct { - struct ctrlmsg control; - char params[ MAXPROCPAR ]; + struct ctrlmsg control; + char params[MAXPROCPAR]; } message; -/* Direction of copying of parameters (for moveparams()) : */ +/* Direction of copying of parameters (for moveparams()): */ #define LOADPAR 0 #define SAVEPAR 1 typedef char *mask; -extern procdescr process[]; /* process descriptor table */ -extern procdescr *thisp; /* pointer to current process descriptor */ -extern word thispix; /* current process index */ -extern queue ready; /* Round-Robin queue of ready processes */ -extern bool network; /* TRUE if operating in D-Link network */ -extern message globmsgqueue[]; /* queue of waiting messages */ -extern int msgready; /* number of waiting messages */ -extern int msghead, msgtail; /* pointers to message queue */ -extern word ournode; /* this machine node number */ -extern word console; /* console node number */ -extern bool remote; /* TRUE if remote node */ -extern bool reschedule; /* TRUE if rescheduling is mandatory */ +/** process descriptor table */ +extern procdescr process[]; + +/** pointer to current process descriptor */ +extern procdescr *thisp; + +/** current process index */ +extern word thispix; + +/** Round-Robin queue of ready processes */ +extern queue ready; + +/** TRUE if operating in D-Link network */ +extern bool network; + +/** queue of waiting messages */ +extern message globmsgqueue[]; + +/** number of waiting messages */ +extern int msgready; + +/** pointers to message queue */ +extern int msghead, msgtail; + +/** this machine node number */ +extern word ournode; + +/** console node number */ +extern word console; + +/** TRUE if remote node */ +extern bool remote; + +/** TRUE if rescheduling is mandatory */ +extern bool reschedule; #if OS2 -extern PGINFOSEG ginf; /* pointer to Global Info Segment */ +/** pointer to Global Info Segment */ +extern PGINFOSEG ginf; #endif -- 2.30.2