version 1.4, 2000/09/21 09:19:27 |
version 1.5, 2001/10/09 01:36:25 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/parse/struct.c,v 1.3 2000/08/22 05:04:28 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/parse/struct.c,v 1.4 2000/09/21 09:19:27 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
|
|
struct oSS oLSS; |
struct oSS oLSS; |
SS LSS = &oLSS; |
SS LSS = &oLSS; |
|
|
int structdef(name,member) |
int structdef(char *name,NODE member) |
char *name; |
|
NODE member; |
|
{ |
{ |
int i,j,k,type; |
int i,j; |
SDEF sdef,s; |
SDEF sdef,s; |
NODE n,ms; |
NODE n; |
char *mname,*sname; |
char *mname; |
|
|
/* search the predefined structure */ |
/* search the predefined structure */ |
for ( s = LSS->sa, i = 0; i < LSS->n; i++ ) |
for ( s = LSS->sa, i = 0; i < LSS->n; i++ ) |
|
|
return i; |
return i; |
} |
} |
|
|
void newstruct(type,rp) |
void newstruct(int type,COMP *rp) |
int type; |
|
COMP *rp; |
|
{ |
{ |
NEWCOMP(*rp,LSS->sa[type].n); (*rp)->type = type; |
NEWCOMP(*rp,LSS->sa[type].n); (*rp)->type = type; |
} |
} |
|
|
int structtoindex(name) |
int structtoindex(char *name) |
char *name; |
|
{ |
{ |
SDEF s; |
SDEF s; |
int i; |
int i; |
|
|
return i; |
return i; |
} |
} |
|
|
int membertoindex(type,name) |
int membertoindex(int type,char *name) |
int type; |
|
char *name; |
|
{ |
{ |
SDEF s; |
SDEF s; |
char **member; |
char **member; |
|
|
return i; |
return i; |
} |
} |
|
|
int getcompsize(type) |
int getcompsize(int type) |
int type; |
|
{ |
{ |
return LSS->sa[type].n; |
return LSS->sa[type].n; |
} |
} |
|
|
#if 0 |
#if 0 |
void getmember(expr,memp) |
void getmember(FNODE expr,Obj *memp) |
FNODE expr; |
|
Obj *memp; |
|
{ |
{ |
int i; |
int i; |
FNODE root; |
FNODE root; |
|
|
*memp = (Obj)t; |
*memp = (Obj)t; |
} |
} |
|
|
void getmemberp(expr,addrp) |
void getmemberp(FNODE expr,Obj **addrp) |
FNODE expr; |
|
Obj **addrp; |
|
{ |
{ |
int i; |
int i; |
FNODE root; |
FNODE root; |
|
|
*addrp = (Obj *)addr; |
*addrp = (Obj *)addr; |
} |
} |
|
|
void getarrayp(a,ind,addrp) |
void getarrayp(Obj a,NODE ind,Obj **addrp) |
Obj a; |
|
NODE ind; |
|
Obj **addrp; |
|
{ |
{ |
Obj len,row,col; |
Obj len,row,col; |
Obj *addr; |
Obj *addr; |
|
|
} |
} |
#endif |
#endif |
|
|
Obj memberofstruct(a,name) |
Obj memberofstruct(COMP a,char *name) |
COMP a; |
|
char *name; |
|
{ |
{ |
NODE2 n,*np; |
|
int type,ind; |
int type,ind; |
char buf[BUFSIZ]; |
char buf[BUFSIZ]; |
|
|
|
|
return (Obj)a->member[ind]; |
return (Obj)a->member[ind]; |
} |
} |
|
|
void assign_to_member(a,name,obj) |
void assign_to_member(COMP a,char *name,Obj obj) |
COMP a; |
|
char *name; |
|
Obj obj; |
|
{ |
{ |
NODE2 n,*np; |
|
int type,ind; |
int type,ind; |
char buf[BUFSIZ]; |
char buf[BUFSIZ]; |
|
|