1 |
/* |
2 |
* Ascend Instance Tree Type Definitions |
3 |
* by Tom Epperly |
4 |
* 8/16/89 |
5 |
* Version: $Revision: 1.8 $ |
6 |
* Version control file: $RCSfile: copyinst.h,v $ |
7 |
* Date last modified: $Date: 1997/09/08 18:07:35 $ |
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 |
/** @file |
31 |
* Ascend Instance Tree Type Definitions. |
32 |
* <pre> |
33 |
* When #including copyinst.h, make sure these files are #included first: |
34 |
* #include "utilities/ascConfig.h" |
35 |
* #include "fractions.h" |
36 |
* #include "compiler.h" |
37 |
* #include "dimen.h" |
38 |
* #include "child.h" |
39 |
* #include "type_desc.h" |
40 |
* </pre> |
41 |
*/ |
42 |
|
43 |
#ifndef ASC_COPYINST_H |
44 |
#define ASC_COPYINST_H |
45 |
|
46 |
/** addtogroup compiler Compiler |
47 |
@{ |
48 |
*/ |
49 |
|
50 |
enum Copy_enum { |
51 |
c_none, |
52 |
c_reference, |
53 |
c_tomodify |
54 |
}; |
55 |
|
56 |
extern void CheckChildCopies(unsigned long int num, struct Instance **clist); |
57 |
/**< |
58 |
* <!-- CheckChildCopies(num,clist); --> |
59 |
* Fixes up the num subatomic children sets copied into clist. |
60 |
*/ |
61 |
|
62 |
extern void RedoChildPointers(unsigned long int num, |
63 |
struct Instance *newparent, |
64 |
struct Instance **newchildptrs, |
65 |
CONST struct Instance *oldparent, |
66 |
struct Instance * CONST *oldchildptrs); |
67 |
/**< |
68 |
* <!-- RedoChildPointers(num,newparent,newchildptrs, oldparent,oldchildptrs); --> |
69 |
* Fix up the num subatomic child pointers of newparent. |
70 |
*/ |
71 |
|
72 |
extern struct Instance *ShortCutMakeUniversalInstance(struct TypeDescription *type); |
73 |
/**< |
74 |
* <!-- struct Instance *ShortCutMakeUniversalInstance(type); --> |
75 |
* <!-- struct TypeDescription *type; --> |
76 |
* Checks if the given type is universal and if a universal instance |
77 |
* exists. If one does, it will be returned, otherwise this returns NULL. |
78 |
* If the a non-NULL instance is returned, it is the responsibility of |
79 |
* the caller to ensure that the instance *knows* about the caller. |
80 |
* See AddParent for example. |
81 |
* Historical note: This function used to be a part of almost all the |
82 |
* Create*Instance routines, but has been separated, so that those functions |
83 |
* will now *always* create memory. |
84 |
*/ |
85 |
|
86 |
extern void CollectNodes(struct Instance *i, struct gl_list_t *l); |
87 |
/**< |
88 |
* <!-- CollectNodes(i,l); --> |
89 |
* Appends i to l, and sets the tmpnum of i to be the length of l |
90 |
* after i was appended. If i does not have a tmpnum (ATOM children) |
91 |
* this function just returns. |
92 |
*/ |
93 |
|
94 |
extern struct Instance *ShortCutProtoInstance(struct TypeDescription *type); |
95 |
/**< |
96 |
* <!-- struct Instance *ShortCutProtoInstance(type); --> |
97 |
* <!-- struct TypeDescription *type; --> |
98 |
* Checks if a prototype exists for the given type definition. |
99 |
* If one does, a copy of a prototype is returned. |
100 |
* If the a non NULL instance is returned, it is the responsibility of |
101 |
* the caller to ensure that the instance *knows* about the caller. |
102 |
* See AddParent() for example.<br><br> |
103 |
* |
104 |
* Historical note: This function has been created such that it may be |
105 |
* called separately from CreateInstance. If it were copied for example |
106 |
* then there is no need to redo default statements etc. And so a caller |
107 |
* can treat a copied instance specially. |
108 |
*/ |
109 |
|
110 |
ASC_DLLSPEC struct Instance *CopyInstance(CONST struct Instance *i); |
111 |
/**< |
112 |
* <!-- struct Instance *CopyInstance(i) --> |
113 |
* <!-- const struct Instance *i; --> |
114 |
* This will make a copy of instance i. |
115 |
* |
116 |
* This routine is especially good for copying atomic instances, |
117 |
* since it is faster to copy an atomic instance rather than |
118 |
* instantiating it. |
119 |
* <pre> |
120 |
* 1995 |
121 |
* This will make a copy of instance i. i may not be a fundamental |
122 |
* atomic instance. At the current time, there are the following |
123 |
* additional restrictions on instance i. |
124 |
* |
125 |
* 1) "i" may not contain instances of universal types |
126 |
* 2) all instances in the instance tree "i" must have parent's |
127 |
* only in the instance tree "i". |
128 |
* 3) instances in the instance tree "i" may not be ARE_ALIKE'd |
129 |
* to instances outside of instance tree "i". |
130 |
* 4) The tree must not have any pending statements, as pendings |
131 |
* and bitlists are basically ignored. |
132 |
* |
133 |
* 1997 (as left by abbott): |
134 |
* 1) is no longer valid, |
135 |
* 2&3) only partially correct, |
136 |
* 4) is more important than ever. --baa |
137 |
* </pre> |
138 |
*/ |
139 |
|
140 |
/* @} */ |
141 |
|
142 |
#endif /* ASC_COPYINST_H */ |
143 |
|