1 |
jds |
54 |
/* |
2 |
aw0a |
1 |
* Instance name routines |
3 |
|
|
* by Tom Epperly |
4 |
|
|
* Part Of Ascend |
5 |
|
|
* Version: $Revision: 1.6 $ |
6 |
|
|
* Version control file: $RCSfile: instance_name.h,v $ |
7 |
|
|
* Date last modified: $Date: 1998/02/05 16:36:20 $ |
8 |
|
|
* Last modified by: $Author: ballan $ |
9 |
|
|
* |
10 |
|
|
* This file is part of the Ascend Language Interpreter. |
11 |
|
|
* |
12 |
|
|
* Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly |
13 |
|
|
* |
14 |
|
|
* The Ascend Language Interpreter is free software; you can redistribute |
15 |
|
|
* it and/or modify it under the terms of the GNU General Public License as |
16 |
|
|
* published by the Free Software Foundation; either version 2 of the |
17 |
|
|
* License, or (at your option) any later version. |
18 |
|
|
* |
19 |
|
|
* The Ascend Language Interpreter is distributed in hope that it will be |
20 |
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
22 |
|
|
* General Public License for more details. |
23 |
|
|
* |
24 |
|
|
* You should have received a copy of the GNU General Public License |
25 |
|
|
* along with the program; if not, write to the Free Software Foundation, |
26 |
|
|
* Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named |
27 |
|
|
* COPYING. |
28 |
|
|
*/ |
29 |
|
|
|
30 |
jds |
54 |
/** @file |
31 |
|
|
* Instance name routines. |
32 |
|
|
* <pre> |
33 |
aw0a |
1 |
* When #including instance_name.h, make sure these files are #included first: |
34 |
jds |
54 |
* #include "utilities/ascConfig.h" |
35 |
aw0a |
1 |
* #include "compiler.h" |
36 |
jds |
54 |
* </pre> |
37 |
aw0a |
1 |
*/ |
38 |
|
|
|
39 |
johnpye |
67 |
#ifndef ASC_INSTANCE_NAME_H |
40 |
|
|
#define ASC_INSTANCE_NAME_H |
41 |
aw0a |
1 |
|
42 |
johnpye |
1066 |
/** addtogroup compiler Compiler |
43 |
|
|
@{ |
44 |
|
|
*/ |
45 |
|
|
|
46 |
aw0a |
1 |
enum NameTypes { |
47 |
jds |
54 |
IntArrayIndex, /**< integer array index */ |
48 |
|
|
StrArrayIndex, /**< string array index */ |
49 |
johnpye |
952 |
StrName /**< string name */ |
50 |
aw0a |
1 |
}; |
51 |
|
|
|
52 |
|
|
union InstanceNameUnion { |
53 |
|
|
long index; |
54 |
|
|
symchar *name; |
55 |
|
|
}; |
56 |
|
|
|
57 |
|
|
struct InstanceName { |
58 |
|
|
enum NameTypes t; |
59 |
|
|
union InstanceNameUnion u; |
60 |
|
|
}; |
61 |
|
|
|
62 |
|
|
#define InstanceNameType(in) ((in).t) |
63 |
ben.allan |
33 |
/**< |
64 |
jds |
54 |
* Return the type of InstanceName structure in. |
65 |
aw0a |
1 |
*/ |
66 |
|
|
|
67 |
|
|
#define InstanceNameStr(in) ((in).u.name) |
68 |
ben.allan |
33 |
/**< |
69 |
jds |
54 |
* Return the name of InstanceName structure in. |
70 |
aw0a |
1 |
* in must be of type StrName. |
71 |
|
|
*/ |
72 |
|
|
|
73 |
|
|
#define InstanceIntIndex(in) ((in).u.index) |
74 |
ben.allan |
33 |
/**< |
75 |
jds |
54 |
* Return the integer index value of InstanceName structure in. |
76 |
aw0a |
1 |
*/ |
77 |
|
|
|
78 |
|
|
#define InstanceStrIndex(in) ((in).u.name) |
79 |
ben.allan |
33 |
/**< |
80 |
jds |
54 |
* Return the string index value of InstanceName structure in. |
81 |
aw0a |
1 |
*/ |
82 |
|
|
|
83 |
|
|
#define SetInstanceNameType(in,type) ((in).t) = (type) |
84 |
ben.allan |
33 |
/**< |
85 |
jds |
54 |
* Set the type of InstanceName structure in to type (a NameTypes). |
86 |
aw0a |
1 |
*/ |
87 |
|
|
|
88 |
|
|
#define SetInstanceNameStrPtr(in,str) ((in).u.name) = (str) |
89 |
ben.allan |
33 |
/**< |
90 |
jds |
54 |
* Set the string pointer of InstanceName structure in to str (a symchar*). |
91 |
aw0a |
1 |
*/ |
92 |
|
|
|
93 |
|
|
#define SetInstanceNameStrIndex(in,str) ((in).u.name) = (str) |
94 |
jds |
54 |
/**< |
95 |
|
|
* Set the string index of InstanceName structure in to str (a symchar*). |
96 |
aw0a |
1 |
*/ |
97 |
|
|
|
98 |
|
|
#define SetInstanceNameIntIndex(in,int_index) ((in).u.index) = (int_index) |
99 |
ben.allan |
33 |
/**< |
100 |
jds |
54 |
* Set the integer index of InstanceName structure in to int_index (a long). |
101 |
aw0a |
1 |
*/ |
102 |
jds |
54 |
|
103 |
johnpye |
1066 |
/* @} */ |
104 |
|
|
|
105 |
johnpye |
67 |
#endif /* ASC_INSTANCE_NAME_H */ |
106 |
jds |
54 |
|