/[ascend]/trunk/ascend/compiler/qlfdid.h
ViewVC logotype

Contents of /trunk/ascend/compiler/qlfdid.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2323 - (show annotations) (download) (as text)
Wed Dec 15 06:35:43 2010 UTC (13 years, 7 months ago) by jpye
File MIME type: text/x-chdr
File size: 5207 byte(s)
Refactor some more stuff from 'utilities' into 'general' with goal that 'general' never refers to 'utilities'.
1 /* ASCEND modelling environment
2 Copyright (C) 1997, 2006 Carnegie Mellon University
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.
18 *//** @file
19 Interface Qualified Id Routines.
20 *//*
21 by Kirk Abbott and Ben Allan
22 Created: 1/94
23 Last in CVS: $Revision: 1.9 $ $Date: 2003/08/23 18:43:07 $ $Author: ballan $
24 */
25
26 #ifndef ASC_QLFDID_H
27 #define ASC_QLFDID_H
28
29 /** @addtogroup compiler_inst Compiler Instance Hierarchy
30 @{
31 */
32
33 #include <ascend/utilities/config.h>
34 #include <ascend/general/platform.h>
35 #include <ascend/general/list.h>
36 #include "instance_enum.h"
37
38 #define MAXIMUM_ID_LENGTH 80
39
40 struct SearchEntry {
41 char *name; /**< name of the instance */
42 struct Instance *i; /**< pointer to the instance */
43 };
44
45 ASC_DLLSPEC struct Instance *g_search_inst;
46 /**< Result of the last qlfdid search of any kind in c or tcl. */
47
48 ASC_DLLSPEC struct Instance *g_relative_inst;
49 /**<
50 * Result of the last qlfdid search of any kind in tcl.
51 * (C calls to qlfdid routines do not change this.)
52 * 'qlfdid' and 'probe qlfdid' are known to set it.
53 */
54
55 ASC_DLLSPEC char *Asc_MakeInitString(int len);
56 /**<
57 * Will make a string of the specified length of a predefine default
58 * length if garbage is given. Will initialize the string to the mt string.
59 * Will return a pointer to the string;
60 */
61
62 ASC_DLLSPEC void Asc_ReInitString(char *str);
63 /**<
64 * We will reinitialize a string of non-zero length to the mt string.
65 * If an ivalid string will leave it untouched.
66 */
67
68 ASC_DLLSPEC struct SearchEntry *Asc_SearchEntryCreate(char *name,
69 struct Instance *i);
70 /**<
71 * Accepts a string and a pointer to an Instance and will create a
72 * and return a SearchEntry. Will save a copy of the string. Will always
73 * try to make space for the string.
74 *
75 * Was extern
76 */
77
78 ASC_DLLSPEC struct Instance *Asc_SearchEntryInstance(struct SearchEntry *se);
79 /**<
80 * Returns a the instance pointer from a search entry;
81 */
82
83 ASC_DLLSPEC char *Asc_SearchEntryName(struct SearchEntry *se);
84 /**<
85 * Returns the name of a search entry;
86 */
87
88 ASC_DLLSPEC void Asc_SearchEntryDestroy(struct SearchEntry *se);
89 /**<
90 * Will delete the memory associated with its string, set its pointers
91 * to NULL, and free the memory associated with a SearchEntry.
92 *
93 * Was extern
94 */
95
96 ASC_DLLSPEC void Asc_SearchListDestroy(struct gl_list_t *search_list);
97 /**<
98 * Frees up the memory that was allocated for the search_list which is
99 * a list of SearchEntry(s).
100 */
101
102 ASC_DLLSPEC struct gl_list_t *Asc_BrowQlfdidSearch(char *str, char *temp);
103 /**<
104 * Will accept two strings, both of which will be destroyed by the
105 * operation. Searches for an instance of the qualified name. Will
106 * return of a list (of SearchEntries), with each list element being
107 * a pointer to a level in the instance tree of the qualified id and
108 * 'g_search_inst' looking at the last part of the instance name.
109 * Will return NULL, whenever the qualified instance name cannot be found.
110 * If it returns NULL, the list does not exist; don't try to destroy it.
111 */
112
113 ASC_DLLSPEC int Asc_QlfdidSearch2(char *str);
114 /**<
115 * This function is perhaps the entry point suited for most users.
116 * It uses the function Asc_BrowQlfdidSearch(), and will leave the g_search_inst
117 * looking at the found instance, or NULL. It attempts to avoid the
118 * overhead of creating search entries, for cases where the user only
119 * wants to find the instance associated with the given qualfied id.
120 * However because it still uses Asc_BrowQlfdidSearch, it incurs the cost
121 * of creating the path to the instance. For cases where this path is
122 * of no interest, but just the final instance use Asc_QlfdidSearch3 below.
123 * Returns 0 if found, 1 otherwise.
124 */
125
126 ASC_DLLSPEC int Asc_QlfdidSearch3(CONST char *str, int relative);
127 /**<
128 * This function is still yet another entry point to the search routines.
129 * It uses the function BrowQlfdidSearch3, and will leave the g_search_inst
130 * looking at the found instance, or NULL. It attempts to avoid the
131 * overhead of creating search entries, for cases where the user only
132 * wants to find the instance associated with the given qualfied id.
133 * Returns 0 if found, 1 otherwise. This is perhaps the fastest
134 * version of the search codes.
135 *
136 * If relative = 1 will start search at g_relative_inst whose value
137 * should be set by a call to qlfdid (tcl) or Asc_BrowQlfdidSearchCmd (c).
138 * Note that if the relative option is used str should be relative to
139 * g_relative_inst NOT to the simulation root.
140 */
141
142 /* @} */
143
144 #endif /* ASC_QLFDID_H */
145

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22