Making Alliance compile with GCC 4.0

* reordering of functions in Pirouz' code
* fixed bug : variable declared as extern in .h and as static in .c
* adding some missing inclusions of string.h, stdlib.h (this suppresses some nasty warnings)
* fixed gcc version detection in ocp
This commit is contained in:
Hugo Clement 2005-05-11 08:05:36 +00:00
parent 302167e710
commit 45c3691114
61 changed files with 1840 additions and 1838 deletions

View File

@ -14,6 +14,24 @@
#include "vh_ltype.h"
#include "vh_xcomm.h"
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}
/* ###--------------------------------------------------------------### */
/* function : c_fsyn_sr1k_1 */
/* description : 1K synchronous (clock's falling edge) static 1-bit */
@ -48,7 +66,6 @@ struct lkdins *pt_lkdins;
};
struct local_mem *local ;
static void init () ;
/* ###------------------------------------------------------### */
/* get the memory space reserved for the current instance */
@ -104,21 +121,3 @@ struct lkdins *pt_lkdins;
}
}
}
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}

View File

@ -14,6 +14,24 @@
#include "vh_ltype.h"
#include "vh_xcomm.h"
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}
/* ###--------------------------------------------------------------### */
/* function : c_fsyn_sr1k_10 */
/* description : 1K synchronous (clock's falling edge) static 10-bit */
@ -48,7 +66,6 @@ struct lkdins *pt_lkdins;
};
struct local_mem *local ;
static void init () ;
/* ###------------------------------------------------------### */
/* get the memory space reserved for the current instance */
@ -105,20 +122,3 @@ struct lkdins *pt_lkdins;
}
}
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}

View File

@ -14,6 +14,24 @@
#include "vh_ltype.h"
#include "vh_xcomm.h"
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}
/* ###--------------------------------------------------------------### */
/* function : c_fsyn_sr1k_24 */
/* description : 1K synchronous (clock's falling edge) static 24-bit */
@ -48,7 +66,6 @@ struct lkdins *pt_lkdins;
};
struct local_mem *local ;
static void init () ;
/* ###------------------------------------------------------### */
/* get the memory space reserved for the current instance */
@ -105,21 +122,3 @@ struct lkdins *pt_lkdins;
}
}
}
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}

View File

@ -14,6 +14,24 @@
#include "vh_ltype.h"
#include "vh_xcomm.h"
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}
/* ###--------------------------------------------------------------### */
/* function : c_fsyn_sr1k_4 */
/* description : 1K synchronous (clock's falling edge) static 4-bit */
@ -48,7 +66,6 @@ struct lkdins *pt_lkdins;
};
struct local_mem *local ;
static void init () ;
/* ###------------------------------------------------------### */
/* get the memory space reserved for the current instance */
@ -105,20 +122,3 @@ struct lkdins *pt_lkdins;
}
}
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}

View File

@ -14,6 +14,24 @@
#include "vh_ltype.h"
#include "vh_xcomm.h"
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}
/* ###--------------------------------------------------------------### */
/* function : c_fsyn_sr1k_56 */
/* description : 1K synchronous (clock's falling edge) static 56-bit */
@ -53,7 +71,6 @@ struct lkdins *pt_lkdins;
};
struct local_mem *local ;
static void init () ;
/* ###------------------------------------------------------### */
/* get the memory space reserved for the current instance */
@ -120,20 +137,3 @@ struct lkdins *pt_lkdins;
}
}
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}

View File

@ -14,6 +14,24 @@
#include "vh_ltype.h"
#include "vh_xcomm.h"
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}
/* ###--------------------------------------------------------------### */
/* function : c_fsyn_sr4k_10 */
/* description : 4K synchronous (clock's falling edge) static 10-bit */
@ -48,7 +66,6 @@ struct lkdins *pt_lkdins;
};
struct local_mem *local ;
static void init () ;
/* ###------------------------------------------------------### */
/* get the memory space reserved for the current instance */
@ -104,21 +121,3 @@ struct lkdins *pt_lkdins;
}
}
}
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}

View File

@ -14,6 +14,24 @@
#include "vh_ltype.h"
#include "vh_xcomm.h"
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}
/* ###--------------------------------------------------------------### */
/* function : c_sr1k_8a */
/* description : A 1 KByte static Ram with a chip select pin */
@ -43,7 +61,6 @@ struct lkdins *pt_lkdins;
unsigned char *mem ;
unsigned int cond = 0;
static void init () ;
/* ###------------------------------------------------------### */
/* read the current value of input signals (e_n) */
@ -90,21 +107,3 @@ struct lkdins *pt_lkdins;
vhx_writebus (dat, cond, pt_lkdins, POSO_dat, 8);
}
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}

View File

@ -30,6 +30,8 @@
/* ###--------------------------------------------------------------### */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mut.h"
#include "log.h"
#include "beh.h"
@ -37,165 +39,6 @@
#include "vh_lspec.h"
#include "vh_xspec.h"
/* ###--------------------------------------------------------------### */
/* function : c_sr1k_8b */
/* description : A 1 KByte static Ram with a chip select pin */
/* called func. : vhx_getvalu, vhx_readinput, vhx_writebus */
/* ###--------------------------------------------------------------### */
void c_sr1k_8b (pt_lkdins)
struct lkdins *pt_lkdins;
{
char e_n ; /* chip select */
char w_n ; /* write enable */
unsigned int dat ; /* input-output 8-bit data */
unsigned int adr ; /* 10-bit address */
char vdd ; /* power supply */
char vss ; /* power supply */
#define POSI_vss 0
#define POSI_vdd POSI_vss + 1
#define POSI_adr POSI_vdd + 1
#define POSI_dat POSI_adr + 10
#define POSI_w_n POSI_dat + 8
#define POSI_e_n POSI_w_n + 1
#define POSO_dat 0
unsigned char *mem ;
unsigned int cond = 0;
static void init () ;
/* ###------------------------------------------------------### */
/* read the current value of input signals (e_n) */
/* ###------------------------------------------------------### */
e_n = vhx_readinput (pt_lkdins, POSI_e_n, 1);
/* ###------------------------------------------------------### */
/* read the current value of input signals */
/* ###------------------------------------------------------### */
if (e_n == 0)
{
w_n = vhx_readinput (pt_lkdins, POSI_w_n, 1);
adr = vhx_readinput (pt_lkdins, POSI_adr, 10);
dat = vhx_readinput (pt_lkdins, POSI_dat, 8);
/* ###------------------------------------------------------### */
/* get the memory space reserved for the current instance */
/* ###------------------------------------------------------### */
vhx_getvalu (pt_lkdins, &mem, 1024, init);
/* ###------------------------------------------------------### */
/* read or write the data from the memory */
/* ###------------------------------------------------------### */
if (w_n == 0)
mem [adr] = dat;
else
dat = mem [adr];
}
/* ###------------------------------------------------------### */
/* write the result into the projected value of ouput signals */
/* ###------------------------------------------------------### */
if ((e_n == 0) && (w_n == 1))
cond = 0x000000ff;
else
cond = 0x00000000;
vhx_writebus (dat, cond, pt_lkdins, POSO_dat, 8);
}
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
#define READ_ADR 0
#define READ_VAL 1
#define ADR_MASK 0xfffff000 /* 1 k byte */
#define BYT_MASK 0x00000003 /* byte address inside a word */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
unsigned char *pt_mem ;
{
static void splitname ();
char *name ;
char fil_name [128];
unsigned int fil_addr = 0;
unsigned int fil_byte = 0;
FILE *fp ;
unsigned int cur_adr = 0;
unsigned int cur_val = 0;
unsigned int red_c = 0;
unsigned int red_val = 0;
unsigned int state = READ_ADR;
name = (char *)vhx_GetInstanceName (pt_lkdins);
splitname (name, fil_name, &fil_addr, &fil_byte);
if ((fp = mbkfopen (fil_name, "ini", READ_TEXT)) == NULL)
{
fprintf (stderr, "cannot open RAM initialization file: %s.ini\n", fil_name);
exit (1);
}
printf ("loading RAM initialization file: %s.ini , %.8x , %d\n",
fil_name, fil_addr, fil_byte);
while ((red_c = fgetc (fp)) != EOF)
{
switch (red_c)
{
case ' ' :
case '\t':
break;
case '\n':
if (((cur_adr & ADR_MASK) == fil_addr) &&
((cur_adr & BYT_MASK) == fil_byte) )
pt_mem [(cur_adr & (~ADR_MASK)) >> 2] = cur_val;
state = READ_ADR;
cur_adr = 0;
cur_val = 0;
break;
case ':' :
state = READ_VAL;
break;
default :
if ((red_c >= '0') && (red_c <= '9'))
red_val = red_c - '0';
if ((red_c >= 'a') && (red_c <= 'f'))
red_val = red_c - 'a' + 10;
if ((red_c >= 'A') && (red_c <= 'F'))
red_val = red_c - 'A' + 10;
if (state == READ_ADR)
cur_adr = (cur_adr << 4) + red_val;
else
cur_val = (cur_val << 4) + red_val;
}
}
fclose (fp);
}
/* ###--------------------------------------------------------------### */
/* function : splitname */
@ -268,3 +111,161 @@ unsigned int *byt_pnt ;
*adr_pnt = adr ;
*byt_pnt = name [i-1] - '0';
}
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
#define READ_ADR 0
#define READ_VAL 1
#define ADR_MASK 0xfffff000 /* 1 k byte */
#define BYT_MASK 0x00000003 /* byte address inside a word */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
unsigned char *pt_mem ;
{
char *name ;
char fil_name [128];
unsigned int fil_addr = 0;
unsigned int fil_byte = 0;
FILE *fp ;
unsigned int cur_adr = 0;
unsigned int cur_val = 0;
unsigned int red_c = 0;
unsigned int red_val = 0;
unsigned int state = READ_ADR;
name = (char *)vhx_GetInstanceName (pt_lkdins);
splitname (name, fil_name, &fil_addr, &fil_byte);
if ((fp = mbkfopen (fil_name, "ini", READ_TEXT)) == NULL)
{
fprintf (stderr, "cannot open RAM initialization file: %s.ini\n", fil_name);
exit (1);
}
printf ("loading RAM initialization file: %s.ini , %.8x , %d\n",
fil_name, fil_addr, fil_byte);
while ((red_c = fgetc (fp)) != EOF)
{
switch (red_c)
{
case ' ' :
case '\t':
break;
case '\n':
if (((cur_adr & ADR_MASK) == fil_addr) &&
((cur_adr & BYT_MASK) == fil_byte) )
pt_mem [(cur_adr & (~ADR_MASK)) >> 2] = cur_val;
state = READ_ADR;
cur_adr = 0;
cur_val = 0;
break;
case ':' :
state = READ_VAL;
break;
default :
if ((red_c >= '0') && (red_c <= '9'))
red_val = red_c - '0';
if ((red_c >= 'a') && (red_c <= 'f'))
red_val = red_c - 'a' + 10;
if ((red_c >= 'A') && (red_c <= 'F'))
red_val = red_c - 'A' + 10;
if (state == READ_ADR)
cur_adr = (cur_adr << 4) + red_val;
else
cur_val = (cur_val << 4) + red_val;
}
}
fclose (fp);
}
/* ###--------------------------------------------------------------### */
/* function : c_sr1k_8b */
/* description : A 1 KByte static Ram with a chip select pin */
/* called func. : vhx_getvalu, vhx_readinput, vhx_writebus */
/* ###--------------------------------------------------------------### */
void c_sr1k_8b (pt_lkdins)
struct lkdins *pt_lkdins;
{
char e_n ; /* chip select */
char w_n ; /* write enable */
unsigned int dat ; /* input-output 8-bit data */
unsigned int adr ; /* 10-bit address */
char vdd ; /* power supply */
char vss ; /* power supply */
#define POSI_vss 0
#define POSI_vdd POSI_vss + 1
#define POSI_adr POSI_vdd + 1
#define POSI_dat POSI_adr + 10
#define POSI_w_n POSI_dat + 8
#define POSI_e_n POSI_w_n + 1
#define POSO_dat 0
unsigned char *mem ;
unsigned int cond = 0;
/* ###------------------------------------------------------### */
/* read the current value of input signals (e_n) */
/* ###------------------------------------------------------### */
e_n = vhx_readinput (pt_lkdins, POSI_e_n, 1);
/* ###------------------------------------------------------### */
/* read the current value of input signals */
/* ###------------------------------------------------------### */
if (e_n == 0)
{
w_n = vhx_readinput (pt_lkdins, POSI_w_n, 1);
adr = vhx_readinput (pt_lkdins, POSI_adr, 10);
dat = vhx_readinput (pt_lkdins, POSI_dat, 8);
/* ###------------------------------------------------------### */
/* get the memory space reserved for the current instance */
/* ###------------------------------------------------------### */
vhx_getvalu (pt_lkdins, &mem, 1024, init);
/* ###------------------------------------------------------### */
/* read or write the data from the memory */
/* ###------------------------------------------------------### */
if (w_n == 0)
mem [adr] = dat;
else
dat = mem [adr];
}
/* ###------------------------------------------------------### */
/* write the result into the projected value of ouput signals */
/* ###------------------------------------------------------### */
if ((e_n == 0) && (w_n == 1))
cond = 0x000000ff;
else
cond = 0x00000000;
vhx_writebus (dat, cond, pt_lkdins, POSO_dat, 8);
}

View File

@ -14,6 +14,24 @@
#include "vh_ltype.h"
#include "vh_xcomm.h"
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}
/* ###--------------------------------------------------------------### */
/* function : c_sr8k_8a */
/* description : A 8 KByte static Ram with a chip select pin */
@ -43,7 +61,6 @@ struct lkdins *pt_lkdins;
unsigned char *mem ;
unsigned int cond = 0;
static void init () ;
/* ###------------------------------------------------------### */
/* read the current value of input signals (e_n) */
@ -90,21 +107,3 @@ struct lkdins *pt_lkdins;
vhx_writebus (dat, cond, pt_lkdins, POSO_dat, 8);
}
/* ###--------------------------------------------------------------### */
/* function : init */
/* description : initializations */
/* called func. : none */
/* ###--------------------------------------------------------------### */
static void init (pt_lkdins, pt_mem)
struct lkdins *pt_lkdins;
char *pt_mem ;
{
char *name;
name = vhx_GetInstanceName (pt_lkdins);
printf ("coucou %s\n", name);
}

View File

@ -8,6 +8,7 @@
/* ###--------------------------------------------------------------### */
#include <stdio.h>
#include <stdlib.h>
/* ###--------------------------------------------------------------### */
/* function : sch_bug */

View File

@ -12,332 +12,6 @@
#include "sch.h"
#include "sch_debug.h"
/* ###--------------------------------------------------------------### */
/* function : sch_debug */
/* description : display any structure */
/* called func. : none */
/* ###--------------------------------------------------------------### */
void sch_debug (head_pnt, type)
void *head_pnt; /* structure's pointer */
char *type; /* structure's type */
{
static int translate ();
static int splitline ();
static void disp_immd ();
static void get_size ();
static void read_field ();
static void push ();
static void pop ();
static struct chain *go_forward ();
char line [128]; /* buffer to read a cmd line */
char buffer [128]; /* buffer to split the cmd line */
char *words [ 10]; /* number of words on a line */
int nmbrs [ 10]; /* words translated into number */
char flags [ 10]; /* set if words is a number */
int indxs [ 10]; /* index of words */
struct stack jtab [ 10]; /* list of memorized addresses */
int idx, i;
int readflg = 0;
int code;
unsigned int size;
char *pntr = NULL;
long pshtype;
int wrdcnt = 1;
struct stack stk [STKSIZ_DFN];
int stkpnt = -1;
union value pnt [MAXCMD_DFN];
long typ [MAXCMD_DFN];
unsigned int siz [MAXCMD_DFN];
static char *str [] = {
"_back" , "_exit" , "_jump" , "_save" ,
"_stop" , "_top" , "_up" , "_display" ,
"character" , "short" , "integer" , "long" ,
"float" , "void" , "string" ,
"shdul" , "shent" , "shtra" , "shwav" ,
"cond" , "curtime" , "date" , "flags" ,
"ident" , "itable" , "label" , "next" ,
"prev" , "scdid" , "trans" , "ttable" ,
"uflag" , "valu" , "wave"
};
/* ###------------------------------------------------------### */
/* initialisation : */
/* - allocate a buffer for read words */
/* - break the argument that identifies the structure (type) */
/* into words */
/* - search that words among recognized strings */
/* ###------------------------------------------------------### */
words [0] = buffer;
get_size (siz);
wrdcnt = splitline (words, type);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
typ [idx] = POINTER_DFN | s_DFN | idx;
pnt [idx].dat = head_pnt;
/* ###------------------------------------------------------### */
/* process the command line until the _exit command */
/* ###------------------------------------------------------### */
while ((idx & TYPE_DFN) != _exit_DFN)
{
/* ###------------------------------------------------------### */
/* if the first word of the line has not been recognized, */
/* print an error message. Otherwise, proccess the command line */
/* (generally it is a request for displaying a specific field). */
/* */
/* At this point : */
/* - pnt [] contains all available pointers */
/* - typ [] contains the type of availabale pointers */
/* ###------------------------------------------------------### */
if (idx == _error_DFN)
sch_error (118, "sch_debug", NULL, 0);
else
{
/* ###------------------------------------------------------### */
/* define the type of the structure that may be pushed on */
/* the stack : */
/* - if the pointer is a VOID pointer the type must be */
/* defined on the command line (last word of the command) */
/* ###------------------------------------------------------### */
pshtype = POINTER_DFN | s_DFN | void_DFN;
if ((typ [idx] & TYPE_DFN) == void_DFN)
{
if ((wrdcnt >= 2) && (indxs [wrdcnt - 1] != _error_DFN))
pshtype = POINTER_DFN | s_DFN | indxs [wrdcnt - 1];
else
sch_error (119, "sch_debug", NULL, 0);
}
else
pshtype = typ [idx];
/* ###------------------------------------------------------### */
/* depending on the kind of the first word of the command */
/* activate actions : */
/* - COMMAND (_top, _up, ...) */
/* - POINTER */
/* - for NEXT go forward until the Nth element of the */
/* list. Then, push it on the stack and read fields */
/* - for others push and read fields */
/* - ARRAY */
/* - push the Nth element of the array and read its */
/* fields */
/* - ARRAY OF POINTER */
/* - push the object which address is the Nth element of */
/* the array and read its fields */
/* ###------------------------------------------------------### */
switch (typ [idx] & KIND_DFN)
{
/* ###------------------------------------------------------### */
/* COMMANDS ... */
/* ###------------------------------------------------------### */
case COMMAND_DFN :
switch (typ [idx] & TYPE_DFN)
{
/* ###------------------------------------------------------### */
/* _top COMMAND : reset the stack pointer, call read_field */
/* to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _top_DFN :
stkpnt = 0;
readflg = 1;
break;
/* ###------------------------------------------------------### */
/* _stop COMMAND : set the stop mark for the structure on */
/* the top of stack */
/* ###------------------------------------------------------### */
case _stop_DFN :
stk [stkpnt].mark = 1;
sch_message (19, "sch_debug", 0);
break;
/* ###------------------------------------------------------### */
/* _back COMMAND : pop structures from the stack until a */
/* marked structure is found. Call read_field to read the */
/* structure on the top of stack */
/* ###------------------------------------------------------### */
case _back_DFN :
while ((stkpnt != 0) && (stk[--stkpnt].mark != 1));
readflg = 1;
break;
/* ###------------------------------------------------------### */
/* _jump COMMAND : push on the stack the structure saved in */
/* the jump table. Call read_field to read the structure on the */
/* top of stack */
/* ###------------------------------------------------------### */
case _jump_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
{
push (stk, &stkpnt, jtab[nmbrs[1]].data, jtab[nmbrs[1]].type);
readflg = 1;
}
else
sch_error (118, "sch_debug", NULL, 0);
break;
/* ###------------------------------------------------------### */
/* _up COMMAND : pop structure from the stack. Call */
/* read_field to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _up_DFN :
if (wrdcnt == 1)
{
pop (&stkpnt, 1);
readflg = 1;
}
else
{
if ((wrdcnt == 2) && (flags [1] == 1))
{
pop (&stkpnt, nmbrs [1] + 1);
readflg = 1;
}
else
sch_error (118, "sch_debug", NULL, 0);
}
break;
/* ###------------------------------------------------------### */
/* _save COMMAND : save the structure on the top of stack in */
/* the jump table */
/* ###------------------------------------------------------### */
case _save_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
jtab [nmbrs[1]] = stk [stkpnt];
else
sch_error (118, "sch_debug", NULL, 0);
break;
/* ###------------------------------------------------------### */
/* _display COMMAND : display a specified field as an */
/* immediate */
/* ###------------------------------------------------------### */
case _display_DFN :
if ((wrdcnt == 3) && (indxs [1] != _error_DFN))
disp_immd (str, pnt [indxs [1]], indxs [2]);
else
sch_error (118, "sch_debug", NULL, 0);
break;
}
break;
/* ###------------------------------------------------------### */
/* POINTERS ... */
/* ###------------------------------------------------------### */
case POINTER_DFN :
if (idx == next_DFN)
{
if ((wrdcnt == 1) || ((wrdcnt == 2) && (flags [1] == 0)))
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
else
{
if (((wrdcnt == 3) || (wrdcnt == 2)) && (flags [1] == 1))
{
pnt [idx].dat = (void *) go_forward (pnt [idx].dat, nmbrs [1]);
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
else
sch_error (118, "sch_debug", NULL, 0);
}
}
else
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
break;
/* ###------------------------------------------------------### */
/* ARRAIES of structure */
/* ###------------------------------------------------------### */
case ARRAY_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = siz [(typ [idx] & TYPE_DFN)];
pntr = (void *)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
readflg = 1;
}
else
sch_error (118, "sch_debug", NULL, 0);
break;
/* ###------------------------------------------------------### */
/* ARRAIES of pointers */
/* ###------------------------------------------------------### */
case ARYOFPNT_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = sizeof (void *);
pntr = * (void **)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
readflg = 1;
}
else
sch_error (118, "sch_debug", NULL, 0);
break;
}
if (readflg == 1)
{
readflg = 0;
read_field (stk [stkpnt], pnt, typ, str);
}
}
printf ("\n\nCOMMAND > ");
gets (line);
if (strcmp (line ,"."))
{
wrdcnt = splitline (words, line);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
}
}
}
/* ###--------------------------------------------------------------### */
/* function : read_field */
@ -847,3 +521,322 @@ int type ;
sch_error (118, "sch_debug", NULL, 0);
}
}
/* ###--------------------------------------------------------------### */
/* function : sch_debug */
/* description : display any structure */
/* called func. : none */
/* ###--------------------------------------------------------------### */
void sch_debug (head_pnt, type)
void *head_pnt; /* structure's pointer */
char *type; /* structure's type */
{
char line [128]; /* buffer to read a cmd line */
char buffer [128]; /* buffer to split the cmd line */
char *words [ 10]; /* number of words on a line */
int nmbrs [ 10]; /* words translated into number */
char flags [ 10]; /* set if words is a number */
int indxs [ 10]; /* index of words */
struct stack jtab [ 10]; /* list of memorized addresses */
int idx, i;
int readflg = 0;
int code;
unsigned int size;
char *pntr = NULL;
long pshtype;
int wrdcnt = 1;
struct stack stk [STKSIZ_DFN];
int stkpnt = -1;
union value pnt [MAXCMD_DFN];
long typ [MAXCMD_DFN];
unsigned int siz [MAXCMD_DFN];
static char *str [] = {
"_back" , "_exit" , "_jump" , "_save" ,
"_stop" , "_top" , "_up" , "_display" ,
"character" , "short" , "integer" , "long" ,
"float" , "void" , "string" ,
"shdul" , "shent" , "shtra" , "shwav" ,
"cond" , "curtime" , "date" , "flags" ,
"ident" , "itable" , "label" , "next" ,
"prev" , "scdid" , "trans" , "ttable" ,
"uflag" , "valu" , "wave"
};
/* ###------------------------------------------------------### */
/* initialisation : */
/* - allocate a buffer for read words */
/* - break the argument that identifies the structure (type) */
/* into words */
/* - search that words among recognized strings */
/* ###------------------------------------------------------### */
words [0] = buffer;
get_size (siz);
wrdcnt = splitline (words, type);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
typ [idx] = POINTER_DFN | s_DFN | idx;
pnt [idx].dat = head_pnt;
/* ###------------------------------------------------------### */
/* process the command line until the _exit command */
/* ###------------------------------------------------------### */
while ((idx & TYPE_DFN) != _exit_DFN)
{
/* ###------------------------------------------------------### */
/* if the first word of the line has not been recognized, */
/* print an error message. Otherwise, proccess the command line */
/* (generally it is a request for displaying a specific field). */
/* */
/* At this point : */
/* - pnt [] contains all available pointers */
/* - typ [] contains the type of availabale pointers */
/* ###------------------------------------------------------### */
if (idx == _error_DFN)
sch_error (118, "sch_debug", NULL, 0);
else
{
/* ###------------------------------------------------------### */
/* define the type of the structure that may be pushed on */
/* the stack : */
/* - if the pointer is a VOID pointer the type must be */
/* defined on the command line (last word of the command) */
/* ###------------------------------------------------------### */
pshtype = POINTER_DFN | s_DFN | void_DFN;
if ((typ [idx] & TYPE_DFN) == void_DFN)
{
if ((wrdcnt >= 2) && (indxs [wrdcnt - 1] != _error_DFN))
pshtype = POINTER_DFN | s_DFN | indxs [wrdcnt - 1];
else
sch_error (119, "sch_debug", NULL, 0);
}
else
pshtype = typ [idx];
/* ###------------------------------------------------------### */
/* depending on the kind of the first word of the command */
/* activate actions : */
/* - COMMAND (_top, _up, ...) */
/* - POINTER */
/* - for NEXT go forward until the Nth element of the */
/* list. Then, push it on the stack and read fields */
/* - for others push and read fields */
/* - ARRAY */
/* - push the Nth element of the array and read its */
/* fields */
/* - ARRAY OF POINTER */
/* - push the object which address is the Nth element of */
/* the array and read its fields */
/* ###------------------------------------------------------### */
switch (typ [idx] & KIND_DFN)
{
/* ###------------------------------------------------------### */
/* COMMANDS ... */
/* ###------------------------------------------------------### */
case COMMAND_DFN :
switch (typ [idx] & TYPE_DFN)
{
/* ###------------------------------------------------------### */
/* _top COMMAND : reset the stack pointer, call read_field */
/* to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _top_DFN :
stkpnt = 0;
readflg = 1;
break;
/* ###------------------------------------------------------### */
/* _stop COMMAND : set the stop mark for the structure on */
/* the top of stack */
/* ###------------------------------------------------------### */
case _stop_DFN :
stk [stkpnt].mark = 1;
sch_message (19, "sch_debug", 0);
break;
/* ###------------------------------------------------------### */
/* _back COMMAND : pop structures from the stack until a */
/* marked structure is found. Call read_field to read the */
/* structure on the top of stack */
/* ###------------------------------------------------------### */
case _back_DFN :
while ((stkpnt != 0) && (stk[--stkpnt].mark != 1));
readflg = 1;
break;
/* ###------------------------------------------------------### */
/* _jump COMMAND : push on the stack the structure saved in */
/* the jump table. Call read_field to read the structure on the */
/* top of stack */
/* ###------------------------------------------------------### */
case _jump_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
{
push (stk, &stkpnt, jtab[nmbrs[1]].data, jtab[nmbrs[1]].type);
readflg = 1;
}
else
sch_error (118, "sch_debug", NULL, 0);
break;
/* ###------------------------------------------------------### */
/* _up COMMAND : pop structure from the stack. Call */
/* read_field to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _up_DFN :
if (wrdcnt == 1)
{
pop (&stkpnt, 1);
readflg = 1;
}
else
{
if ((wrdcnt == 2) && (flags [1] == 1))
{
pop (&stkpnt, nmbrs [1] + 1);
readflg = 1;
}
else
sch_error (118, "sch_debug", NULL, 0);
}
break;
/* ###------------------------------------------------------### */
/* _save COMMAND : save the structure on the top of stack in */
/* the jump table */
/* ###------------------------------------------------------### */
case _save_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
jtab [nmbrs[1]] = stk [stkpnt];
else
sch_error (118, "sch_debug", NULL, 0);
break;
/* ###------------------------------------------------------### */
/* _display COMMAND : display a specified field as an */
/* immediate */
/* ###------------------------------------------------------### */
case _display_DFN :
if ((wrdcnt == 3) && (indxs [1] != _error_DFN))
disp_immd (str, pnt [indxs [1]], indxs [2]);
else
sch_error (118, "sch_debug", NULL, 0);
break;
}
break;
/* ###------------------------------------------------------### */
/* POINTERS ... */
/* ###------------------------------------------------------### */
case POINTER_DFN :
if (idx == next_DFN)
{
if ((wrdcnt == 1) || ((wrdcnt == 2) && (flags [1] == 0)))
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
else
{
if (((wrdcnt == 3) || (wrdcnt == 2)) && (flags [1] == 1))
{
pnt [idx].dat = (void *) go_forward (pnt [idx].dat, nmbrs [1]);
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
else
sch_error (118, "sch_debug", NULL, 0);
}
}
else
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
break;
/* ###------------------------------------------------------### */
/* ARRAIES of structure */
/* ###------------------------------------------------------### */
case ARRAY_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = siz [(typ [idx] & TYPE_DFN)];
pntr = (void *)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
readflg = 1;
}
else
sch_error (118, "sch_debug", NULL, 0);
break;
/* ###------------------------------------------------------### */
/* ARRAIES of pointers */
/* ###------------------------------------------------------### */
case ARYOFPNT_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = sizeof (void *);
pntr = * (void **)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
readflg = 1;
}
else
sch_error (118, "sch_debug", NULL, 0);
break;
}
if (readflg == 1)
{
readflg = 0;
read_field (stk [stkpnt], pnt, typ, str);
}
}
printf ("\n\nCOMMAND > ");
gets (line);
if (strcmp (line ,"."))
{
wrdcnt = splitline (words, line);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
}
}
}

View File

@ -17,367 +17,6 @@
#include "vh_ltype.h"
#include "vh_debug.h"
/* ###--------------------------------------------------------------### */
/* function : dast_dbg */
/* description : display any structure */
/* called func. : vhu_error, vhu_message */
/* ###--------------------------------------------------------------### */
void dast_dbg (head_pnt, type)
void *head_pnt; /* structure's pointer */
char *type; /* structure's type */
{
static int translate ();
static int splitline ();
static void disp_immd ();
static void get_size ();
static void read_field ();
static void push ();
static void pop ();
static struct chain *go_forward ();
char line [128]; /* buffer to read a cmd line */
char buffer [128]; /* buffer to split the cmd line */
char *words [ 10]; /* number of words on a line */
int nmbrs [ 10]; /* words translated into number */
char flags [ 10]; /* set if words is a number */
int indxs [ 10]; /* index of words */
struct stack jtab [ 10]; /* list of memorized addresses */
int idx;
int readflg = 0;
unsigned int size;
char *pntr = NULL;
long pshtype;
int wrdcnt = 1;
struct stack stk [STKSIZ_DFN];
int stkpnt = -1;
union value pnt [MAXCMD_DFN];
long typ [MAXCMD_DFN];
unsigned int siz [MAXCMD_DFN];
static char *str [] = {
"_back" , "_exit" , "_jump" , "_save" ,
"_stop" , "_top" , "_up" , "_display" ,
"character" , "short" , "integer" , "long" ,
"float" , "void" , "string" ,
"chain" , "ptype" ,
"lofig" , "locon" , "losig" , "loins" ,
"befig" , "bereg" , "bemsg" , "berin" ,
"beout" , "bebus" , "beaux" , "bedly" ,
"bebux" , "bepor" , "begen" , "biabl" ,
"binode" ,
"paseq" , "pagrp" , "paiol" , "papat" ,
"pacom" , "paini" , "paevt" , "pains" ,
"bussig" , "lkdfig" , "lkdins" , "simsig" ,
"wrbsig" , "wriaux" , "wribux" , "wrireg" ,
"wrssig" , "wrimsg" ,
"shdul" , "shent" , "shtra" , "shwav" ,
"abl" , "bdd" , "gex" ,
"actflag" , "aux_ref" , "blank" , "buffer" ,
"bus_ref" , "bux_ref" , "capa" , "cndabl" ,
"cndnode" , "cndval" , "cond" , "curcom" ,
"curpat" , "curtime" , "curval" , "data" ,
"date" , "deccom" , "depend" , "direction" ,
"dly_ref" , "drvseq" , "drvval" , "endflg" ,
"errflg" , "eval" , "figname" , "filname" ,
"findex" , "flag" , "flags" , "format" ,
"glnext" , "ident" , "index" , "insname" ,
"instance" , "iolnbr" , "itable" , "label" ,
"length" , "level" , "line" , "lineno" ,
"message" , "mode" , "model" , "modelchain",
"msg_ref" , "name" , "namechain" , "next" ,
"node" , "nxtpat" , "oldcom" , "oldpat" ,
"out_ref" , "patnbr" , "position" , "prev" ,
"prjbvl" , "prjrvl" , "prjval" , "redins" ,
"redlst" , "reg_ref" , "root" , "savflg" ,
"scdid" , "sig" , "simflag" , "simval" ,
"subseq" , "text" , "time" , "time_unit" ,
"trans" , "ttable" , "type" , "uflag" ,
"user" , "usrval" , "valabl" , "valnode" ,
"valsiz" , "valu" , "value" , "wave"
};
/* ###------------------------------------------------------### */
/* initialisation : */
/* - allocate a buffer for read words */
/* - break the argument that identifies the structure (type) */
/* into words */
/* - search that words among recognized strings */
/* ###------------------------------------------------------### */
words [0] = buffer;
get_size (siz);
wrdcnt = splitline (words, type);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
typ [idx] = POINTER_DFN | s_DFN | idx;
pnt [idx].dat = head_pnt;
/* ###------------------------------------------------------### */
/* process the command line until the _exit command */
/* ###------------------------------------------------------### */
while ((idx & TYPE_DFN) != _exit_DFN)
{
/* ###------------------------------------------------------### */
/* if the first word of the line has not been recognized, */
/* print an error message. Otherwise, proccess the command line */
/* (generally it is a request for displaying a specific field). */
/* */
/* At this point : */
/* - pnt [] contains all available pointers */
/* - typ [] contains the type of availabale pointers */
/* ###------------------------------------------------------### */
if (idx == _error_DFN)
vhu_error (118, NULL, NULL, 0);
else
{
/* ###------------------------------------------------------### */
/* define the type of the structure that may be pushed on */
/* the stack : */
/* - if the pointer is a VOID pointer the exact type must be */
/* defined on the command line (last word of the command) */
/* ###------------------------------------------------------### */
pshtype = POINTER_DFN | s_DFN | void_DFN;
if ((typ [idx] & TYPE_DFN) == void_DFN)
{
if ((wrdcnt >= 2) && (indxs [wrdcnt - 1] != _error_DFN))
pshtype = POINTER_DFN | s_DFN | indxs [wrdcnt - 1];
else
vhu_error (119, NULL, NULL, 0);
}
else
pshtype = typ [idx];
/* ###------------------------------------------------------### */
/* depending on the kind of the first word of the command */
/* activate actions : */
/* - COMMAND (_top, _up, ...) */
/* - POINTER */
/* - for NEXT go forward until the Nth element of the */
/* list. Then, push it on the stack and read fields */
/* - for others push and read fields */
/* - ARRAY */
/* - push the Nth element of the array and read its */
/* fields */
/* - ARRAY OF POINTER */
/* - push the object which address is the Nth element of */
/* the array and read its fields */
/* ###------------------------------------------------------### */
switch (typ [idx] & KIND_DFN)
{
/* ###------------------------------------------------------### */
/* COMMANDS ... */
/* ###------------------------------------------------------### */
case COMMAND_DFN :
switch (typ [idx] & TYPE_DFN)
{
/* ###------------------------------------------------------### */
/* _top COMMAND : reset the stack pointer, call read_field */
/* to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _top_DFN :
stkpnt = 0;
readflg = 1;
break;
/* ###------------------------------------------------------### */
/* _stop COMMAND : set the stop mark for the structure on */
/* the top of stack */
/* ###------------------------------------------------------### */
case _stop_DFN :
stk [stkpnt].mark = 1;
vhu_message (19, "vhu_debug", 0);
break;
/* ###------------------------------------------------------### */
/* _back COMMAND : pop structures from the stack until a */
/* marked structure is found. Call read_field to read the */
/* structure on the top of stack */
/* ###------------------------------------------------------### */
case _back_DFN :
while ((stkpnt != 0) && (stk[--stkpnt].mark != 1));
readflg = 1;
break;
/* ###------------------------------------------------------### */
/* _jump COMMAND : push on the stack the structure saved in */
/* the jump table. Call read_field to read the structure on the */
/* top of stack */
/* ###------------------------------------------------------### */
case _jump_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
{
push (stk, &stkpnt, jtab[nmbrs[1]].data, jtab[nmbrs[1]].type);
readflg = 1;
}
else
vhu_error (118, NULL, NULL, 0);
break;
/* ###------------------------------------------------------### */
/* _up COMMAND : pop structure from the stack. Call */
/* read_field to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _up_DFN :
if (wrdcnt == 1)
{
pop (&stkpnt, 1);
readflg = 1;
}
else
{
if ((wrdcnt == 2) && (flags [1] == 1))
{
pop (&stkpnt, nmbrs [1] + 1);
readflg = 1;
}
else
vhu_error (118, NULL, NULL, 0);
}
break;
/* ###------------------------------------------------------### */
/* _save COMMAND : save the structure on the top of stack in */
/* the jump table */
/* ###------------------------------------------------------### */
case _save_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
jtab [nmbrs[1]] = stk [stkpnt];
else
vhu_error (118, NULL, NULL, 0);
break;
/* ###------------------------------------------------------### */
/* _display COMMAND : display a specified field as an */
/* immediate */
/* ###------------------------------------------------------### */
case _display_DFN :
if ((wrdcnt == 3) && (indxs [1] != _error_DFN))
disp_immd (str, pnt [indxs [1]], indxs [2]);
else
vhu_error (118, NULL, NULL, 0);
break;
}
break;
/* ###------------------------------------------------------### */
/* POINTERS ... */
/* ###------------------------------------------------------### */
case POINTER_DFN :
if (idx == next_DFN)
{
if ((wrdcnt == 1) || ((wrdcnt == 2) && (flags [1] == 0)))
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
else
{
if (((wrdcnt == 3) || (wrdcnt == 2)) && (flags [1] == 1))
{
pnt [idx].dat = (void *) go_forward (pnt [idx].dat, nmbrs [1]);
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
else
vhu_error (118, NULL, NULL, 0);
}
}
else
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
break;
/* ###------------------------------------------------------### */
/* ARRAIES of structure */
/* ###------------------------------------------------------### */
case ARRAY_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = siz [(typ [idx] & TYPE_DFN)];
pntr = (void *)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
readflg = 1;
}
else
vhu_error (118, NULL, NULL, 0);
break;
/* ###------------------------------------------------------### */
/* ARRAIES of pointers */
/* ###------------------------------------------------------### */
case ARYOFPNT_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = sizeof (void *);
pntr = * (void **)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
readflg = 1;
}
else
vhu_error (118, NULL, NULL, 0);
break;
}
if (readflg == 1)
{
readflg = 0;
read_field (stk [stkpnt], pnt, typ, str);
}
}
printf ("\n\nCOMMAND > ");
gets (line);
if (strcmp (line ,"."))
{
wrdcnt = splitline (words, line);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
}
}
}
/* ###--------------------------------------------------------------### */
/* function : read_field */
@ -393,13 +32,11 @@ long *typ ; /* child struct. or data type */
char **str ; /* recognized strings */
{
extern char *exprToCharInt ();
extern struct chain *bddToAbl ();
int i;
struct chain *ptr_abl;
static char *buffer = NULL;
static unsigned int buffer_size = 0;
static int buffer_size = 0;
static struct circuit *circuit_pnt = NULL;
struct chain *chain_pnt;
@ -1957,3 +1594,357 @@ int type ;
vhu_error (118, NULL, NULL, 0);
}
}
/* ###--------------------------------------------------------------### */
/* function : dast_dbg */
/* description : display any structure */
/* called func. : vhu_error, vhu_message */
/* ###--------------------------------------------------------------### */
void dast_dbg (head_pnt, type)
void *head_pnt; /* structure's pointer */
char *type; /* structure's type */
{
char line [128]; /* buffer to read a cmd line */
char buffer [128]; /* buffer to split the cmd line */
char *words [ 10]; /* number of words on a line */
int nmbrs [ 10]; /* words translated into number */
char flags [ 10]; /* set if words is a number */
int indxs [ 10]; /* index of words */
struct stack jtab [ 10]; /* list of memorized addresses */
int idx;
int readflg = 0;
unsigned int size;
char *pntr = NULL;
long pshtype;
int wrdcnt = 1;
struct stack stk [STKSIZ_DFN];
int stkpnt = -1;
union value pnt [MAXCMD_DFN];
long typ [MAXCMD_DFN];
unsigned int siz [MAXCMD_DFN];
static char *str [] = {
"_back" , "_exit" , "_jump" , "_save" ,
"_stop" , "_top" , "_up" , "_display" ,
"character" , "short" , "integer" , "long" ,
"float" , "void" , "string" ,
"chain" , "ptype" ,
"lofig" , "locon" , "losig" , "loins" ,
"befig" , "bereg" , "bemsg" , "berin" ,
"beout" , "bebus" , "beaux" , "bedly" ,
"bebux" , "bepor" , "begen" , "biabl" ,
"binode" ,
"paseq" , "pagrp" , "paiol" , "papat" ,
"pacom" , "paini" , "paevt" , "pains" ,
"bussig" , "lkdfig" , "lkdins" , "simsig" ,
"wrbsig" , "wriaux" , "wribux" , "wrireg" ,
"wrssig" , "wrimsg" ,
"shdul" , "shent" , "shtra" , "shwav" ,
"abl" , "bdd" , "gex" ,
"actflag" , "aux_ref" , "blank" , "buffer" ,
"bus_ref" , "bux_ref" , "capa" , "cndabl" ,
"cndnode" , "cndval" , "cond" , "curcom" ,
"curpat" , "curtime" , "curval" , "data" ,
"date" , "deccom" , "depend" , "direction" ,
"dly_ref" , "drvseq" , "drvval" , "endflg" ,
"errflg" , "eval" , "figname" , "filname" ,
"findex" , "flag" , "flags" , "format" ,
"glnext" , "ident" , "index" , "insname" ,
"instance" , "iolnbr" , "itable" , "label" ,
"length" , "level" , "line" , "lineno" ,
"message" , "mode" , "model" , "modelchain",
"msg_ref" , "name" , "namechain" , "next" ,
"node" , "nxtpat" , "oldcom" , "oldpat" ,
"out_ref" , "patnbr" , "position" , "prev" ,
"prjbvl" , "prjrvl" , "prjval" , "redins" ,
"redlst" , "reg_ref" , "root" , "savflg" ,
"scdid" , "sig" , "simflag" , "simval" ,
"subseq" , "text" , "time" , "time_unit" ,
"trans" , "ttable" , "type" , "uflag" ,
"user" , "usrval" , "valabl" , "valnode" ,
"valsiz" , "valu" , "value" , "wave"
};
/* ###------------------------------------------------------### */
/* initialisation : */
/* - allocate a buffer for read words */
/* - break the argument that identifies the structure (type) */
/* into words */
/* - search that words among recognized strings */
/* ###------------------------------------------------------### */
words [0] = buffer;
get_size (siz);
wrdcnt = splitline (words, type);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
typ [idx] = POINTER_DFN | s_DFN | idx;
pnt [idx].dat = head_pnt;
/* ###------------------------------------------------------### */
/* process the command line until the _exit command */
/* ###------------------------------------------------------### */
while ((idx & TYPE_DFN) != _exit_DFN)
{
/* ###------------------------------------------------------### */
/* if the first word of the line has not been recognized, */
/* print an error message. Otherwise, proccess the command line */
/* (generally it is a request for displaying a specific field). */
/* */
/* At this point : */
/* - pnt [] contains all available pointers */
/* - typ [] contains the type of availabale pointers */
/* ###------------------------------------------------------### */
if (idx == _error_DFN)
vhu_error (118, NULL, NULL, 0);
else
{
/* ###------------------------------------------------------### */
/* define the type of the structure that may be pushed on */
/* the stack : */
/* - if the pointer is a VOID pointer the exact type must be */
/* defined on the command line (last word of the command) */
/* ###------------------------------------------------------### */
pshtype = POINTER_DFN | s_DFN | void_DFN;
if ((typ [idx] & TYPE_DFN) == void_DFN)
{
if ((wrdcnt >= 2) && (indxs [wrdcnt - 1] != _error_DFN))
pshtype = POINTER_DFN | s_DFN | indxs [wrdcnt - 1];
else
vhu_error (119, NULL, NULL, 0);
}
else
pshtype = typ [idx];
/* ###------------------------------------------------------### */
/* depending on the kind of the first word of the command */
/* activate actions : */
/* - COMMAND (_top, _up, ...) */
/* - POINTER */
/* - for NEXT go forward until the Nth element of the */
/* list. Then, push it on the stack and read fields */
/* - for others push and read fields */
/* - ARRAY */
/* - push the Nth element of the array and read its */
/* fields */
/* - ARRAY OF POINTER */
/* - push the object which address is the Nth element of */
/* the array and read its fields */
/* ###------------------------------------------------------### */
switch (typ [idx] & KIND_DFN)
{
/* ###------------------------------------------------------### */
/* COMMANDS ... */
/* ###------------------------------------------------------### */
case COMMAND_DFN :
switch (typ [idx] & TYPE_DFN)
{
/* ###------------------------------------------------------### */
/* _top COMMAND : reset the stack pointer, call read_field */
/* to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _top_DFN :
stkpnt = 0;
readflg = 1;
break;
/* ###------------------------------------------------------### */
/* _stop COMMAND : set the stop mark for the structure on */
/* the top of stack */
/* ###------------------------------------------------------### */
case _stop_DFN :
stk [stkpnt].mark = 1;
vhu_message (19, "vhu_debug", 0);
break;
/* ###------------------------------------------------------### */
/* _back COMMAND : pop structures from the stack until a */
/* marked structure is found. Call read_field to read the */
/* structure on the top of stack */
/* ###------------------------------------------------------### */
case _back_DFN :
while ((stkpnt != 0) && (stk[--stkpnt].mark != 1));
readflg = 1;
break;
/* ###------------------------------------------------------### */
/* _jump COMMAND : push on the stack the structure saved in */
/* the jump table. Call read_field to read the structure on the */
/* top of stack */
/* ###------------------------------------------------------### */
case _jump_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
{
push (stk, &stkpnt, jtab[nmbrs[1]].data, jtab[nmbrs[1]].type);
readflg = 1;
}
else
vhu_error (118, NULL, NULL, 0);
break;
/* ###------------------------------------------------------### */
/* _up COMMAND : pop structure from the stack. Call */
/* read_field to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _up_DFN :
if (wrdcnt == 1)
{
pop (&stkpnt, 1);
readflg = 1;
}
else
{
if ((wrdcnt == 2) && (flags [1] == 1))
{
pop (&stkpnt, nmbrs [1] + 1);
readflg = 1;
}
else
vhu_error (118, NULL, NULL, 0);
}
break;
/* ###------------------------------------------------------### */
/* _save COMMAND : save the structure on the top of stack in */
/* the jump table */
/* ###------------------------------------------------------### */
case _save_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
jtab [nmbrs[1]] = stk [stkpnt];
else
vhu_error (118, NULL, NULL, 0);
break;
/* ###------------------------------------------------------### */
/* _display COMMAND : display a specified field as an */
/* immediate */
/* ###------------------------------------------------------### */
case _display_DFN :
if ((wrdcnt == 3) && (indxs [1] != _error_DFN))
disp_immd (str, pnt [indxs [1]], indxs [2]);
else
vhu_error (118, NULL, NULL, 0);
break;
}
break;
/* ###------------------------------------------------------### */
/* POINTERS ... */
/* ###------------------------------------------------------### */
case POINTER_DFN :
if (idx == next_DFN)
{
if ((wrdcnt == 1) || ((wrdcnt == 2) && (flags [1] == 0)))
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
else
{
if (((wrdcnt == 3) || (wrdcnt == 2)) && (flags [1] == 1))
{
pnt [idx].dat = (void *) go_forward (pnt [idx].dat, nmbrs [1]);
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
else
vhu_error (118, NULL, NULL, 0);
}
}
else
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
break;
/* ###------------------------------------------------------### */
/* ARRAIES of structure */
/* ###------------------------------------------------------### */
case ARRAY_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = siz [(typ [idx] & TYPE_DFN)];
pntr = (void *)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
readflg = 1;
}
else
vhu_error (118, NULL, NULL, 0);
break;
/* ###------------------------------------------------------### */
/* ARRAIES of pointers */
/* ###------------------------------------------------------### */
case ARYOFPNT_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = sizeof (void *);
pntr = * (void **)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
readflg = 1;
}
else
vhu_error (118, NULL, NULL, 0);
break;
}
if (readflg == 1)
{
readflg = 0;
read_field (stk [stkpnt], pnt, typ, str);
}
}
printf ("\n\nCOMMAND > ");
gets (line);
if (strcmp (line ,"."))
{
wrdcnt = splitline (words, line);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
}
}
}

View File

@ -10,6 +10,8 @@
/* ###--------------------------------------------------------------### */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mut.h"
#include "vh_util.h"

View File

@ -18,6 +18,7 @@
/* ###--------------------------------------------------------------### */
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "mut.h"
#include "beh.h"

View File

@ -11,6 +11,7 @@
/* ###--------------------------------------------------------------### */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "mut.h"
#include "beh.h"

View File

@ -30,6 +30,7 @@
/* ###--------------------------------------------------------------### */
#include <stdio.h>
#include <string.h>
#include "mut.h"
#include "log.h"
#include "beh.h"

View File

@ -39,317 +39,6 @@ static char *buffer = NULL;
static unsigned int buff_size = 0;
static struct circuit *circuit_pnt = NULL;
/* ###--------------------------------------------------------------### */
/* function : beh_debug */
/* description : dispaly any mad structure */
/* called func. : goforward, translate, dispaly, splitline, pop, push */
/* ###--------------------------------------------------------------### */
void beh_debug (head_pnt, type)
void *head_pnt; /* structure's pointer */
char *type; /* structure's type */
{
static void disp_immd ();
static void getsize ();
static void display ();
static void push ();
static void pop ();
static struct chain *goforward ();
static int splitline ();
static int translate ();
char line [128]; /* buffer to read a cmd line */
char heap [128]; /* buffer to split the cmd line */
char *words [ 10]; /* number of words on a line */
int nmbrs [ 10]; /* words translated into number */
char flags [ 10]; /* set if words is a number */
int indxs [ 10]; /* index of words */
struct stack jtab [ 10]; /* list of memorized addresses */
int idx, i;
int dispflg = 0;
int code;
unsigned int size;
char *pntr = NULL;
long pshtype;
int wrdcnt = 1;
struct stack stk [STKSIZ_DFN];
int stkpnt = -1;
union value pnt [MAXCMD_DFN];
long typ [MAXCMD_DFN];
unsigned int siz [MAXCMD_DFN];
static char *str [] = {
"_back" , "_exit" , "_jump" , "_save" ,
"_stop" , "_top" , "_up" , "_display" ,
"character", "short" , "integer" , "long" ,
"void" , "string" ,
"chain" , "ptype" , "befig" , "bereg" ,
"bemsg" , "berin" , "beout" , "bebus" ,
"beaux" , "bedly" , "bebux" , "bepor" ,
"begen" , "biabl" , "binode" , "bequad" ,
"beder" ,
"next" , "name" , "user" , "errflg" ,
"type" , "level" , "label" , "message" ,
"abl" , "node" , "direction", "cndabl" ,
"valabl" , "cndnode" , "valnode" , "out_ref" ,
"bus_ref" , "aux_ref" , "reg_ref" , "bux_ref" ,
"msg_ref" , "dly_ref" , "value" , "data" ,
"time" , "bdd" , "gex" , "varlist" ,
"derivate" , "index" , "flag" , "time_unit",
"time_step"
};
/* ###------------------------------------------------------### */
/* initialisation : */
/* - allocate a buffer for read words */
/* - break the argument that identifies the structure (type) */
/* into words */
/* - search that words among recognized strings */
/* ###------------------------------------------------------### */
words [0] = heap;
getsize (siz);
wrdcnt = splitline (words, type);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
typ [idx] = POINTER_DFN | s_DFN | idx;
pnt [idx].dat = head_pnt;
/* ###------------------------------------------------------### */
/* process the command line until the _exit command */
/* ###------------------------------------------------------### */
while ((idx & TYPE_DFN) != _exit_DFN)
{
/* ###------------------------------------------------------### */
/* if the first word of the line has not been recognized, */
/* print an error message. Otherwise, proccess the command line */
/* (generally it is a request for displaying a specific field). */
/* */
/* At this point : */
/* - pnt [] contains all available pointers */
/* - typ [] contains the type of availabale pointers */
/* ###------------------------------------------------------### */
if (idx == _error_DFN)
fprintf (stderr ,"unrecognized command\n");
else
{
/* ###------------------------------------------------------### */
/* define the type of the structure that may be pushed on */
/* the stack : */
/* - if the pointer is a VOID pointer the exact type must be */
/* defined on the command line (last word of the command) */
/* ###------------------------------------------------------### */
pshtype = POINTER_DFN | s_DFN | void_DFN;
if ((typ [idx] & TYPE_DFN) == void_DFN)
{
if ((wrdcnt >= 2) && (indxs [wrdcnt - 1] != _error_DFN))
pshtype = POINTER_DFN | s_DFN | indxs [wrdcnt - 1];
else
fprintf (stderr ,"structure has unknown type (void *)\n");
}
else
pshtype = typ [idx];
/* ###------------------------------------------------------### */
/* depending on the kind of the first word of the command */
/* activate actions : */
/* - COMMAND (_top, _up, ...) */
/* - POINTER */
/* - for NEXT go forward until the Nth element of the */
/* list. Then, push it on the stack and dispaly it */
/* - for others push and display */
/* - ARRAY */
/* - push and display the Nth element of the array */
/* ###------------------------------------------------------### */
switch (typ [idx] & KIND_DFN)
{
case COMMAND_DFN :
switch (typ [idx] & TYPE_DFN)
{
/* ###------------------------------------------------------### */
/* _top COMMAND : reset the stack pointer, call read_field */
/* to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _top_DFN :
stkpnt = 0;
dispflg = 1;
break;
/* ###------------------------------------------------------### */
/* _stop COMMAND : set the stop mark for the structure on */
/* the top of stack */
/* ###------------------------------------------------------### */
case _stop_DFN :
stk [stkpnt].mark = 1;
fprintf (stdout, "beh_debug : stop mark set\n");
break;
/* ###------------------------------------------------------### */
/* _back COMMAND : pop structures from the stack until a */
/* marked structure is found. Call read_field to read the */
/* structure on the top of stack */
/* ###------------------------------------------------------### */
case _back_DFN :
while ((stkpnt != 0) && (stk[--stkpnt].mark != 1));
dispflg = 1;
break;
/* ###------------------------------------------------------### */
/* _jump COMMAND : push on the stack the structure saved in */
/* the jump table. Call read_field to read the structure on the */
/* top of stack */
/* ###------------------------------------------------------### */
case _jump_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
{
push (stk, &stkpnt, jtab[nmbrs[1]].data, jtab[nmbrs[1]].type);
dispflg = 1;
}
else
fprintf (stderr ,"unrecognized command\n");
break;
/* ###------------------------------------------------------### */
/* _up COMMAND : pop structure from the stack. Call */
/* read_field to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _up_DFN :
if (wrdcnt == 1)
{
pop (&stkpnt, 1);
dispflg = 1;
}
else
{
if ((wrdcnt == 2) && (flags [1] == 1))
{
pop (&stkpnt, nmbrs [1] + 1);
dispflg = 1;
}
else
fprintf (stderr ,"unrecognized command\n");
}
break;
/* ###------------------------------------------------------### */
/* _save COMMAND : save the structure on the top of stack in */
/* the jump table */
/* ###------------------------------------------------------### */
case _save_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
jtab [nmbrs[1]] = stk [stkpnt];
else
fprintf (stderr ,"unrecognized command\n");
break;
/* ###------------------------------------------------------### */
/* _display COMMAND : display a specified field as an */
/* immediate */
/* ###------------------------------------------------------### */
case _display_DFN :
if ((wrdcnt == 3) && (indxs [1] != _error_DFN))
disp_immd (str, pnt [indxs [1]], indxs [2]);
else
fprintf (stderr ,"unrecognized command\n");
break;
}
break;
case POINTER_DFN :
if (idx == next_DFN)
{
if ((wrdcnt == 1) || ((wrdcnt == 2) && (flags [1] == 0)))
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
dispflg = 1;
}
else
{
if (((wrdcnt == 3) || (wrdcnt == 2)) && (flags [1] == 1))
{
pnt [idx].dat = (void *) goforward (pnt [idx].dat, nmbrs [1]);
push (stk, &stkpnt, pnt [idx].dat, pshtype);
dispflg = 1;
}
else
fprintf (stderr ,"unrecognized command\n");
}
}
else
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
dispflg = 1;
}
break;
case ARRAY_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = siz [(typ [idx] & TYPE_DFN)];
pntr = (void *)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
dispflg = 1;
}
else
fprintf (stderr ,"unrecognized command\n");
break;
case ARYOFPNT_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = sizeof (void *);
pntr = * (void **)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
dispflg = 1;
}
else
fprintf (stderr ,"unrecognized command\n");
break;
}
if (dispflg == 1)
{
dispflg = 0;
display (stk [stkpnt], pnt, typ, str);
}
}
printf ("\n\nCOMMAND > ");
gets (line);
if (strcmp (line ,"."))
{
wrdcnt = splitline (words, line);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
}
}
}
/* ###--------------------------------------------------------------### */
/* function : display */
@ -365,8 +54,6 @@ long *typ; /* child struct. or data type */
char **str; /* recognized strings */
{
extern char *exprToCharInt ();
extern struct chain *bddToAbl ();
int i;
struct chain *ptr_abl;
@ -1174,7 +861,6 @@ union value pnt ;
int type ;
{
extern char *exprToCharInt ();
char *lcl_str ;
struct chain *ptr_abl ;
@ -1227,3 +913,307 @@ int type ;
fprintf (stderr ,"unrecognized command\n");
}
}
/* ###--------------------------------------------------------------### */
/* function : beh_debug */
/* description : dispaly any mad structure */
/* called func. : goforward, translate, dispaly, splitline, pop, push */
/* ###--------------------------------------------------------------### */
void beh_debug (head_pnt, type)
void *head_pnt; /* structure's pointer */
char *type; /* structure's type */
{
char line [128]; /* buffer to read a cmd line */
char heap [128]; /* buffer to split the cmd line */
char *words [ 10]; /* number of words on a line */
int nmbrs [ 10]; /* words translated into number */
char flags [ 10]; /* set if words is a number */
int indxs [ 10]; /* index of words */
struct stack jtab [ 10]; /* list of memorized addresses */
int idx, i;
int dispflg = 0;
int code;
unsigned int size;
char *pntr = NULL;
long pshtype;
int wrdcnt = 1;
struct stack stk [STKSIZ_DFN];
int stkpnt = -1;
union value pnt [MAXCMD_DFN];
long typ [MAXCMD_DFN];
unsigned int siz [MAXCMD_DFN];
static char *str [] = {
"_back" , "_exit" , "_jump" , "_save" ,
"_stop" , "_top" , "_up" , "_display" ,
"character", "short" , "integer" , "long" ,
"void" , "string" ,
"chain" , "ptype" , "befig" , "bereg" ,
"bemsg" , "berin" , "beout" , "bebus" ,
"beaux" , "bedly" , "bebux" , "bepor" ,
"begen" , "biabl" , "binode" , "bequad" ,
"beder" ,
"next" , "name" , "user" , "errflg" ,
"type" , "level" , "label" , "message" ,
"abl" , "node" , "direction", "cndabl" ,
"valabl" , "cndnode" , "valnode" , "out_ref" ,
"bus_ref" , "aux_ref" , "reg_ref" , "bux_ref" ,
"msg_ref" , "dly_ref" , "value" , "data" ,
"time" , "bdd" , "gex" , "varlist" ,
"derivate" , "index" , "flag" , "time_unit",
"time_step"
};
/* ###------------------------------------------------------### */
/* initialisation : */
/* - allocate a buffer for read words */
/* - break the argument that identifies the structure (type) */
/* into words */
/* - search that words among recognized strings */
/* ###------------------------------------------------------### */
words [0] = heap;
getsize (siz);
wrdcnt = splitline (words, type);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
typ [idx] = POINTER_DFN | s_DFN | idx;
pnt [idx].dat = head_pnt;
/* ###------------------------------------------------------### */
/* process the command line until the _exit command */
/* ###------------------------------------------------------### */
while ((idx & TYPE_DFN) != _exit_DFN)
{
/* ###------------------------------------------------------### */
/* if the first word of the line has not been recognized, */
/* print an error message. Otherwise, proccess the command line */
/* (generally it is a request for displaying a specific field). */
/* */
/* At this point : */
/* - pnt [] contains all available pointers */
/* - typ [] contains the type of availabale pointers */
/* ###------------------------------------------------------### */
if (idx == _error_DFN)
fprintf (stderr ,"unrecognized command\n");
else
{
/* ###------------------------------------------------------### */
/* define the type of the structure that may be pushed on */
/* the stack : */
/* - if the pointer is a VOID pointer the exact type must be */
/* defined on the command line (last word of the command) */
/* ###------------------------------------------------------### */
pshtype = POINTER_DFN | s_DFN | void_DFN;
if ((typ [idx] & TYPE_DFN) == void_DFN)
{
if ((wrdcnt >= 2) && (indxs [wrdcnt - 1] != _error_DFN))
pshtype = POINTER_DFN | s_DFN | indxs [wrdcnt - 1];
else
fprintf (stderr ,"structure has unknown type (void *)\n");
}
else
pshtype = typ [idx];
/* ###------------------------------------------------------### */
/* depending on the kind of the first word of the command */
/* activate actions : */
/* - COMMAND (_top, _up, ...) */
/* - POINTER */
/* - for NEXT go forward until the Nth element of the */
/* list. Then, push it on the stack and dispaly it */
/* - for others push and display */
/* - ARRAY */
/* - push and display the Nth element of the array */
/* ###------------------------------------------------------### */
switch (typ [idx] & KIND_DFN)
{
case COMMAND_DFN :
switch (typ [idx] & TYPE_DFN)
{
/* ###------------------------------------------------------### */
/* _top COMMAND : reset the stack pointer, call read_field */
/* to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _top_DFN :
stkpnt = 0;
dispflg = 1;
break;
/* ###------------------------------------------------------### */
/* _stop COMMAND : set the stop mark for the structure on */
/* the top of stack */
/* ###------------------------------------------------------### */
case _stop_DFN :
stk [stkpnt].mark = 1;
fprintf (stdout, "beh_debug : stop mark set\n");
break;
/* ###------------------------------------------------------### */
/* _back COMMAND : pop structures from the stack until a */
/* marked structure is found. Call read_field to read the */
/* structure on the top of stack */
/* ###------------------------------------------------------### */
case _back_DFN :
while ((stkpnt != 0) && (stk[--stkpnt].mark != 1));
dispflg = 1;
break;
/* ###------------------------------------------------------### */
/* _jump COMMAND : push on the stack the structure saved in */
/* the jump table. Call read_field to read the structure on the */
/* top of stack */
/* ###------------------------------------------------------### */
case _jump_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
{
push (stk, &stkpnt, jtab[nmbrs[1]].data, jtab[nmbrs[1]].type);
dispflg = 1;
}
else
fprintf (stderr ,"unrecognized command\n");
break;
/* ###------------------------------------------------------### */
/* _up COMMAND : pop structure from the stack. Call */
/* read_field to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _up_DFN :
if (wrdcnt == 1)
{
pop (&stkpnt, 1);
dispflg = 1;
}
else
{
if ((wrdcnt == 2) && (flags [1] == 1))
{
pop (&stkpnt, nmbrs [1] + 1);
dispflg = 1;
}
else
fprintf (stderr ,"unrecognized command\n");
}
break;
/* ###------------------------------------------------------### */
/* _save COMMAND : save the structure on the top of stack in */
/* the jump table */
/* ###------------------------------------------------------### */
case _save_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
jtab [nmbrs[1]] = stk [stkpnt];
else
fprintf (stderr ,"unrecognized command\n");
break;
/* ###------------------------------------------------------### */
/* _display COMMAND : display a specified field as an */
/* immediate */
/* ###------------------------------------------------------### */
case _display_DFN :
if ((wrdcnt == 3) && (indxs [1] != _error_DFN))
disp_immd (str, pnt [indxs [1]], indxs [2]);
else
fprintf (stderr ,"unrecognized command\n");
break;
}
break;
case POINTER_DFN :
if (idx == next_DFN)
{
if ((wrdcnt == 1) || ((wrdcnt == 2) && (flags [1] == 0)))
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
dispflg = 1;
}
else
{
if (((wrdcnt == 3) || (wrdcnt == 2)) && (flags [1] == 1))
{
pnt [idx].dat = (void *) goforward (pnt [idx].dat, nmbrs [1]);
push (stk, &stkpnt, pnt [idx].dat, pshtype);
dispflg = 1;
}
else
fprintf (stderr ,"unrecognized command\n");
}
}
else
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
dispflg = 1;
}
break;
case ARRAY_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = siz [(typ [idx] & TYPE_DFN)];
pntr = (void *)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
dispflg = 1;
}
else
fprintf (stderr ,"unrecognized command\n");
break;
case ARYOFPNT_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = sizeof (void *);
pntr = * (void **)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
dispflg = 1;
}
else
fprintf (stderr ,"unrecognized command\n");
break;
}
if (dispflg == 1)
{
dispflg = 0;
display (stk [stkpnt], pnt, typ, str);
}
}
printf ("\n\nCOMMAND > ");
gets (line);
if (strcmp (line ,"."))
{
wrdcnt = splitline (words, line);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
}
}
}

View File

@ -28,6 +28,7 @@
*/
#include <stdlib.h>
#include <mut.h>
#include <mlo.h>
#include <abl.h>

View File

@ -27,7 +27,7 @@
* Author : Francois Donnet
*/
#include <stdlib.h>
#include <mut.h>
#include <abl.h>
#include <aut.h>

View File

@ -28,7 +28,7 @@
*/
#include <stdlib.h>
#include <mut.h>
#include <abl.h>
#include <abe.h>

View File

@ -28,6 +28,7 @@
*/
#include <stdlib.h>
#include <mut.h>
#include <mlo.h>
#include <abl.h>

View File

@ -28,7 +28,7 @@
*/
#include <stdlib.h>
#include <mut.h>
#include <mlo.h>
#include <abl.h>

View File

@ -27,7 +27,7 @@
*/
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>

View File

@ -27,7 +27,7 @@
* Author : Francois Donnet
*/
#include <stdlib.h>
#include <mut.h>
#include <mlo.h>
#include <abl.h>

View File

@ -37,6 +37,7 @@
# endif
#endif
#include <stdlib.h>
#include <mut.h>
#include <abl.h>
#include <abe.h>

View File

@ -27,7 +27,7 @@
* Author : Francois Donnet
*/
#include <stdlib.h>
#include <mut.h>
#include <mlo.h>
#include <abl.h>

View File

@ -29,6 +29,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <mut.h>
#include <abl.h>
#include <abe.h>

View File

@ -29,6 +29,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <mut.h>
#include <abl.h>
#include <abe.h>

View File

@ -29,7 +29,7 @@
#include <stdlib.h>
#include <mut.h>
#include <mlo.h>
#include <abl.h>

View File

@ -27,7 +27,7 @@
* Author : Francois Donnet
*/
#include <stdlib.h>
#include <mut.h>
#include <mlo.h>
#include <abl.h>

View File

@ -28,6 +28,7 @@
*/
#include <stdlib.h>
#include <mut.h>
#include <mlo.h>
#include <abl.h>

View File

@ -30,6 +30,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <mut.h>
#include <mlo.h>
#include <abl.h>

View File

@ -29,7 +29,7 @@
#include <stdlib.h>
#include <mut.h>
#include <mlo.h>
#include <abl.h>

View File

@ -28,7 +28,7 @@
*/
#include <stdlib.h>
#include <mut.h>
#include <mlo.h>
#include <abl.h>

View File

@ -37,6 +37,7 @@
# endif
#endif
#include <stdlib.h>
#include <mut.h>
#include <mlo.h>
#include <abl.h>

View File

@ -6,104 +6,6 @@
#include "bvl.h"
#include "bvl_bcomp_y.h"
%}
upper_case_letter [A-Z]
digit [0-9]
special_character [\#\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\_\|]
space_character [ \t]
format_effector [\t\v\r\l\f]
end_of_line \n
lower_case_letter [a-z]
other_special_character [\!\$\@\?\[\\\]\^\`\{\}\~]
graphic_character ({basic_graphic_character}|{lower_case_letter}|{other_special_character})
basic_graphic_character ({upper_case_letter}|{digit}|{special_character}|{space_character})
letter ({upper_case_letter}|{lower_case_letter})
letter_or_digit ({letter}|{digit})
decimal_literal {integer}(\.{integer})?({exponent})?
integer {digit}(_?{digit})*
exponent ([eE][-+]?{integer})
base {integer}
based_integer {extended_digit}(_?{extended_digit})*
extended_digit ({digit}|[a-fA-F])
base_specifier (B|b|O|o|X|x)
%%
[ \t] ;
\n { BEH_LINNUM++; }
\& { return (Ampersand ); }
\' { return (Apostrophe); }
\( { return (LeftParen ); }
\) { return (RightParen); }
"**" { return (DoubleStar); }
\* { return (Star ); }
\+ { return (Plus ); }
\, { return (Comma ); }
\- { return (Minus ); }
":=" { return (VarAsgn ); }
\: { return (Colon ); }
\; { return (Semicolon ); }
"<=" { return (_LESym ); }
">=" { return (_GESym ); }
\< { return (_LTSym ); }
\> { return (_GTSym ); }
= { return (_EQSym ); }
\/= { return (_NESym ); }
"=>" { return (Arrow ); }
"<>" { return (Box ); }
\| { return (Bar ); }
! { return (Bar ); }
\. { return (Dot ); }
\/ { return (Slash ); }
{letter}(_?{letter_or_digit})* {
int itoken;
static int search ();
itoken = search (yytext);
if (itoken == EMPTYHT)
{
yylval.text = namealloc (yytext);
return (Identifier);
}
else
{
return (itoken);
}
}
({decimal_literal})|({base}#{based_integer}(\.{based_integer})?#({exponent})?)|({base}:{based_integer}(\.{based_integer})?:({exponent})?) {
yylval.text = mbkalloc ((unsigned int)strlen(yytext)+1);
strcpy (yylval.text, yytext);
return (AbstractLit);
}
'({graphic_character}|\"|\%)' {
yylval.text = namealloc (yytext);
return (CharacterLit);
}
(\"({graphic_character}|(\"\")|\%)*\")|(\%({graphic_character}|(\%\%)|\")*\%) {
yylval.text = namealloc (yytext);
return (StringLit);
}
{base_specifier}((\"{extended_digit}(_?{extended_digit})*\")|(\%{extended_digit}(_?{extended_digit})*\%)) {
yylval.text = namealloc (yytext);
return (BitStringLit);
}
\-\-.*$ ;
. { return (*yytext); }
%%
/* ###--------------------------------------------------------------### */
/* function : yywrap */
/* description : return 1 */
/* called func. : none */
/* ###--------------------------------------------------------------### */
int yywrap ()
{
return (1);
}
/* ###--------------------------------------------------------------### */
/* function : search */
@ -243,3 +145,102 @@ char *key;
return (gethtitem (pt_hash, namealloc(key)));
}
%}
upper_case_letter [A-Z]
digit [0-9]
special_character [\#\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\_\|]
space_character [ \t]
format_effector [\t\v\r\l\f]
end_of_line \n
lower_case_letter [a-z]
other_special_character [\!\$\@\?\[\\\]\^\`\{\}\~]
graphic_character ({basic_graphic_character}|{lower_case_letter}|{other_special_character})
basic_graphic_character ({upper_case_letter}|{digit}|{special_character}|{space_character})
letter ({upper_case_letter}|{lower_case_letter})
letter_or_digit ({letter}|{digit})
decimal_literal {integer}(\.{integer})?({exponent})?
integer {digit}(_?{digit})*
exponent ([eE][-+]?{integer})
base {integer}
based_integer {extended_digit}(_?{extended_digit})*
extended_digit ({digit}|[a-fA-F])
base_specifier (B|b|O|o|X|x)
%%
[ \t] ;
\n { BEH_LINNUM++; }
\& { return (Ampersand ); }
\' { return (Apostrophe); }
\( { return (LeftParen ); }
\) { return (RightParen); }
"**" { return (DoubleStar); }
\* { return (Star ); }
\+ { return (Plus ); }
\, { return (Comma ); }
\- { return (Minus ); }
":=" { return (VarAsgn ); }
\: { return (Colon ); }
\; { return (Semicolon ); }
"<=" { return (_LESym ); }
">=" { return (_GESym ); }
\< { return (_LTSym ); }
\> { return (_GTSym ); }
= { return (_EQSym ); }
\/= { return (_NESym ); }
"=>" { return (Arrow ); }
"<>" { return (Box ); }
\| { return (Bar ); }
! { return (Bar ); }
\. { return (Dot ); }
\/ { return (Slash ); }
{letter}(_?{letter_or_digit})* {
int itoken;
itoken = search (yytext);
if (itoken == EMPTYHT)
{
yylval.text = namealloc (yytext);
return (Identifier);
}
else
{
return (itoken);
}
}
({decimal_literal})|({base}#{based_integer}(\.{based_integer})?#({exponent})?)|({base}:{based_integer}(\.{based_integer})?:({exponent})?) {
yylval.text = mbkalloc ((unsigned int)strlen(yytext)+1);
strcpy (yylval.text, yytext);
return (AbstractLit);
}
'({graphic_character}|\"|\%)' {
yylval.text = namealloc (yytext);
return (CharacterLit);
}
(\"({graphic_character}|(\"\")|\%)*\")|(\%({graphic_character}|(\%\%)|\")*\%) {
yylval.text = namealloc (yytext);
return (StringLit);
}
{base_specifier}((\"{extended_digit}(_?{extended_digit})*\")|(\%{extended_digit}(_?{extended_digit})*\%)) {
yylval.text = namealloc (yytext);
return (BitStringLit);
}
\-\-.*$ ;
. { return (*yytext); }
%%
/* ###--------------------------------------------------------------### */
/* function : yywrap */
/* description : return 1 */
/* called func. : none */
/* ###--------------------------------------------------------------### */
int yywrap ()
{
return (1);
}

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.8.3 from Makefile.am.
# Makefile.in generated by automake 1.8.5 from Makefile.am.
# elp/src/Makefile. Generated from Makefile.in by configure.
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@ -37,7 +37,7 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = i686-redhat-linux-gnu
host_triplet = i686-pc-linux-gnu
subdir = elp/src
DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in elp_l.c elp_y.c
@ -90,9 +90,9 @@ ALCBANNER_MINOR_VERSION = 1
ALCBANNER_VERSION = 1.1
ALLIANCE_BUILD_FALSE = #
ALLIANCE_BUILD_TRUE =
ALLIANCE_CFLAGS = -I/dsk/l1/misc/hcl/altest/include
ALLIANCE_LIBS = -L/dsk/l1/misc/hcl/altest/lib
ALLIANCE_TOP = /dsk/l1/misc/hcl/altest
ALLIANCE_CFLAGS = -I/users/outil/alliance/Linux.FC2/include
ALLIANCE_LIBS = -L/users/outil/alliance/Linux.FC2/lib
ALLIANCE_TOP = /users/outil/alliance/Linux.FC2
AMDEP_FALSE = #
AMDEP_TRUE =
AMTAR = ${SHELL} /dsk/l1/misc/hcl/alliance/src/missing --run tar
@ -121,9 +121,9 @@ BTR_DLL_VERSION = 1:3:0
BVL_DLL_VERSION = 1:14:0
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -I/dsk/l1/misc/hcl/altest/include -g -O2
CFLAGS = -I/users/outil/alliance/Linux.FC2/include -g -O2
CPP = gcc -E
CPPFLAGS = -I/dsk/l1/misc/hcl/albuild/dsk/l1/misc/hcl/altest/include
CPPFLAGS =
CST_DLL_VERSION = 3:2:0
CTL_DLL_VERSION = 1:1:0
CTP_DLL_VERSION = 1:1:0
@ -132,7 +132,7 @@ CXXCPP = g++ -E
CXXDEPMODE = depmode=gcc3
CXXFLAGS = -g -O2
CYGPATH_W = echo
DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"alliance\" -DVERSION=\"5.0\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FCNTL_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRINGS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBIBERTY=1 -DHAVE_LIBM=1 -DHAVE_LIBM=1 -DHAVE_LIBM=1 -DHAVE_LIBM=1 -DHAVE_UNISTD_H=1 -DHAVE_FORK=1 -DHAVE_VFORK=1 -DHAVE_WORKING_VFORK=1 -DHAVE_WORKING_FORK=1 -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DRETSIGTYPE=void -DHAVE_MOTIF=1 -DHAVE_XPM=1 -DHAVE_XPM=1 -DHAVE_X11_XPM_H=1 -DHAVE_XP=1 -DHAVE_MOTIF=1 -DHAVE_XMUSEVERSION=1 -DHAVE_XMINSTALLIMAGE=1 -DALLIANCE_VERSION=\"5.0\" -DALLIANCE_TOP=\"/dsk/l1/misc/hcl/altest\" -DHAVE_LIBIBERTY=1
DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"alliance\" -DVERSION=\"5.0\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FCNTL_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRINGS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBIBERTY=1 -DHAVE_LIBM=1 -DHAVE_LIBM=1 -DHAVE_LIBM=1 -DHAVE_LIBM=1 -DHAVE_UNISTD_H=1 -DHAVE_FORK=1 -DHAVE_VFORK=1 -DHAVE_WORKING_VFORK=1 -DHAVE_WORKING_FORK=1 -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DRETSIGTYPE=void -DHAVE_MOTIF=1 -DHAVE_XPM=1 -DHAVE_XPM=1 -DHAVE_X11_XPM_H=1 -DHAVE_XP=1 -DHAVE_MOTIF=1 -DHAVE_XMUSEVERSION=1 -DHAVE_XMINSTALLIMAGE=1 -DALLIANCE_VERSION=\"5.0\" -DALLIANCE_TOP=\"/users/outil/alliance/Linux.FC2\" -DHAVE_LIBIBERTY=1
DEPDIR = .deps
DOC_MAJOR_VERSION = 1
DOC_MINOR_VERSION = 0
@ -185,7 +185,7 @@ K2F_VERSION = 1.1
L2P_MAJOR_VERSION = 1
L2P_MINOR_VERSION = 12
L2P_VERSION = 1.12
LDFLAGS = -L/dsk/l1/misc/hcl/altest/lib
LDFLAGS = -static -L/users/outil/alliance/Linux.FC2/lib
LEX = flex
LEXLIB = -lfl
LEX_OUTPUT_ROOT = lex.yy
@ -295,7 +295,7 @@ STRIP = strip
SYF_MAJOR_VERSION = 3
SYF_MINOR_VERSION = 6
SYF_VERSION = 3.6
TOOLSDIRS = mbk mbkal mbkap mbkedif mbkhilo mbkmg mbkspice mbkvhdl mbkvrlog mbkvti mbkvhdlg aut rds rdscif rdsgds elp abl bdd log btr vex ctl ctp abe abt abv fsm fks fvh ftl rtn rtd scl vbh vbl vpn vpd vvh vtl pat ppt phl gcp druc beh bhl bvl alcban asimut attila b2f boog boom cells distrib documentation dreal exp flatbeh flatlo flatph fmi fsp genlib genpat graal growstk k2f l2p loon lvx lynx m2e mips_asm mocha nero ocp ocr pat2spi pcbs proof ring s2r scapin sea syf vasy vst2xnf x2y xfsm xpat xsch xvpn
TOOLSDIRS = mbk mbkal mbkap mbkedif mbkhilo mbkmg mbkspice mbkvhdl mbkvrlog mbkvti mbkvhdlg aut rds rdscif rdsgds elp abl bdd log btr vex ctl ctp abe abt abv fsm fks fvh ftl rtn rtd scl vbh vbl vpn vpd vvh vtl pat ppt phl gcp druc beh bhl bvl alcban asimut attila b2f boog boom cells distrib dreal exp flatbeh flatlo flatph fmi fsp genlib genpat graal k2f l2p loon lvx lynx m2e mips_asm mocha nero ocp pat2spi proof ring s2r scapin sea syf vasy vst2xnf x2y xfsm xpat xsch xvpn documentation
VASY_MAJOR_VERSION = 1
VASY_MINOR_VERSION = 5
VASY_VERSION = 1.5
@ -336,7 +336,7 @@ X_PRE_LIBS = -lSM -lICE
YACC = bison -y
ac_ct_AR = ar
ac_ct_CC = gcc
ac_ct_CXX =
ac_ct_CXX = g++
ac_ct_F77 = g77
ac_ct_RANLIB = ranlib
ac_ct_STRIP = strip
@ -348,18 +348,18 @@ am__include = include
am__leading_dot = .
am__quote =
bindir = ${exec_prefix}/bin
build = i686-redhat-linux-gnu
build = i686-pc-linux-gnu
build_alias =
build_cpu = i686
build_os = linux-gnu
build_vendor = redhat
build_vendor = pc
datadir = ${prefix}/share
exec_prefix = ${prefix}
host = i686-redhat-linux-gnu
host = i686-pc-linux-gnu
host_alias =
host_cpu = i686
host_os = linux-gnu
host_vendor = redhat
host_vendor = pc
includedir = ${prefix}/include
infodir = ${prefix}/info
install_sh = /dsk/l1/misc/hcl/alliance/src/install-sh
@ -439,7 +439,7 @@ clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" = "$$p" && dir=.; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
@ -553,9 +553,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)

View File

@ -21,6 +21,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <string.h>
#include <stdlib.h>
#include <mut.h>
#include <mlo.h>
#include <mlu.h>

View File

@ -35,6 +35,7 @@
/* */
/****************************************************************************/
#include <stdlib.h>
#include <string.h>
#include <mut.h>
#include <mlo.h>
#include <mlu.h>

View File

@ -21,8 +21,10 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ident "$Id: flatlo.c,v 1.2 2002/09/30 16:20:13 czo Exp $"
#ident "$Id: flatlo.c,v 1.3 2005/05/11 08:05:32 hcl Exp $"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mut.h"
#include "mlo.h"

View File

@ -82,6 +82,7 @@ State 434 contains 2 shift/reduce conflicts. (Four ways to parse this.) */
%{
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <setjmp.h>
@ -102,7 +103,6 @@ State 434 contains 2 shift/reduce conflicts. (Four ways to parse this.) */
# include "c_debug.h"
#ifdef MULTIBYTE_CHARS
#include <stdlib.h>
#include <locale.h>
#endif

View File

@ -42,6 +42,7 @@
\------------------------------------------------------------*/
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "mut.h"

View File

@ -42,6 +42,7 @@
\------------------------------------------------------------*/
# include <stdio.h>
# include <stdlib.h>
# include "mut.h"
# include "aut.h"

View File

@ -42,6 +42,7 @@
\------------------------------------------------------------*/
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "mut.h"

View File

@ -42,6 +42,7 @@
\------------------------------------------------------------*/
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "mut.h"

View File

@ -6,6 +6,7 @@
%{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <mut.h>

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.8.3 from Makefile.am.
# Makefile.in generated by automake 1.8.5 from Makefile.am.
# genpat/src/Makefile. Generated from Makefile.in by configure.
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@ -38,7 +38,7 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = i686-redhat-linux-gnu
host_triplet = i686-pc-linux-gnu
subdir = genpat/src
DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
@ -94,9 +94,9 @@ ALCBANNER_MINOR_VERSION = 1
ALCBANNER_VERSION = 1.1
ALLIANCE_BUILD_FALSE = #
ALLIANCE_BUILD_TRUE =
ALLIANCE_CFLAGS = -I/dsk/l1/misc/hcl/altest/include
ALLIANCE_LIBS = -L/dsk/l1/misc/hcl/altest/lib
ALLIANCE_TOP = /dsk/l1/misc/hcl/altest
ALLIANCE_CFLAGS = -I/users/outil/alliance/Linux.FC2/include
ALLIANCE_LIBS = -L/users/outil/alliance/Linux.FC2/lib
ALLIANCE_TOP = /users/outil/alliance/Linux.FC2
AMDEP_FALSE = #
AMDEP_TRUE =
AMTAR = ${SHELL} /dsk/l1/misc/hcl/alliance/src/missing --run tar
@ -125,9 +125,9 @@ BTR_DLL_VERSION = 1:3:0
BVL_DLL_VERSION = 1:14:0
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -I/dsk/l1/misc/hcl/altest/include -g -O2
CFLAGS = -I/users/outil/alliance/Linux.FC2/include -g -O2
CPP = gcc -E
CPPFLAGS = -I/dsk/l1/misc/hcl/albuild/dsk/l1/misc/hcl/altest/include
CPPFLAGS =
CST_DLL_VERSION = 3:2:0
CTL_DLL_VERSION = 1:1:0
CTP_DLL_VERSION = 1:1:0
@ -136,7 +136,7 @@ CXXCPP = g++ -E
CXXDEPMODE = depmode=gcc3
CXXFLAGS = -g -O2
CYGPATH_W = echo
DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"alliance\" -DVERSION=\"5.0\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FCNTL_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRINGS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBIBERTY=1 -DHAVE_LIBM=1 -DHAVE_LIBM=1 -DHAVE_LIBM=1 -DHAVE_LIBM=1 -DHAVE_UNISTD_H=1 -DHAVE_FORK=1 -DHAVE_VFORK=1 -DHAVE_WORKING_VFORK=1 -DHAVE_WORKING_FORK=1 -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DRETSIGTYPE=void -DHAVE_MOTIF=1 -DHAVE_XPM=1 -DHAVE_XPM=1 -DHAVE_X11_XPM_H=1 -DHAVE_XP=1 -DHAVE_MOTIF=1 -DHAVE_XMUSEVERSION=1 -DHAVE_XMINSTALLIMAGE=1 -DALLIANCE_VERSION=\"5.0\" -DALLIANCE_TOP=\"/dsk/l1/misc/hcl/altest\" -DHAVE_LIBIBERTY=1
DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"alliance\" -DVERSION=\"5.0\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FCNTL_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRINGS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBIBERTY=1 -DHAVE_LIBM=1 -DHAVE_LIBM=1 -DHAVE_LIBM=1 -DHAVE_LIBM=1 -DHAVE_UNISTD_H=1 -DHAVE_FORK=1 -DHAVE_VFORK=1 -DHAVE_WORKING_VFORK=1 -DHAVE_WORKING_FORK=1 -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DRETSIGTYPE=void -DHAVE_MOTIF=1 -DHAVE_XPM=1 -DHAVE_XPM=1 -DHAVE_X11_XPM_H=1 -DHAVE_XP=1 -DHAVE_MOTIF=1 -DHAVE_XMUSEVERSION=1 -DHAVE_XMINSTALLIMAGE=1 -DALLIANCE_VERSION=\"5.0\" -DALLIANCE_TOP=\"/users/outil/alliance/Linux.FC2\" -DHAVE_LIBIBERTY=1
DEPDIR = .deps
DOC_MAJOR_VERSION = 1
DOC_MINOR_VERSION = 0
@ -189,7 +189,7 @@ K2F_VERSION = 1.1
L2P_MAJOR_VERSION = 1
L2P_MINOR_VERSION = 12
L2P_VERSION = 1.12
LDFLAGS = -L/dsk/l1/misc/hcl/altest/lib
LDFLAGS = -static -L/users/outil/alliance/Linux.FC2/lib
LEX = flex
LEXLIB = -lfl
LEX_OUTPUT_ROOT = lex.yy
@ -299,7 +299,7 @@ STRIP = strip
SYF_MAJOR_VERSION = 3
SYF_MINOR_VERSION = 6
SYF_VERSION = 3.6
TOOLSDIRS = mbk mbkal mbkap mbkedif mbkhilo mbkmg mbkspice mbkvhdl mbkvrlog mbkvti mbkvhdlg aut rds rdscif rdsgds elp abl bdd log btr vex ctl ctp abe abt abv fsm fks fvh ftl rtn rtd scl vbh vbl vpn vpd vvh vtl pat ppt phl gcp druc beh bhl bvl alcban asimut attila b2f boog boom cells distrib documentation dreal exp flatbeh flatlo flatph fmi fsp genlib genpat graal growstk k2f l2p loon lvx lynx m2e mips_asm mocha nero ocp ocr pat2spi pcbs proof ring s2r scapin sea syf vasy vst2xnf x2y xfsm xpat xsch xvpn
TOOLSDIRS = mbk mbkal mbkap mbkedif mbkhilo mbkmg mbkspice mbkvhdl mbkvrlog mbkvti mbkvhdlg aut rds rdscif rdsgds elp abl bdd log btr vex ctl ctp abe abt abv fsm fks fvh ftl rtn rtd scl vbh vbl vpn vpd vvh vtl pat ppt phl gcp druc beh bhl bvl alcban asimut attila b2f boog boom cells distrib dreal exp flatbeh flatlo flatph fmi fsp genlib genpat graal k2f l2p loon lvx lynx m2e mips_asm mocha nero ocp pat2spi proof ring s2r scapin sea syf vasy vst2xnf x2y xfsm xpat xsch xvpn documentation
VASY_MAJOR_VERSION = 1
VASY_MINOR_VERSION = 5
VASY_VERSION = 1.5
@ -340,7 +340,7 @@ X_PRE_LIBS = -lSM -lICE
YACC = bison -y
ac_ct_AR = ar
ac_ct_CC = gcc
ac_ct_CXX =
ac_ct_CXX = g++
ac_ct_F77 = g77
ac_ct_RANLIB = ranlib
ac_ct_STRIP = strip
@ -352,18 +352,18 @@ am__include = include
am__leading_dot = .
am__quote =
bindir = ${exec_prefix}/bin
build = i686-redhat-linux-gnu
build = i686-pc-linux-gnu
build_alias =
build_cpu = i686
build_os = linux-gnu
build_vendor = redhat
build_vendor = pc
datadir = ${prefix}/share
exec_prefix = ${prefix}
host = i686-redhat-linux-gnu
host = i686-pc-linux-gnu
host_alias =
host_cpu = i686
host_os = linux-gnu
host_vendor = redhat
host_vendor = pc
includedir = ${prefix}/include
infodir = ${prefix}/info
install_sh = /dsk/l1/misc/hcl/alliance/src/install-sh
@ -450,7 +450,7 @@ clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" = "$$p" && dir=.; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
@ -566,9 +566,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)

View File

@ -32,7 +32,7 @@
#include <hash_map.h>
#else
#include <ext/hash_map>
#if __GNUC_MINOR__ == 0
#if (__GNUC_MINOR__ == 0) and (__GNUC__ == 3)
#else
using namespace __gnu_cxx; // GCC 3.1 and later
#endif

View File

@ -34,340 +34,6 @@
#include "pat.h"
#include "pat_debug.h"
/* ###--------------------------------------------------------------### */
/* function : pat_debug */
/* description : display any pat structure */
/* called func. : pat_error, pat_message */
/* go_forward, translate, splitline, pop, push */
/* read_field, get_size */
/* ###--------------------------------------------------------------### */
void pat_debug (head_pnt, type)
void *head_pnt; /* structure's pointer */
char *type; /* structure's type */
{
static void disp_immd ();
static void get_size ();
static void read_field ();
static void push ();
static void pop ();
static struct chain *go_forward ();
static int translate ();
static int splitline ();
char line [128]; /* buffer to read a cmd line */
char buffer [128]; /* buffer to split the cmd line */
char *words [ 10]; /* number of words on a line */
int nmbrs [ 10]; /* words translated into number */
char flags [ 10]; /* set if words is a number */
int indxs [ 10]; /* index of words */
struct stack jtab [ 10]; /* list of memorized addresses */
int idx;
int readflg = 0;
unsigned int size;
char *pntr = NULL;
long pshtype;
int wrdcnt = 1;
struct stack stk [STKSIZ_DFN];
int stkpnt = -1;
union value pnt [MAXCMD_DFN];
long typ [MAXCMD_DFN];
unsigned int siz [MAXCMD_DFN];
static char *str [] = {
"_back" , "_exit" , "_jump" , "_save" ,
"_stop" , "_top" , "_up" , "_display" ,
"character", "short" , "integer" , "long" ,
"void" , "string" ,
"chain" , "ptype" ,
"paseq" , "pagrp" , "paiol" , "papat" ,
"pacom" , "paini" , "paevt" , "pains" ,
"actflag" , "blank" , "buffer" , "curcom" ,
"curpat" , "deccom" , "drvseq" , "endflg" ,
"errflg" , "filname" , "filpnt" , "findex" ,
"flag" , "format" , "index" , "insname" ,
"instance" , "iolnbr" , "label" , "length" ,
"line" , "lineno" , "mode" , "model" ,
"name" , "next" , "nxtpat" , "oldcom" ,
"oldpat" , "patnbr" , "position" , "savflg" ,
"sig" , "simflag" , "simval" , "subseq" ,
"text" , "time" , "usrval" , "value" ,
"flags" , "time_unit", "time_step"
};
/* ###------------------------------------------------------### */
/* initialisation : */
/* - allocate a buffer for read words */
/* - break the argument that identifies the structure (type) */
/* into words */
/* - search that words among recognized strings */
/* ###------------------------------------------------------### */
words [0] = buffer;
get_size (siz);
wrdcnt = splitline (words, type);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
typ [idx] = POINTER_DFN | s_DFN | idx;
pnt [idx].dat = head_pnt;
/* ###------------------------------------------------------### */
/* process the command line until the _exit command */
/* ###------------------------------------------------------### */
while ((idx & TYPE_DFN) != _exit_DFN)
{
/* ###------------------------------------------------------### */
/* if the first word of the line has not been recognized, */
/* print an error message. Otherwise, proccess the command line */
/* (generally it is a request for displaying a specific field). */
/* */
/* At this point : */
/* - pnt [] contains all available pointers */
/* - typ [] contains the type of availabale pointers */
/* ###------------------------------------------------------### */
if (idx == _error_DFN)
pat_error (103, NULL, NULL, 0);
else
{
/* ###------------------------------------------------------### */
/* define the type of the structure that may be pushed on */
/* the stack : */
/* - if the pointer is a VOID pointer the exact type must be */
/* defined on the command line (last word of the command) */
/* ###------------------------------------------------------### */
pshtype = POINTER_DFN | s_DFN | void_DFN;
if ((typ [idx] & TYPE_DFN) == void_DFN)
{
if ((wrdcnt >= 2) && (indxs [wrdcnt - 1] != _error_DFN))
pshtype = POINTER_DFN | s_DFN | indxs [wrdcnt - 1];
else
pat_error (105, NULL, NULL, 0);
}
else
pshtype = typ [idx];
/* ###------------------------------------------------------### */
/* depending on the kind of the first word of the command */
/* activate actions : */
/* - COMMAND (_top, _up, ...) */
/* - POINTER */
/* - for NEXT go forward until the Nth element of the */
/* list. Then, push it on the stack and read fields */
/* - for others push and read fields */
/* - ARRAY */
/* - push the Nth element of the array and read its */
/* fields */
/* - ARRAY OF POINTER */
/* - push the object which address is the Nth element of */
/* the array and read its fields */
/* ###------------------------------------------------------### */
switch (typ [idx] & KIND_DFN)
{
/* ###------------------------------------------------------### */
/* COMMANDS ... */
/* ###------------------------------------------------------### */
case COMMAND_DFN :
switch (typ [idx] & TYPE_DFN)
{
/* ###------------------------------------------------------### */
/* _top COMMAND : reset the stack pointer, call read_field */
/* to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _top_DFN :
stkpnt = 0;
readflg = 1;
break;
/* ###------------------------------------------------------### */
/* _stop COMMAND : set the stop mark for the structure on */
/* the top of stack */
/* ###------------------------------------------------------### */
case _stop_DFN :
stk [stkpnt].mark = 1;
pat_message (1, "pat_debug", NULL, 0);
break;
/* ###------------------------------------------------------### */
/* _back COMMAND : pop structures from the stack until a */
/* marked structure is found. Call read_field to read the */
/* structure on the top of stack */
/* ###------------------------------------------------------### */
case _back_DFN :
while ((stkpnt != 0) && (stk[--stkpnt].mark != 1));
readflg = 1;
break;
/* ###------------------------------------------------------### */
/* _jump COMMAND : push on the stack the structure saved in */
/* the jump table. Call read_field to read the structure on the */
/* top of stack */
/* ###------------------------------------------------------### */
case _jump_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
{
push (stk, &stkpnt, jtab[nmbrs[1]].data, jtab[nmbrs[1]].type);
readflg = 1;
}
else
pat_error (103, NULL, NULL, 0);
break;
/* ###------------------------------------------------------### */
/* _up COMMAND : pop structure from the stack. Call */
/* read_field to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _up_DFN :
if (wrdcnt == 1)
{
pop (&stkpnt, 1);
readflg = 1;
}
else
{
if ((wrdcnt == 2) && (flags [1] == 1))
{
pop (&stkpnt, nmbrs [1] + 1);
readflg = 1;
}
else
pat_error (103, NULL, NULL, 0);
}
break;
/* ###------------------------------------------------------### */
/* _save COMMAND : save the structure on the top of stack in */
/* the jump table */
/* ###------------------------------------------------------### */
case _save_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
jtab [nmbrs[1]] = stk [stkpnt];
else
pat_error (103, NULL, NULL, 0);
break;
/* ###------------------------------------------------------### */
/* _display COMMAND : display a specified field as an */
/* immediate */
/* ###------------------------------------------------------### */
case _display_DFN :
if ((wrdcnt == 3) && (indxs [1] != _error_DFN))
disp_immd (str, pnt [indxs [1]], indxs [2]);
else
pat_error (103, NULL, NULL, 0);
break;
}
break;
/* ###------------------------------------------------------### */
/* POINTERS ... */
/* ###------------------------------------------------------### */
case POINTER_DFN :
if (idx == next_DFN)
{
if ((wrdcnt == 1) || ((wrdcnt == 2) && (flags [1] == 0)))
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
else
{
if (((wrdcnt == 3) || (wrdcnt == 2)) && (flags [1] == 1))
{
pnt [idx].dat = (void *) go_forward (pnt [idx].dat, nmbrs [1]);
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
else
pat_error (103, NULL, NULL, 0);
}
}
else
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
break;
/* ###------------------------------------------------------### */
/* ARRAIES of structure */
/* ###------------------------------------------------------### */
case ARRAY_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = siz [(typ [idx] & TYPE_DFN)];
pntr = (void *)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
readflg = 1;
}
else
pat_error (103, NULL, NULL, 0);
break;
/* ###------------------------------------------------------### */
/* ARRAIES of pointers */
/* ###------------------------------------------------------### */
case ARYOFPNT_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = sizeof (void *);
pntr = * (void **)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
readflg = 1;
}
else
pat_error (103, NULL, NULL, 0);
break;
}
if (readflg == 1)
{
readflg = 0;
read_field (stk [stkpnt], pnt, typ, str);
}
}
printf ("\n\nCOMMAND > ");
gets (line);
wrdcnt = splitline (words, line);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
}
}
/* ###--------------------------------------------------------------### */
/* function : read_field */
@ -1010,3 +676,332 @@ int type ;
pat_error (103, NULL, NULL, 0);
}
}
/* ###--------------------------------------------------------------### */
/* function : pat_debug */
/* description : display any pat structure */
/* called func. : pat_error, pat_message */
/* go_forward, translate, splitline, pop, push */
/* read_field, get_size */
/* ###--------------------------------------------------------------### */
void pat_debug (head_pnt, type)
void *head_pnt; /* structure's pointer */
char *type; /* structure's type */
{
char line [128]; /* buffer to read a cmd line */
char buffer [128]; /* buffer to split the cmd line */
char *words [ 10]; /* number of words on a line */
int nmbrs [ 10]; /* words translated into number */
char flags [ 10]; /* set if words is a number */
int indxs [ 10]; /* index of words */
struct stack jtab [ 10]; /* list of memorized addresses */
int idx;
int readflg = 0;
unsigned int size;
char *pntr = NULL;
long pshtype;
int wrdcnt = 1;
struct stack stk [STKSIZ_DFN];
int stkpnt = -1;
union value pnt [MAXCMD_DFN];
long typ [MAXCMD_DFN];
unsigned int siz [MAXCMD_DFN];
static char *str [] = {
"_back" , "_exit" , "_jump" , "_save" ,
"_stop" , "_top" , "_up" , "_display" ,
"character", "short" , "integer" , "long" ,
"void" , "string" ,
"chain" , "ptype" ,
"paseq" , "pagrp" , "paiol" , "papat" ,
"pacom" , "paini" , "paevt" , "pains" ,
"actflag" , "blank" , "buffer" , "curcom" ,
"curpat" , "deccom" , "drvseq" , "endflg" ,
"errflg" , "filname" , "filpnt" , "findex" ,
"flag" , "format" , "index" , "insname" ,
"instance" , "iolnbr" , "label" , "length" ,
"line" , "lineno" , "mode" , "model" ,
"name" , "next" , "nxtpat" , "oldcom" ,
"oldpat" , "patnbr" , "position" , "savflg" ,
"sig" , "simflag" , "simval" , "subseq" ,
"text" , "time" , "usrval" , "value" ,
"flags" , "time_unit", "time_step"
};
/* ###------------------------------------------------------### */
/* initialisation : */
/* - allocate a buffer for read words */
/* - break the argument that identifies the structure (type) */
/* into words */
/* - search that words among recognized strings */
/* ###------------------------------------------------------### */
words [0] = buffer;
get_size (siz);
wrdcnt = splitline (words, type);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
typ [idx] = POINTER_DFN | s_DFN | idx;
pnt [idx].dat = head_pnt;
/* ###------------------------------------------------------### */
/* process the command line until the _exit command */
/* ###------------------------------------------------------### */
while ((idx & TYPE_DFN) != _exit_DFN)
{
/* ###------------------------------------------------------### */
/* if the first word of the line has not been recognized, */
/* print an error message. Otherwise, proccess the command line */
/* (generally it is a request for displaying a specific field). */
/* */
/* At this point : */
/* - pnt [] contains all available pointers */
/* - typ [] contains the type of availabale pointers */
/* ###------------------------------------------------------### */
if (idx == _error_DFN)
pat_error (103, NULL, NULL, 0);
else
{
/* ###------------------------------------------------------### */
/* define the type of the structure that may be pushed on */
/* the stack : */
/* - if the pointer is a VOID pointer the exact type must be */
/* defined on the command line (last word of the command) */
/* ###------------------------------------------------------### */
pshtype = POINTER_DFN | s_DFN | void_DFN;
if ((typ [idx] & TYPE_DFN) == void_DFN)
{
if ((wrdcnt >= 2) && (indxs [wrdcnt - 1] != _error_DFN))
pshtype = POINTER_DFN | s_DFN | indxs [wrdcnt - 1];
else
pat_error (105, NULL, NULL, 0);
}
else
pshtype = typ [idx];
/* ###------------------------------------------------------### */
/* depending on the kind of the first word of the command */
/* activate actions : */
/* - COMMAND (_top, _up, ...) */
/* - POINTER */
/* - for NEXT go forward until the Nth element of the */
/* list. Then, push it on the stack and read fields */
/* - for others push and read fields */
/* - ARRAY */
/* - push the Nth element of the array and read its */
/* fields */
/* - ARRAY OF POINTER */
/* - push the object which address is the Nth element of */
/* the array and read its fields */
/* ###------------------------------------------------------### */
switch (typ [idx] & KIND_DFN)
{
/* ###------------------------------------------------------### */
/* COMMANDS ... */
/* ###------------------------------------------------------### */
case COMMAND_DFN :
switch (typ [idx] & TYPE_DFN)
{
/* ###------------------------------------------------------### */
/* _top COMMAND : reset the stack pointer, call read_field */
/* to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _top_DFN :
stkpnt = 0;
readflg = 1;
break;
/* ###------------------------------------------------------### */
/* _stop COMMAND : set the stop mark for the structure on */
/* the top of stack */
/* ###------------------------------------------------------### */
case _stop_DFN :
stk [stkpnt].mark = 1;
pat_message (1, "pat_debug", NULL, 0);
break;
/* ###------------------------------------------------------### */
/* _back COMMAND : pop structures from the stack until a */
/* marked structure is found. Call read_field to read the */
/* structure on the top of stack */
/* ###------------------------------------------------------### */
case _back_DFN :
while ((stkpnt != 0) && (stk[--stkpnt].mark != 1));
readflg = 1;
break;
/* ###------------------------------------------------------### */
/* _jump COMMAND : push on the stack the structure saved in */
/* the jump table. Call read_field to read the structure on the */
/* top of stack */
/* ###------------------------------------------------------### */
case _jump_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
{
push (stk, &stkpnt, jtab[nmbrs[1]].data, jtab[nmbrs[1]].type);
readflg = 1;
}
else
pat_error (103, NULL, NULL, 0);
break;
/* ###------------------------------------------------------### */
/* _up COMMAND : pop structure from the stack. Call */
/* read_field to read the structure on the top of stack */
/* ###------------------------------------------------------### */
case _up_DFN :
if (wrdcnt == 1)
{
pop (&stkpnt, 1);
readflg = 1;
}
else
{
if ((wrdcnt == 2) && (flags [1] == 1))
{
pop (&stkpnt, nmbrs [1] + 1);
readflg = 1;
}
else
pat_error (103, NULL, NULL, 0);
}
break;
/* ###------------------------------------------------------### */
/* _save COMMAND : save the structure on the top of stack in */
/* the jump table */
/* ###------------------------------------------------------### */
case _save_DFN :
if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
jtab [nmbrs[1]] = stk [stkpnt];
else
pat_error (103, NULL, NULL, 0);
break;
/* ###------------------------------------------------------### */
/* _display COMMAND : display a specified field as an */
/* immediate */
/* ###------------------------------------------------------### */
case _display_DFN :
if ((wrdcnt == 3) && (indxs [1] != _error_DFN))
disp_immd (str, pnt [indxs [1]], indxs [2]);
else
pat_error (103, NULL, NULL, 0);
break;
}
break;
/* ###------------------------------------------------------### */
/* POINTERS ... */
/* ###------------------------------------------------------### */
case POINTER_DFN :
if (idx == next_DFN)
{
if ((wrdcnt == 1) || ((wrdcnt == 2) && (flags [1] == 0)))
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
else
{
if (((wrdcnt == 3) || (wrdcnt == 2)) && (flags [1] == 1))
{
pnt [idx].dat = (void *) go_forward (pnt [idx].dat, nmbrs [1]);
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
else
pat_error (103, NULL, NULL, 0);
}
}
else
{
push (stk, &stkpnt, pnt [idx].dat, pshtype);
readflg = 1;
}
break;
/* ###------------------------------------------------------### */
/* ARRAIES of structure */
/* ###------------------------------------------------------### */
case ARRAY_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = siz [(typ [idx] & TYPE_DFN)];
pntr = (void *)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
readflg = 1;
}
else
pat_error (103, NULL, NULL, 0);
break;
/* ###------------------------------------------------------### */
/* ARRAIES of pointers */
/* ###------------------------------------------------------### */
case ARYOFPNT_DFN :
if ((wrdcnt > 1) && (flags [1] == 1))
{
size = sizeof (void *);
pntr = * (void **)
(((unsigned int) pnt [idx].dat) + (size * nmbrs [1]));
push (stk, &stkpnt, pntr, pshtype);
readflg = 1;
}
else
pat_error (103, NULL, NULL, 0);
break;
}
if (readflg == 1)
{
readflg = 0;
read_field (stk [stkpnt], pnt, typ, str);
}
}
printf ("\n\nCOMMAND > ");
gets (line);
wrdcnt = splitline (words, line);
idx = translate (words, wrdcnt, str, nmbrs, flags, indxs);
}
}

View File

@ -30,6 +30,7 @@
/* ###--------------------------------------------------------------### */
#include <stdio.h>
#include <string.h>
#include "pat.h"
#include "phl.h"

View File

@ -51,6 +51,44 @@ extern int yynerrs;
FIN LUDO
*/
/* ###--------------------------------------------------------------### */
/* function : lcl_search */
/* description : check that an identifier is a reserved word or not */
/* called func. : addht, addhtitem, gethtitem, namealloc */
/* ###--------------------------------------------------------------### */
static int lcl_search (key)
char *key;
{
static ht *pt_hash = NULL;
if (pt_hash == NULL)
{
pt_hash = addht (32);
addhtitem (pt_hash, namealloc ("begin" ), BEGIN_ );
addhtitem (pt_hash, namealloc ("downto" ), DOWNTO );
addhtitem (pt_hash, namealloc ("end" ), END_ );
addhtitem (pt_hash, namealloc ("fs" ), FS );
addhtitem (pt_hash, namealloc ("in" ), _IN );
addhtitem (pt_hash, namealloc ("inout" ), _INOUT );
addhtitem (pt_hash, namealloc ("inspect" ), INSPECT );
addhtitem (pt_hash, namealloc ("ms" ), MS );
addhtitem (pt_hash, namealloc ("ns" ), NS );
addhtitem (pt_hash, namealloc ("ps" ), PS );
addhtitem (pt_hash, namealloc ("out" ), _OUT );
addhtitem (pt_hash, namealloc ("register"), REGISTER);
addhtitem (pt_hash, namealloc ("save" ), SAVE );
addhtitem (pt_hash, namealloc ("signal" ), SIGNAL );
addhtitem (pt_hash, namealloc ("spy" ), SPY );
addhtitem (pt_hash, namealloc ("to" ), TO );
addhtitem (pt_hash, namealloc ("trace" ), TRACE );
addhtitem (pt_hash, namealloc ("us" ), US );
}
return (gethtitem (pt_hash, namealloc (key)));
}
static char buff [1024];
%}
@ -176,7 +214,6 @@ letter [a-zA-Z]
}
<INITIAL,OUT_PAT,DTC_FRM>{letter}(_?({letter}|[0-9]))* {
int code ;
static int lcl_search ();
yylval.text = namealloc (yytext);
if ((code = lcl_search (yylval.text)) == -1)
@ -218,41 +255,3 @@ int pat_decl_y_wrap ()
return (1);
}
/* ###--------------------------------------------------------------### */
/* function : lcl_search */
/* description : check that an identifier is a reserved word or not */
/* called func. : addht, addhtitem, gethtitem, namealloc */
/* ###--------------------------------------------------------------### */
static int lcl_search (key)
char *key;
{
static ht *pt_hash = NULL;
if (pt_hash == NULL)
{
pt_hash = addht (32);
addhtitem (pt_hash, namealloc ("begin" ), BEGIN_ );
addhtitem (pt_hash, namealloc ("downto" ), DOWNTO );
addhtitem (pt_hash, namealloc ("end" ), END_ );
addhtitem (pt_hash, namealloc ("fs" ), FS );
addhtitem (pt_hash, namealloc ("in" ), _IN );
addhtitem (pt_hash, namealloc ("inout" ), _INOUT );
addhtitem (pt_hash, namealloc ("inspect" ), INSPECT );
addhtitem (pt_hash, namealloc ("ms" ), MS );
addhtitem (pt_hash, namealloc ("ns" ), NS );
addhtitem (pt_hash, namealloc ("ps" ), PS );
addhtitem (pt_hash, namealloc ("out" ), _OUT );
addhtitem (pt_hash, namealloc ("register"), REGISTER);
addhtitem (pt_hash, namealloc ("save" ), SAVE );
addhtitem (pt_hash, namealloc ("signal" ), SIGNAL );
addhtitem (pt_hash, namealloc ("spy" ), SPY );
addhtitem (pt_hash, namealloc ("to" ), TO );
addhtitem (pt_hash, namealloc ("trace" ), TRACE );
addhtitem (pt_hash, namealloc ("us" ), US );
}
return (gethtitem (pt_hash, namealloc (key)));
}

View File

@ -79,7 +79,7 @@
| |
\------------------------------------------------------------*/
static char *XfsmPanelButtonDisable = "xxxx";
char *XfsmPanelButtonDisable = "xxxx";
/*------------------------------------------------------------\
| |

View File

@ -44,6 +44,7 @@
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <signal.h>
# include <setjmp.h>
# include "mut.h"

View File

@ -44,6 +44,7 @@
\------------------------------------------------------------*/
# include <stdio.h>
# include <stdlib.h>
# include "mut.h"
# include "aut.h"
# include "pat.h"

View File

@ -77,7 +77,7 @@
| |
\------------------------------------------------------------*/
static char *XpatPanelButtonDisable = "xxxx";
char *XpatPanelButtonDisable = "xxxx";
/*------------------------------------------------------------\
| |

View File

@ -44,6 +44,7 @@
\------------------------------------------------------------*/
# include <stdio.h>
# include <stdlib.h>
# include <Xm/Xm.h>
# include "mut.h"

View File

@ -44,6 +44,7 @@
\------------------------------------------------------------*/
# include <stdio.h>
# include <string.h>
# include "mut.h"
# include "aut.h"
# include "mlo.h"

View File

@ -77,7 +77,7 @@
| |
\------------------------------------------------------------*/
static char *XschPanelButtonDisable = "xxxx";
char *XschPanelButtonDisable = "xxxx";
/*------------------------------------------------------------\
| |

View File

@ -44,6 +44,8 @@
\------------------------------------------------------------*/
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <Xm/Xm.h>
# include "mut.h"

View File

@ -44,6 +44,8 @@
\------------------------------------------------------------*/
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "mut.h"
# include "aut.h"
# include "XSB.h"

View File

@ -76,7 +76,7 @@
| |
\------------------------------------------------------------*/
static char *XvpnPanelButtonDisable = "xxxx";
char *XvpnPanelButtonDisable = "xxxx";
/*------------------------------------------------------------\
| |