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

Contents of /trunk/base/generic/compiler/qlfdid.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 708 - (show annotations) (download) (as text)
Tue Jun 27 07:34:31 2006 UTC (17 years, 11 months ago) by johnpye
File MIME type: text/x-chdr
File size: 5057 byte(s)
Replaced some references to ascmalloc with ASC_NEW_ARRAY
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 #include <utilities/ascConfig.h>
30 #include <general/list.h>
31 #include "instance_enum.h"
32
33 #define MAXIMUM_ID_LENGTH 80
34
35 struct SearchEntry {
36 char *name; /**< name of the instance */
37 struct Instance *i; /**< pointer to the instance */
38 };
39
40 ASC_DLLSPEC(struct Instance *) g_search_inst;
41 /**< Result of the last qlfdid search of any kind in c or tcl. */
42
43 ASC_DLLSPEC(struct Instance *) g_relative_inst;
44 /**<
45 * Result of the last qlfdid search of any kind in tcl.
46 * (C calls to qlfdid routines do not change this.)
47 * 'qlfdid' and 'probe qlfdid' are known to set it.
48 */
49
50 ASC_DLLSPEC(char *) Asc_MakeInitString(int len);
51 /**<
52 * Will make a string of the specified length of a predefine default
53 * length if garbage is given. Will initialize the string to the mt string.
54 * Will return a pointer to the string;
55 */
56
57 ASC_DLLSPEC(void ) Asc_ReInitString(char *str);
58 /**<
59 * We will reinitialize a string of non-zero length to the mt string.
60 * If an ivalid string will leave it untouched.
61 */
62
63 extern struct SearchEntry *Asc_SearchEntryCreate(char *name,
64 struct Instance *i);
65 /**<
66 * Accepts a string and a pointer to an Instance and will create a
67 * and return a SearchEntry. Will save a copy of the string. Will always
68 * try to make space for the string.
69 */
70
71 ASC_DLLSPEC(struct Instance *) Asc_SearchEntryInstance(struct SearchEntry *se);
72 /**<
73 * Returns a the instance pointer from a search entry;
74 */
75
76 ASC_DLLSPEC(char *) Asc_SearchEntryName(struct SearchEntry *se);
77 /**<
78 * Returns the name of a search entry;
79 */
80
81 extern void Asc_SearchEntryDestroy(struct SearchEntry *se);
82 /**<
83 * Will delete the memory associated with its string, set its pointers
84 * to NULL, and free the memory associated with a SearchEntry.
85 */
86
87 ASC_DLLSPEC(void ) Asc_SearchListDestroy(struct gl_list_t *search_list);
88 /**<
89 * Frees up the memory that was allocated for the search_list which is
90 * a list of SearchEntry(s).
91 */
92
93 ASC_DLLSPEC(struct gl_list_t *) Asc_BrowQlfdidSearch(char *str, char *temp);
94 /**<
95 * Will accept two strings, both of which will be destroyed by the
96 * operation. Searches for an instance of the qualified name. Will
97 * return of a list (of SearchEntries), with each list element being
98 * a pointer to a level in the instance tree of the qualified id and
99 * 'g_search_inst' looking at the last part of the instance name.
100 * Will return NULL, whenever the qualified instance name cannot be found.
101 * If it returns NULL, the list does not exist; don't try to destroy it.
102 */
103
104 ASC_DLLSPEC(int ) Asc_QlfdidSearch2(char *str);
105 /**<
106 * This function is perhaps the entry point suited for most users.
107 * It uses the function Asc_BrowQlfdidSearch(), and will leave the g_search_inst
108 * looking at the found instance, or NULL. It attempts to avoid the
109 * overhead of creating search entries, for cases where the user only
110 * wants to find the instance associated with the given qualfied id.
111 * However because it still uses Asc_BrowQlfdidSearch, it incurs the cost
112 * of creating the path to the instance. For cases where this path is
113 * of no interest, but just the final instance use Asc_QlfdidSearch3 below.
114 * Returns 0 if found, 1 otherwise.
115 */
116
117 ASC_DLLSPEC(int ) Asc_QlfdidSearch3(CONST char *str, int relative);
118 /**<
119 * This function is still yet another entry point to the search routines.
120 * It uses the function BrowQlfdidSearch3, and will leave the g_search_inst
121 * looking at the found instance, or NULL. It attempts to avoid the
122 * overhead of creating search entries, for cases where the user only
123 * wants to find the instance associated with the given qualfied id.
124 * Returns 0 if found, 1 otherwise. This is perhaps the fastest
125 * version of the search codes.
126 *
127 * If relative = 1 will start search at g_relative_inst whose value
128 * should be set by a call to qlfdid (tcl) or Asc_BrowQlfdidSearchCmd (c).
129 * Note that if the relative option is used str should be relative to
130 * g_relative_inst NOT to the simulation root.
131 */
132
133 #endif /* ASC_QLFDID_H */
134

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