Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / sources / api / tas / tas_API.c
1 #include MUT_H
2 #include MLO_H
3 #include MLU_H
4 #include RCN_H
5 #include MSL_H
6 #include AVT_H
7 #include INF_H
8 #include ELP_H
9 #include CNS_H
10 #include YAG_H
11 #include TLC_H
12 #include TRC_H
13 #include STM_H
14 #include TTV_H
15 #include MCC_H
16 #include SIM_H
17 #include TAS_H
18 #include FCL_H
19 #include BEH_H
20 #include CBH_H
21 #include TUT_H
22 #include LIB_H
23 #include TLF_H
24 #include STB_H
25
26 #define API_USE_REAL_TYPES
27 #include "tas_API.h"
28
29 //-----------------------------------------------------------------
30
31 ttvfig_list *hitas_sub (char *figname, char cnsannotatelofig, char loadcnsfig )
32 {
33 ttvfig_list *ttvfig;
34
35 mbkenv ();
36 cnsenv ();
37 yagenv (tas_yaginit);
38 fclenv ();
39 elpenv ();
40 mccenv ();
41 tlcenv ();
42 rcnenv ();
43 rcx_env ();
44 stb_env ();
45 stb_ctk_env ();
46 tas_setenv ();
47 tas_version ();
48 libenv ();
49 tlfenv ();
50 cbhenv ();
51 ttvenv ();
52
53 TAS_CONTEXT->TAS_FILENAME = namealloc (figname);
54 TAS_CONTEXT->TAS_CNS_ANNOTATE_LOFIG = cnsannotatelofig ;
55
56 if (loadcnsfig=='Y' || getenv("TASREADCNS")!=NULL)
57 {
58 if (getloadedlofig(figname)!=NULL)
59 dellofig(figname);
60 TAS_CONTEXT->TAS_CNS_LOAD='Y';
61 }
62
63 { // configuration check level I
64 lofig_list *lf;
65 locon_list *lc;
66 chain_list *data;
67 inffig_list *ifl;
68
69 data = NULL;
70
71 lf = getloadedlofig(TAS_CONTEXT->TAS_FILENAME);
72 ifl = getloadedinffig(TAS_CONTEXT->TAS_FILENAME);
73 if (lf)
74 {
75 for (lc = lf->LOCON; lc; lc = lc->NEXT)
76 data = addchain(data,lc->NAME);
77
78 if (ifl)
79 {
80 inf_CheckRegistry(stdout,ifl,1,data);
81 }
82 }
83 freechain(data);
84 }
85
86
87
88 TAS_CONTEXT->TAS_FILEIN = TAS_CONTEXT->TAS_FILENAME;
89 YAG_CONTEXT->YAG_FIGNAME = TAS_CONTEXT->TAS_FILEIN;
90 if (!TAS_CONTEXT->TAS_FILEOUT)
91 TAS_CONTEXT->TAS_FILEOUT = TAS_CONTEXT->TAS_FILEIN;
92
93 if ((ttvfig=ttv_gethtmodel(TAS_CONTEXT->TAS_FILEOUT))!=NULL)
94 {
95 ttv_freettvfig(ttvfig);
96 }
97
98 if(TAS_CONTEXT->TAS_SILENTMODE == 'Y')
99 tas_CloseTerm() ;
100
101 ttvfig = tas_main ();
102
103 if(TAS_CONTEXT){
104 mbkfree (TAS_CONTEXT);
105 TAS_CONTEXT = NULL;
106 }
107
108 ttv_getinffile(ttvfig);
109
110 return ttvfig;
111 }
112
113 ttvfig_list *tas (char *figname)
114 {
115 return hitas_sub (figname, 'N', 0 );
116 }
117
118 //-----------------------------------------------------------------
119
120 void tas_command_line (char *args)
121 {
122 int argc, i, j, k;
123 char **argv;
124 char buf[1024];
125
126 i = 0;
127 argc = 1;
128 if (args[0] != '\0')
129 do
130 if ((args[i] == ' ') || (args[i] == '\0')) argc++;
131 while (args[i++] != '\0');
132 argv = (char**)malloc (argc * sizeof (char*));
133 argv[0] = strdup ("hitas");
134
135 i = 0;
136 j = 1;
137 k = 0;
138 do {
139 if ((args[i] == ' ') || (args[i] == '\0')) {
140 buf[k] = '\0';
141 argv[j++] = strdup (buf);
142 k = 0;
143 if (args[i] == '\0') break;
144 }
145 else {
146 if( args[i] != '{' && args[i] != '}' )
147 buf[k++] = args[i];
148 }
149 } while (args[i++] != '\0');
150
151 /* debug */
152 /*
153 fprintf (stdout, "******* argc = %d\n", argc);
154 for (i = 0; i < argc; i++)
155 fprintf (stdout, "%s ", argv[i]);
156 fprintf (stdout, "\n");
157 */
158
159
160 tas_top_main (argc, argv);
161 }
162
163 int hitas_pvt_count()
164 {
165 return TAS_PVT_COUNT;
166 }
167
168 #if 0
169 //-----------------------------------------------------------------
170
171 lofig_list *tas_extract_SPICE_path (ttvcritic_list *critic)
172 {
173 lofig_list *lofig;
174 cnsfig_list *cnsfig;
175
176 mbkenv ();
177 cnsenv ();
178 yagenv (tas_yaginit);
179 fclenv ();
180 elpenv ();
181 mccenv ();
182 tlcenv ();
183 rcnenv ();
184 rcx_env ();
185 stb_env ();
186 stb_ctk_env ();
187 tas_setenv ();
188
189 cnsfig = getcnsfig (critic->FIG->INFO->FIGNAME, NULL);
190 lofig = getloadedlofig (critic->FIG->INFO->FIGNAME);
191 return tas_extract_spice_path (lofig, cnsfig, NULL, critic);
192 }
193
194 //-----------------------------------------------------------------
195
196 sim_model *tas_extract_SPICE_patterns (ttvcritic_list *critic, lofig_list *figext)
197 {
198 lofig_list *lofig;
199 cnsfig_list *cnsfig;
200
201 cnsfig = getcnsfig (critic->FIG->INFO->FIGNAME, NULL);
202 lofig = getloadedlofig (critic->FIG->INFO->FIGNAME);
203 return tas_extract_spice_patterns (lofig, cnsfig, figext, SIM_MAX);
204 }
205
206 #endif