1 /*
2  * This file is part of the Alliance CAD System
3  * Copyright (C) Laboratoire LIP6 - D�partement ASIM
4  * Universite Pierre et Marie Curie
5  *
6  * Home page          : http://www-asim.lip6.fr/alliance/
7  * E-mail             : mailto:alliance-users@asim.lip6.fr
8  *
9  * This library is free software; you  can redistribute it and/or modify it
10  * under the terms  of the GNU Library General Public  License as published
11  * by the Free Software Foundation; either version 2 of the License, or (at
12  * your option) any later version.
13  *
14  * Alliance VLSI  CAD System  is distributed  in the hope  that it  will be
15  * useful, but WITHOUT  ANY WARRANTY; without even the  implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17  * Public License for more details.
18  *
19  * You should have received a copy  of the GNU General Public License along
20  * with the GNU C Library; see the  file COPYING. If not, write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 /* ###--------------------------------------------------------------### */
25 /* file		: beh_debug.c						*/
26 /* date		: Feb 29 2000						*/
27 /* version	: v111							*/
28 /* authors	: Pirouz BAZARGAN SABET					*/
29 /* content	: high level function					*/
30 /* ###--------------------------------------------------------------### */
31 
32 #include <stdio.h>
33 #include <string.h>
34 #include "mut.h"
35 #include "log.h"
36 #include "beh.h"
37 #include "beh_debug.h"
38 
39 static char           *buffer      = NULL;
40 static long            buff_size   = 0;
41 static struct circuit *circuit_pnt = NULL;
42 
43 
44 /* ###--------------------------------------------------------------### */
45 /* function	: display						*/
46 /* description	: display the fields of a structure			*/
47 /* called func.	: none							*/
48 /* ###--------------------------------------------------------------### */
49 
display(curpnt,pnt,typ,str)50 static void display (curpnt, pnt, typ, str)
51 
52 struct stack   curpnt;			/* current struct. for display	*/
53 union value   *pnt;			/* child structures or data	*/
54 long          *typ;			/* child struct. or data type	*/
55 char         **str;			/* recognized strings		*/
56 
57   {
58 
59   long                     i;
60   struct chain           *ptr_abl;
61 
62   struct chain           *chain_pnt;
63   struct ptype           *ptype_pnt;
64 
65   struct befig           *befig_pnt;
66   struct bereg           *bereg_pnt;
67   struct bemsg           *bemsg_pnt;
68   struct berin           *berin_pnt;
69   struct beout           *beout_pnt;
70   struct bebus           *bebus_pnt;
71   struct beaux           *beaux_pnt;
72   struct bebux           *bebux_pnt;
73   struct bepor           *bepor_pnt;
74   struct begen           *begen_pnt;
75   struct biabl           *biabl_pnt;
76   struct binode          *binode_pnt;
77   struct bequad          *bequad_pnt;
78   struct beder           *beder_pnt;
79 
80   char                  **string_pnt;
81   char                   *character_pnt;
82   long                    *int_pnt;
83 
84 	/* ###------------------------------------------------------### */
85 	/*    initialization						*/
86 	/* ###------------------------------------------------------### */
87 
88   if (buffer == NULL)
89     {
90     buff_size = 1024;
91     buffer    = (char *) mbkalloc (buff_size);
92     }
93 
94   for (i=0 ; i<MAXCMD_DFN ; i++)
95     {
96     typ [i]     = _error_DFN;
97     pnt [i].dat = NULL;
98     }
99 
100   typ [_exit_DFN]     = COMMAND_DFN | _exit_DFN;
101   typ [_up_DFN]       = COMMAND_DFN | _up_DFN;
102   typ [_top_DFN]      = COMMAND_DFN | _top_DFN;
103   typ [_stop_DFN]     = COMMAND_DFN | _stop_DFN;
104   typ [_back_DFN]     = COMMAND_DFN | _back_DFN;
105   typ [_jump_DFN]     = COMMAND_DFN | _jump_DFN;
106   typ [_save_DFN]     = COMMAND_DFN | _save_DFN;
107   typ [_display_DFN]  = COMMAND_DFN | _display_DFN;
108 
109   switch (curpnt.type & TYPE_DFN)
110     {
111 	/* ###------------------------------------------------------### */
112 	/*    depending on the type of the current structure :		*/
113 	/*								*/
114 	/*       - define the type of each field :			*/
115 	/*          - the field contains an immediate or a pointer	*/
116 	/*          - what format must be used to print it		*/
117 	/*          - kind of data it contains				*/
118 	/*								*/
119 	/*       - register the data contained in the field		*/
120 	/* ###------------------------------------------------------### */
121 
122 	/* ###------------------------------------------------------### */
123 	/*    befig							*/
124 	/* ###------------------------------------------------------### */
125 
126     case befig_DFN :
127 
128       befig_pnt = (struct befig *) curpnt.data;
129 
130       typ [next_DFN]      = POINTER_DFN   | s_DFN | befig_DFN;
131       typ [name_DFN]      = IMMEDIATE_DFN | s_DFN | string_DFN;
132       typ [bereg_DFN]     = POINTER_DFN   | s_DFN | bereg_DFN;
133       typ [bemsg_DFN]     = POINTER_DFN   | s_DFN | bemsg_DFN;
134       typ [berin_DFN]     = POINTER_DFN   | s_DFN | berin_DFN;
135       typ [beout_DFN]     = POINTER_DFN   | s_DFN | beout_DFN;
136       typ [bebus_DFN]     = POINTER_DFN   | s_DFN | bebus_DFN;
137       typ [beaux_DFN]     = POINTER_DFN   | s_DFN | beaux_DFN;
138       typ [bedly_DFN]     = POINTER_DFN   | s_DFN | beaux_DFN;
139       typ [bebux_DFN]     = POINTER_DFN   | s_DFN | bebux_DFN;
140       typ [bepor_DFN]     = POINTER_DFN   | s_DFN | bepor_DFN;
141       typ [begen_DFN]     = POINTER_DFN   | s_DFN | begen_DFN;
142       typ [user_DFN]      = POINTER_DFN   | s_DFN | ptype_DFN;
143       typ [errflg_DFN]    = IMMEDIATE_DFN | d_DFN | character_DFN;
144       typ [type_DFN]      = IMMEDIATE_DFN | x_DFN | character_DFN;
145       typ [flag_DFN]      = IMMEDIATE_DFN | x_DFN | character_DFN;
146       typ [time_unit_DFN] = IMMEDIATE_DFN | x_DFN | character_DFN;
147       typ [time_step_DFN] = IMMEDIATE_DFN | u_DFN | integer_DFN;
148 
149       pnt [next_DFN].dat      = befig_pnt->NEXT     ;
150       pnt [name_DFN].dat      = befig_pnt->NAME     ;
151       pnt [bereg_DFN].dat     = befig_pnt->BEREG    ;
152       pnt [bemsg_DFN].dat     = befig_pnt->BEMSG    ;
153       pnt [berin_DFN].dat     = befig_pnt->BERIN    ;
154       pnt [beout_DFN].dat     = befig_pnt->BEOUT    ;
155       pnt [bebus_DFN].dat     = befig_pnt->BEBUS    ;
156       pnt [beaux_DFN].dat     = befig_pnt->BEAUX    ;
157       pnt [bedly_DFN].dat     = befig_pnt->BEDLY    ;
158       pnt [bebux_DFN].dat     = befig_pnt->BEBUX    ;
159       pnt [bepor_DFN].dat     = befig_pnt->BEPOR    ;
160       pnt [begen_DFN].dat     = befig_pnt->BEGEN    ;
161       pnt [user_DFN].dat      = befig_pnt->USER     ;
162       pnt [errflg_DFN].imd    = befig_pnt->ERRFLG   ;
163       pnt [type_DFN].imd      = befig_pnt->TYPE     ;
164       pnt [flag_DFN].imd      = befig_pnt->FLAG     ;
165       pnt [time_unit_DFN].imd = befig_pnt->TIME_UNIT;
166       pnt [time_step_DFN].imd = befig_pnt->TIME_STEP;
167 
168       circuit_pnt = befig_pnt->CIRCUI;
169 
170       break;
171 
172 	/* ###------------------------------------------------------### */
173 	/*    bereg							*/
174 	/* ###------------------------------------------------------### */
175 
176     case bereg_DFN :
177 
178       bereg_pnt = (struct bereg *) curpnt.data;
179 
180       typ [next_DFN]   = POINTER_DFN   | s_DFN | bereg_DFN;
181       typ [name_DFN]   = IMMEDIATE_DFN | s_DFN | string_DFN;
182       typ [biabl_DFN]  = POINTER_DFN   | s_DFN | biabl_DFN;
183       typ [binode_DFN] = POINTER_DFN   | s_DFN | binode_DFN;
184 
185       pnt [next_DFN].dat   = bereg_pnt->NEXT;
186       pnt [name_DFN].dat   = bereg_pnt->NAME;
187       pnt [biabl_DFN].dat  = bereg_pnt->BIABL;
188       pnt [binode_DFN].dat = bereg_pnt->BINODE;
189 
190       break;
191 
192 	/* ###------------------------------------------------------### */
193 	/*    bemsg							*/
194 	/* ###------------------------------------------------------### */
195 
196     case bemsg_DFN :
197 
198       bemsg_pnt = (struct bemsg *) curpnt.data;
199 
200       typ [next_DFN]    = POINTER_DFN   | s_DFN   | bemsg_DFN;
201       typ [level_DFN]   = IMMEDIATE_DFN | c_DFN   | character_DFN;
202       typ [label_DFN]   = IMMEDIATE_DFN | s_DFN   | string_DFN;
203       typ [message_DFN] = IMMEDIATE_DFN | s_DFN   | string_DFN;
204       typ [abl_DFN]     = IMMEDIATE_DFN | ABL_DFN | abl_DFN;
205       typ [node_DFN]    = POINTER_DFN   | s_DFN   | void_DFN;
206 
207       pnt [next_DFN].dat    = bemsg_pnt->NEXT;
208       pnt [level_DFN].imd   = bemsg_pnt->LEVEL;
209       pnt [label_DFN].dat   = bemsg_pnt->LABEL;
210       pnt [message_DFN].dat = bemsg_pnt->MESSAGE;
211       pnt [abl_DFN].dat     = bemsg_pnt->ABL;
212       pnt [node_DFN].dat    = bemsg_pnt->NODE;
213 
214       break;
215 
216 	/* ###------------------------------------------------------### */
217 	/*    beout							*/
218 	/* ###------------------------------------------------------### */
219 
220     case beout_DFN :
221 
222       beout_pnt = (struct beout *) curpnt.data;
223 
224       typ [next_DFN]    = POINTER_DFN   | s_DFN   | beout_DFN    ;
225       typ [name_DFN]    = IMMEDIATE_DFN | s_DFN   | string_DFN   ;
226       typ [time_DFN]    = IMMEDIATE_DFN | l_DFN   | long_DFN     ;
227       typ [flag_DFN]    = IMMEDIATE_DFN | x_DFN   | character_DFN;
228       typ [abl_DFN]     = IMMEDIATE_DFN | ABL_DFN | abl_DFN      ;
229       typ [node_DFN]    = POINTER_DFN   | s_DFN   | void_DFN     ;
230 
231       pnt [next_DFN].dat    = beout_pnt->NEXT;
232       pnt [name_DFN].dat    = beout_pnt->NAME;
233       pnt [time_DFN].imd    = beout_pnt->TIME;
234       pnt [flag_DFN].imd    = beout_pnt->FLAG;
235       pnt [abl_DFN].dat     = beout_pnt->ABL ;
236       pnt [node_DFN].dat    = beout_pnt->NODE;
237 
238       break;
239 
240 	/* ###------------------------------------------------------### */
241 	/*    bebus							*/
242 	/* ###------------------------------------------------------### */
243 
244     case bebus_DFN :
245 
246       bebus_pnt = (struct bebus *) curpnt.data;
247 
248       typ [next_DFN]    = POINTER_DFN   | s_DFN | bebus_DFN;
249       typ [name_DFN]    = IMMEDIATE_DFN | s_DFN | string_DFN;
250       typ [biabl_DFN]   = POINTER_DFN   | s_DFN | biabl_DFN;
251       typ [binode_DFN]  = POINTER_DFN   | s_DFN | binode_DFN;
252       typ [type_DFN]    = IMMEDIATE_DFN | c_DFN | character_DFN;
253 
254       pnt [next_DFN].dat    = bebus_pnt->NEXT;
255       pnt [name_DFN].dat    = bebus_pnt->NAME;
256       pnt [biabl_DFN].dat   = bebus_pnt->BIABL;
257       pnt [binode_DFN].dat  = bebus_pnt->BINODE;
258       pnt [type_DFN].imd    = bebus_pnt->TYPE;
259 
260       break;
261 
262 	/* ###------------------------------------------------------### */
263 	/*    beaux							*/
264 	/* ###------------------------------------------------------### */
265 
266     case beaux_DFN :
267 
268       beaux_pnt = (struct beaux *) curpnt.data;
269 
270       typ [next_DFN]    = POINTER_DFN   | s_DFN   | beaux_DFN    ;
271       typ [name_DFN]    = IMMEDIATE_DFN | s_DFN   | string_DFN   ;
272       typ [time_DFN]    = IMMEDIATE_DFN | l_DFN   | long_DFN     ;
273       typ [flag_DFN]    = IMMEDIATE_DFN | x_DFN   | character_DFN;
274       typ [abl_DFN]     = IMMEDIATE_DFN | ABL_DFN | abl_DFN      ;
275       typ [node_DFN]    = POINTER_DFN   | s_DFN   | void_DFN     ;
276 
277       pnt [next_DFN].dat    = beaux_pnt->NEXT;
278       pnt [name_DFN].dat    = beaux_pnt->NAME;
279       pnt [time_DFN].imd    = beaux_pnt->TIME;
280       pnt [flag_DFN].imd    = beaux_pnt->FLAG;
281       pnt [abl_DFN].dat     = beaux_pnt->ABL ;
282       pnt [node_DFN].dat    = beaux_pnt->NODE;
283 
284       break;
285 
286 	/* ###------------------------------------------------------### */
287 	/*    bebux							*/
288 	/* ###------------------------------------------------------### */
289 
290     case bebux_DFN :
291 
292       bebux_pnt = (struct bebux *) curpnt.data;
293 
294       typ [next_DFN]    = POINTER_DFN   | s_DFN | bebux_DFN;
295       typ [name_DFN]    = IMMEDIATE_DFN | s_DFN | string_DFN;
296       typ [biabl_DFN]   = POINTER_DFN   | s_DFN | biabl_DFN;
297       typ [binode_DFN]  = POINTER_DFN   | s_DFN | binode_DFN;
298       typ [type_DFN]    = IMMEDIATE_DFN | c_DFN | character_DFN;
299 
300       pnt [next_DFN].dat    = bebux_pnt->NEXT;
301       pnt [name_DFN].dat    = bebux_pnt->NAME;
302       pnt [biabl_DFN].dat   = bebux_pnt->BIABL;
303       pnt [binode_DFN].dat  = bebux_pnt->BINODE;
304       pnt [type_DFN].imd    = bebux_pnt->TYPE;
305 
306       break;
307 
308 	/* ###------------------------------------------------------### */
309 	/*    bepor							*/
310 	/* ###------------------------------------------------------### */
311 
312     case bepor_DFN :
313 
314       bepor_pnt = (struct bepor *) curpnt.data;
315 
316       typ [next_DFN]      = POINTER_DFN   | s_DFN | bepor_DFN;
317       typ [name_DFN]      = IMMEDIATE_DFN | s_DFN | string_DFN;
318       typ [direction_DFN] = IMMEDIATE_DFN | c_DFN | character_DFN;
319       typ [type_DFN]      = IMMEDIATE_DFN | c_DFN | character_DFN;
320 
321       pnt [next_DFN].dat      = bepor_pnt->NEXT;
322       pnt [name_DFN].dat      = bepor_pnt->NAME;
323       pnt [direction_DFN].imd = bepor_pnt->DIRECTION;
324       pnt [type_DFN].imd      = bepor_pnt->TYPE;
325 
326       break;
327 
328 	/* ###------------------------------------------------------### */
329 	/*    biabl							*/
330 	/* ###------------------------------------------------------### */
331 
332     case biabl_DFN :
333 
334       biabl_pnt = (struct biabl *) curpnt.data;
335 
336       typ [next_DFN]      = POINTER_DFN   | s_DFN   | biabl_DFN    ;
337       typ [label_DFN]     = IMMEDIATE_DFN | s_DFN   | string_DFN   ;
338       typ [time_DFN]      = IMMEDIATE_DFN | l_DFN   | long_DFN     ;
339       typ [cndabl_DFN]    = IMMEDIATE_DFN | ABL_DFN | abl_DFN      ;
340       typ [valabl_DFN]    = IMMEDIATE_DFN | ABL_DFN | abl_DFN      ;
341       typ [flag_DFN]      = IMMEDIATE_DFN | x_DFN   | character_DFN;
342       typ [user_DFN]      = POINTER_DFN   | s_DFN   | ptype_DFN    ;
343 
344       pnt [next_DFN].dat   = biabl_pnt->NEXT  ;
345       pnt [label_DFN].dat  = biabl_pnt->LABEL ;
346       pnt [time_DFN].imd   = biabl_pnt->TIME  ;
347       pnt [cndabl_DFN].dat = biabl_pnt->CNDABL;
348       pnt [valabl_DFN].dat = biabl_pnt->VALABL;
349       pnt [flag_DFN].imd   = biabl_pnt->FLAG  ;
350       pnt [user_DFN].dat   = biabl_pnt->USER  ;
351 
352       break;
353 
354 	/* ###------------------------------------------------------### */
355 	/*    binode							*/
356 	/* ###------------------------------------------------------### */
357 
358     case binode_DFN :
359 
360       binode_pnt = (struct binode *) curpnt.data;
361 
362       typ [next_DFN]      = POINTER_DFN   | s_DFN   | binode_DFN   ;
363       typ [time_DFN]      = IMMEDIATE_DFN | l_DFN   | long_DFN     ;
364       typ [flag_DFN]      = IMMEDIATE_DFN | x_DFN   | character_DFN;
365       typ [cndnode_DFN]   = POINTER_DFN   | s_DFN   | void_DFN     ;
366       typ [valnode_DFN]   = POINTER_DFN   | s_DFN   | void_DFN     ;
367 
368       pnt [next_DFN].dat      = binode_pnt->NEXT   ;
369       pnt [time_DFN].imd      = binode_pnt->TIME   ;
370       pnt [flag_DFN].imd      = binode_pnt->FLAG   ;
371       pnt [cndnode_DFN].dat   = binode_pnt->CNDNODE;
372       pnt [valnode_DFN].dat   = binode_pnt->VALNODE;
373 
374       break;
375 
376 	/* ###------------------------------------------------------### */
377 	/*    berin							*/
378 	/* ###------------------------------------------------------### */
379 
380     case berin_DFN :
381 
382       berin_pnt = (struct berin *) curpnt.data;
383 
384       typ [next_DFN]    = POINTER_DFN   | s_DFN | berin_DFN;
385       typ [name_DFN]    = IMMEDIATE_DFN | s_DFN | string_DFN;
386       typ [out_ref_DFN] = POINTER_DFN   | s_DFN | chain_DFN;
387       typ [bus_ref_DFN] = POINTER_DFN   | s_DFN | chain_DFN;
388       typ [aux_ref_DFN] = POINTER_DFN   | s_DFN | chain_DFN;
389       typ [reg_ref_DFN] = POINTER_DFN   | s_DFN | chain_DFN;
390       typ [bux_ref_DFN] = POINTER_DFN   | s_DFN | chain_DFN;
391       typ [msg_ref_DFN] = POINTER_DFN   | s_DFN | chain_DFN;
392       typ [dly_ref_DFN] = POINTER_DFN   | s_DFN | chain_DFN;
393 
394       pnt [next_DFN].dat    = berin_pnt->NEXT;
395       pnt [name_DFN].dat    = berin_pnt->NAME;
396       pnt [out_ref_DFN].dat = berin_pnt->OUT_REF;
397       pnt [bus_ref_DFN].dat = berin_pnt->BUS_REF;
398       pnt [aux_ref_DFN].dat = berin_pnt->AUX_REF;
399       pnt [reg_ref_DFN].dat = berin_pnt->REG_REF;
400       pnt [bux_ref_DFN].dat = berin_pnt->BUX_REF;
401       pnt [msg_ref_DFN].dat = berin_pnt->MSG_REF;
402       pnt [dly_ref_DFN].dat = berin_pnt->DLY_REF;
403 
404       break;
405 
406 	/* ###------------------------------------------------------### */
407 	/*    begen							*/
408 	/* ###------------------------------------------------------### */
409 
410     case begen_DFN :
411 
412       begen_pnt = (struct begen *) curpnt.data;
413 
414       typ [next_DFN]    = POINTER_DFN   | s_DFN | begen_DFN;
415       typ [name_DFN]    = IMMEDIATE_DFN | s_DFN | string_DFN;
416       typ [type_DFN]    = IMMEDIATE_DFN | s_DFN | string_DFN;
417       typ [value_DFN]   = POINTER_DFN   | s_DFN | void_DFN;
418 
419       pnt [next_DFN].dat    = begen_pnt->NEXT;
420       pnt [name_DFN].dat    = begen_pnt->NAME;
421       pnt [type_DFN].dat    = begen_pnt->TYPE;
422       pnt [value_DFN].dat   = begen_pnt->VALUE;
423 
424       break;
425 
426 	/* ###------------------------------------------------------### */
427 	/*    bequad							*/
428 	/* ###------------------------------------------------------### */
429 
430     case bequad_DFN :
431 
432       bequad_pnt = (struct bequad *) curpnt.data;
433 
434       typ [bdd_DFN]      = IMMEDIATE_DFN | BDD_DFN | bdd_DFN;
435       typ [gex_DFN]      = IMMEDIATE_DFN | GEX_DFN | gex_DFN;
436       typ [varlist_DFN]  = POINTER_DFN   | s_DFN   | chain_DFN;
437       typ [derivate_DFN] = POINTER_DFN   | s_DFN   | beder_DFN;
438       typ [user_DFN]     = POINTER_DFN   | s_DFN   | void_DFN;
439 
440       pnt [bdd_DFN].dat      = bequad_pnt->BDD     ;
441       pnt [gex_DFN].dat      = bequad_pnt->GEX     ;
442       pnt [varlist_DFN].dat  = bequad_pnt->VARLIST ;
443       pnt [derivate_DFN].dat = bequad_pnt->DERIVATE;
444       pnt [user_DFN].dat     = bequad_pnt->USER    ;
445 
446       break;
447 
448 	/* ###------------------------------------------------------### */
449 	/*    beder							*/
450 	/* ###------------------------------------------------------### */
451 
452     case beder_DFN :
453 
454       beder_pnt = (struct beder *) curpnt.data;
455 
456       typ [next_DFN]    = POINTER_DFN   | s_DFN   | beder_DFN;
457       typ [bdd_DFN]     = IMMEDIATE_DFN | BDD_DFN | bdd_DFN  ;
458       typ [index_DFN]   = IMMEDIATE_DFN | u_DFN   | short_DFN;
459 
460       pnt [next_DFN].dat    = beder_pnt->NEXT ;
461       pnt [bdd_DFN].dat     = beder_pnt->BDD  ;
462       pnt [index_DFN].imd   = beder_pnt->INDEX;
463 
464       break;
465 
466 	/* ###------------------------------------------------------### */
467 	/*    ptype							*/
468 	/* ###------------------------------------------------------### */
469 
470     case ptype_DFN :
471 
472       ptype_pnt = (struct ptype *) curpnt.data;
473 
474       typ [next_DFN] = POINTER_DFN   | s_DFN | ptype_DFN;
475       typ [data_DFN] = POINTER_DFN   | s_DFN | void_DFN;
476       typ [type_DFN] = IMMEDIATE_DFN | l_DFN | long_DFN;
477 
478       pnt [next_DFN].dat = ptype_pnt->NEXT;
479       pnt [data_DFN].dat = ptype_pnt->DATA;
480       pnt [type_DFN].imd = ptype_pnt->TYPE;
481 
482       break;
483 
484 	/* ###------------------------------------------------------### */
485 	/*    chain							*/
486 	/* ###------------------------------------------------------### */
487 
488     case chain_DFN :
489 
490       chain_pnt = (struct chain *) curpnt.data;
491 
492       typ [next_DFN] = POINTER_DFN | s_DFN | chain_DFN;
493       typ [data_DFN] = POINTER_DFN | s_DFN | void_DFN;
494 
495       pnt [next_DFN].dat = chain_pnt->NEXT;
496       pnt [data_DFN].dat = chain_pnt->DATA;
497 
498       break;
499 
500 	/* ###------------------------------------------------------### */
501 	/*    string							*/
502 	/* ###------------------------------------------------------### */
503 
504     case string_DFN :
505 
506       string_pnt = (char **) curpnt.data;
507 
508       typ [string_DFN]     = IMMEDIATE_DFN | s_DFN | string_DFN;
509       pnt [string_DFN].dat = *string_pnt;
510 
511       break;
512 
513 	/* ###------------------------------------------------------### */
514 	/*    integer							*/
515 	/* ###------------------------------------------------------### */
516 
517     case integer_DFN :
518 
519       int_pnt = (long *) curpnt.data;
520 
521       typ [integer_DFN]     = IMMEDIATE_DFN | d_DFN | integer_DFN;
522       pnt [integer_DFN].imd = *int_pnt;
523 
524       break;
525 
526 	/* ###------------------------------------------------------### */
527 	/*    character							*/
528 	/* ###------------------------------------------------------### */
529 
530     case character_DFN :
531 
532       character_pnt = (char *) curpnt.data;
533 
534       typ [character_DFN]     = IMMEDIATE_DFN | x_DFN | character_DFN;
535       pnt [character_DFN].imd = *character_pnt;
536 
537       break;
538 
539     }
540 
541 	/* ###------------------------------------------------------### */
542 	/*    scan the list of recongnized strings to print those	*/
543 	/* values that are not empty (different form _error_DFN) :	*/
544 	/*								*/
545 	/*   - if it contains an immediate, print it following the	*/
546 	/*     required format						*/
547 	/*								*/
548 	/*   - if it contains a pointer, just print the pointer		*/
549 	/*     indication, ->, and "availbale"				*/
550 	/*								*/
551 	/*   - if it contains an array, just print the array		*/
552 	/*     indication, =>, and "availbale"				*/
553 	/* ###------------------------------------------------------### */
554 
555   for (i=0 ; i<MAXCMD_DFN ; i++)
556     {
557     if ((typ [i] & KIND_DFN) == IMMEDIATE_DFN)
558       {
559       printf ("   %-15s : ", str [i]);
560       switch (typ [i] & FORMAT_DFN)
561         {
562         case s_DFN :
563           if (pnt[i].dat != NULL)
564             printf ("%s", (char*)pnt[i].dat);
565           printf ("\n");
566           break;
567 
568         case u_DFN :
569           printf ("%u\n", (unsigned int)pnt[i].imd);
570           break;
571 
572         case c_DFN :
573           printf ("'%c'\n", (char)pnt[i].imd);
574           break;
575 
576         case d_DFN :
577           printf ("%d\n", (int)pnt[i].imd);
578           break;
579 
580         case l_DFN :
581           printf ("%ld\n", pnt[i].imd);
582           break;
583 
584         case x_DFN :
585           printf ("0x%x\n", (unsigned int)pnt[i].imd);
586           break;
587 
588         case ABL_DFN :
589           if (pnt[i].dat != NULL)
590             {
591             buffer [0] = '\0';
592             buffer = exprToCharInt (pnt[i].dat, 1, buffer, &buff_size);
593             printf ("%s", buffer);
594             }
595           printf ("\n");
596           break;
597 
598         case BDD_DFN :
599           if ((pnt[i].dat != NULL) && (circuit_pnt != NULL))
600             {
601             buffer [0] = '\0';
602             ptr_abl = bddToAbl (pnt[i].dat, circuit_pnt->pNameI);
603             buffer  = exprToCharInt (ptr_abl, 1, buffer, &buff_size);
604             printf ("%s", buffer);
605             }
606           printf ("\n");
607           break;
608 
609         case GEX_DFN :
610           if (pnt[i].dat != NULL)
611             printf ("Gex displayer not yet available\n");
612           break;
613         }
614       }
615 
616     if ((typ [i] & KIND_DFN) == POINTER_DFN)
617       {
618       printf ("-> %-15s : ", str [i]);
619       if (pnt[i].dat != NULL)
620         printf ("available");
621       printf ("\n");
622       }
623 
624     if ( ((typ [i] & KIND_DFN) == ARRAY_DFN   ) ||
625          ((typ [i] & KIND_DFN) == ARYOFPNT_DFN) )
626       {
627       printf ("=> %-15s : ", str [i]);
628       if (pnt[i].dat != NULL)
629         printf ("available");
630       printf ("\n");
631       }
632     }
633 
634   }
635 
636 /* ###--------------------------------------------------------------### */
637 /* function	: splitline						*/
638 /* description	: read a line (the space must have been reserved by the	*/
639 /*		  caller - *words) from the standard input and split it	*/
640 /*		  into seperate words. Return the number of words read.	*/
641 /* called func.	: none							*/
642 /* ###--------------------------------------------------------------### */
643 
splitline(words,line)644 static long splitline (words, line)
645 
646 char **words;
647 char  *line ;
648   {
649 
650   char *heap   = *words;
651   long   new    =  1;
652   long   wrdcnt =  0;
653   long   i      =  0;
654   long   j      =  0;
655 
656 	/* ###------------------------------------------------------### */
657 	/*    copy the line read from input into the words until a	*/
658 	/* space has been found. Then, increment the word count and	*/
659 	/* begin filling the next word					*/
660 	/* ###------------------------------------------------------### */
661 
662   while ((heap[j] = line[i++]) != '\0')
663     {
664     if ((heap[j] != ' ') && (heap[j] != '\t'))
665       {
666       new = 0;
667       j++;
668       }
669     else
670       {
671       if (new != 1)
672         {
673         heap  [j++]      = '\0';
674         words [++wrdcnt] = heap + j;
675         new = 1;
676         }
677       }
678     }
679 
680   if (new != 1)
681     wrdcnt++;
682 
683   return (wrdcnt);
684   }
685 
686 /* ###--------------------------------------------------------------### */
687 /* function	: push							*/
688 /* description	: push a structure on the stack				*/
689 /* called func.	: none							*/
690 /* ###--------------------------------------------------------------### */
691 
push(stk,stkpnt,data,type)692 static void push (stk, stkpnt, data, type)
693 
694 struct stack *stk;
695 long          *stkpnt;
696 void         *data;
697 short         type;
698 
699   {
700   long stkidx = *stkpnt;
701 
702   if (stkidx == STKSIZ_DFN)
703     fprintf (stdout, "beh_debug :\tSTACK OVERFLOW !!\tSTACK OVERFLOW !!\n");
704   else
705     {
706     if (data != NULL)
707       {
708       stkidx++;
709       stk [stkidx].data = data;
710       stk [stkidx].type = type;
711       stk [stkidx].mark = 0;
712       *stkpnt           = stkidx;
713       }
714     else
715       fprintf (stderr ,"cannot push NULL pointer on the stack\n");
716     }
717   }
718 
719 /* ###--------------------------------------------------------------### */
720 /* function	: pop							*/
721 /* description	: pop N structures from the stack			*/
722 /* called func.	: none							*/
723 /* ###--------------------------------------------------------------### */
724 
pop(stkpnt,count)725 static void pop (stkpnt, count)
726 
727 long          *stkpnt;
728 long           count;
729 
730   {
731   long stkidx = *stkpnt;
732 
733   if (stkidx <= count)
734     stkidx = 0;
735   else
736     stkidx -= count;
737 
738   *stkpnt = stkidx;
739   }
740 
741 /* ###--------------------------------------------------------------### */
742 /* function	: goforward						*/
743 /* description	: go forward through the NEXT field to find the Nth	*/
744 /*		  structure in the list and return it			*/
745 /* called func.	: none							*/
746 /* ###--------------------------------------------------------------### */
747 
goforward(pnt,count)748 static struct chain *goforward (pnt, count)
749 
750 struct chain *pnt;
751 long           count;
752 
753   {
754   while ((count > 0) && (pnt != NULL) && (pnt->NEXT != NULL))
755     {
756     pnt = pnt->NEXT;
757     count--;
758     }
759   return (pnt);
760   }
761 
762 /* ###--------------------------------------------------------------### */
763 /* function	: translate						*/
764 /* description	: find the index of each word read from the command	*/
765 /*		  line. For each word check if it is a number. Return	*/
766 /*		  the index of the first word.				*/
767 /* called func.	: none							*/
768 /* ###--------------------------------------------------------------### */
769 
translate(words,wrdcnt,strgs,nmbrs,flags,indxs)770 static long translate (words, wrdcnt, strgs, nmbrs, flags, indxs)
771 
772 char **words;				/* list of words		*/
773 long    wrdcnt;				/* number of words		*/
774 char **strgs;				/* list of recognized strings	*/
775 long   *nmbrs;				/* words translated to numbers	*/
776 char  *flags;				/* set if word is a number	*/
777 long   *indxs;				/* words' index in strgs table	*/
778 
779   {
780   long i , j;
781 
782 	/* ###------------------------------------------------------### */
783 	/*    initialize flags and indxs				*/
784 	/* ###------------------------------------------------------### */
785 
786   for (i=0 ; i<10 ; i++)
787     {
788     flags [i] = 0;
789     indxs [i] = _error_DFN;
790     }
791 
792 	/* ###------------------------------------------------------### */
793 	/*    for each word :						*/
794 	/*      - check if it is a number				*/
795 	/*      - try to locate the word among the recognized strings.	*/
796 	/*        If found register it's index				*/
797 	/* ###------------------------------------------------------### */
798 
799   for (i=0 ; i<wrdcnt ; i++)
800     {
801     flags [i] = sscanf (words [i], "%11ld", &nmbrs [i]);
802     for (j=0; j<MAXCMD_DFN ; j++)
803       {
804       if (!strcmp (strgs [j], words [i]))
805         {
806         indxs [i] = j;
807         break;
808         }
809       }
810     }
811   return (indxs [0]);
812   }
813 
getsize(siz)814 static void getsize (siz)
815 
816 unsigned long siz [];
817 
818   {
819   long i;
820 
821   for (i=0 ; i<MAXCMD_DFN ; i++)
822     siz [i] = 0;
823 
824 
825   siz [character_DFN] = sizeof (char);
826   siz [short_DFN]     = sizeof (short);
827   siz [integer_DFN]   = sizeof (int);
828   siz [long_DFN]      = sizeof (long);
829   siz [string_DFN]    = sizeof (char *);
830 
831   siz [chain_DFN]     = sizeof (struct chain);
832   siz [ptype_DFN]     = sizeof (struct ptype);
833 
834   siz [befig_DFN]     = sizeof (struct befig);
835   siz [bereg_DFN]     = sizeof (struct bereg);
836   siz [bemsg_DFN]     = sizeof (struct bemsg);
837   siz [berin_DFN]     = sizeof (struct berin);
838   siz [beout_DFN]     = sizeof (struct beout);
839   siz [bebus_DFN]     = sizeof (struct bebus);
840   siz [beaux_DFN]     = sizeof (struct beaux);
841   siz [bedly_DFN]     = sizeof (struct beaux);
842   siz [bebux_DFN]     = sizeof (struct bebux);
843   siz [bepor_DFN]     = sizeof (struct bepor);
844   siz [begen_DFN]     = sizeof (struct begen);
845   siz [biabl_DFN]     = sizeof (struct biabl);
846   siz [binode_DFN]    = sizeof (struct binode);
847   siz [bequad_DFN]    = sizeof (struct bequad);
848   siz [beder_DFN]     = sizeof (struct beder);
849   }
850 
851 /* ###--------------------------------------------------------------### */
852 /* function	: disp_immd						*/
853 /* description	: display a specific field as an immediate		*/
854 /* called func.	: none							*/
855 /* ###--------------------------------------------------------------### */
856 
disp_immd(str,pnt,type)857 static void disp_immd (str, pnt, type)
858 
859 char        **str;
860 union value pnt  ;
861 long         type ;
862 
863   {
864   struct chain *ptr_abl         ;
865 
866   printf ("   %-15s: ", str [type]);
867   switch (type)
868     {
869     case string_DFN :
870       if (((char *) pnt.dat) != NULL)
871         printf ("%s", (char *) pnt.dat);
872       printf ("\n");
873       break;
874 
875     case character_DFN :
876       printf ("%c\n", (char)pnt.imd);
877       break;
878 
879     case short_DFN     :
880     case integer_DFN   :
881     case long_DFN      :
882       printf ("0x%x\n", (unsigned int)pnt.imd);
883       break;
884 
885     case abl_DFN :
886       if (pnt.dat != NULL)
887         {
888         buffer [0] = '\0';
889         buffer = exprToCharInt (pnt.dat, 1, buffer, &buff_size);
890         printf ("%s", buffer);
891         }
892       printf ("\n");
893       break;
894 
895     case bdd_DFN :
896       if ((pnt.dat != NULL) && (circuit_pnt != NULL))
897         {
898         buffer [0] = '\0';
899         ptr_abl = bddToAbl (pnt.dat, circuit_pnt->pNameI);
900         buffer  = exprToCharInt (ptr_abl, 1, buffer, &buff_size);
901         printf ("%s", buffer);
902         }
903       printf ("\n");
904       break;
905 
906     case gex_DFN :
907       if (pnt.dat != NULL)
908         printf ("Gex displayer not yet available\n");
909       break;
910 
911     default :
912       fprintf (stderr ,"unrecognized command\n");
913     }
914   }
915 
916 
917 /* ###--------------------------------------------------------------### */
918 /* function	: beh_debug						*/
919 /* description	: dispaly any mad structure				*/
920 /* called func.	: goforward, translate, dispaly, splitline, pop, push	*/
921 /* ###--------------------------------------------------------------### */
922 
beh_debug(head_pnt,type)923 void beh_debug (head_pnt, type)
924 
925 void *head_pnt;				/* structure's pointer		*/
926 char *type;				/* structure's type		*/
927 
928   {
929   size_t        lline       = 128;
930   char*         line        ;		/* buffer to read a cmd line	*/
931   char          heap   [lline];		/* buffer to split the cmd line	*/
932 
933   char         *words  [ 10];		/* number of words on a line	*/
934   long           nmbrs  [ 10];		/* words translated into number	*/
935   char          flags  [ 10];		/* set if words is a number	*/
936   long           indxs  [ 10];		/* index of words		*/
937 
938   struct stack  jtab   [ 10];		/* list of memorized addresses	*/
939   long           idx;
940   long           dispflg = 0;
941   unsigned long  size;
942   char         *pntr   = NULL;
943   long          pshtype;
944   long           wrdcnt;
945 
946   struct stack  stk [STKSIZ_DFN];
947   long           stkpnt = -1;
948 
949   union value   pnt [MAXCMD_DFN];
950   long          typ [MAXCMD_DFN];
951   unsigned long  siz [MAXCMD_DFN];
952 
953   static char  *str [] = {
954                           "_back"    , "_exit"    , "_jump"    , "_save"    ,
955                           "_stop"    , "_top"     , "_up"      , "_display" ,
956 
957                           "character", "short"    , "integer"  , "long"     ,
958                           "void"     , "string"   ,
959                           "chain"    , "ptype"    , "befig"    , "bereg"    ,
960                           "bemsg"    , "berin"    , "beout"    , "bebus"    ,
961                           "beaux"    , "bedly"    , "bebux"    , "bepor"    ,
962                           "begen"    , "biabl"    , "binode"   , "bequad"   ,
963                           "beder"    ,
964                           "next"     , "name"     , "user"     , "errflg"   ,
965                           "type"     , "level"    , "label"    , "message"  ,
966                           "abl"      , "node"     , "direction", "cndabl"   ,
967                           "valabl"   , "cndnode"  , "valnode"  , "out_ref"  ,
968                           "bus_ref"  , "aux_ref"  , "reg_ref"  , "bux_ref"  ,
969                           "msg_ref"  , "dly_ref"  , "value"    , "data"     ,
970                           "time"     , "bdd"      , "gex"      , "varlist"  ,
971                           "derivate" , "index"    , "flag"     , "time_unit",
972                           "time_step"
973                           };
974 
975 	/* ###------------------------------------------------------### */
976 	/*    initialisation :						*/
977 	/*    - allocate a buffer for read words			*/
978 	/*    - break the argument that identifies the structure (type)	*/
979 	/*      into words						*/
980 	/*    - search that words among recognized strings		*/
981 	/* ###------------------------------------------------------### */
982 
983   line = (char*)malloc( lline*sizeof(char) );
984   words [0] = heap;
985   getsize (siz);
986 
987   wrdcnt        = splitline (words, type);
988   idx           = translate (words, wrdcnt, str, nmbrs, flags, indxs);
989 
990   typ [idx]     = POINTER_DFN | s_DFN | idx;
991   pnt [idx].dat = head_pnt;
992 
993 	/* ###------------------------------------------------------### */
994 	/*    process the command line until the _exit command		*/
995 	/* ###------------------------------------------------------### */
996 
997   while ((idx & TYPE_DFN) != _exit_DFN)
998     {
999 	/* ###------------------------------------------------------### */
1000 	/*    if the first word of the line has not been recognized,	*/
1001 	/* print an error message. Otherwise, proccess the command line	*/
1002 	/* (generally it is a request for displaying a specific field).	*/
1003 	/*								*/
1004 	/* At this point :						*/
1005 	/*    - pnt [] contains all available pointers			*/
1006 	/*    - typ [] contains the type of availabale pointers		*/
1007 	/* ###------------------------------------------------------### */
1008 
1009     if (idx == _error_DFN)
1010       fprintf (stderr ,"unrecognized command\n");
1011     else
1012       {
1013 
1014 	/* ###------------------------------------------------------### */
1015 	/*    define the type of the structure that may be pushed on	*/
1016 	/* the stack :							*/
1017 	/*    - if the pointer is a VOID pointer the exact type must be	*/
1018 	/*      defined on the command line (last word of the command)	*/
1019 	/* ###------------------------------------------------------### */
1020 
1021       pshtype = POINTER_DFN | s_DFN | void_DFN;
1022       if ((typ [idx] & TYPE_DFN) == void_DFN)
1023         {
1024         if ((wrdcnt >= 2) && (indxs [wrdcnt - 1] != _error_DFN))
1025           pshtype = POINTER_DFN | s_DFN | indxs [wrdcnt - 1];
1026         else
1027           fprintf (stderr ,"structure has unknown type (void *)\n");
1028         }
1029       else
1030        pshtype = typ [idx];
1031 
1032 	/* ###------------------------------------------------------### */
1033 	/*    depending on the kind of the first word of the command	*/
1034 	/* activate actions :						*/
1035 	/*    - COMMAND (_top, _up, ...)				*/
1036 	/*    - POINTER							*/
1037 	/*        - for NEXT go forward until the Nth element of the	*/
1038 	/*          list. Then, push it on the stack and dispaly it	*/
1039 	/*        - for others push and display				*/
1040 	/*    - ARRAY							*/
1041 	/*        - push and display the Nth element of the array	*/
1042 	/* ###------------------------------------------------------### */
1043 
1044       switch (typ [idx] & KIND_DFN)
1045         {
1046 
1047         case COMMAND_DFN :
1048           switch (typ [idx] & TYPE_DFN)
1049             {
1050 	/* ###------------------------------------------------------### */
1051 	/*    _top COMMAND : reset the stack pointer, call read_field	*/
1052 	/* to read the structure on the top of stack			*/
1053 	/* ###------------------------------------------------------### */
1054 
1055             case _top_DFN :
1056               stkpnt  = 0;
1057               dispflg = 1;
1058               break;
1059 
1060 	/* ###------------------------------------------------------### */
1061 	/*    _stop COMMAND : set the stop mark for the structure on	*/
1062 	/* the top of stack						*/
1063 	/* ###------------------------------------------------------### */
1064 
1065             case _stop_DFN :
1066               stk [stkpnt].mark = 1;
1067               fprintf (stdout, "beh_debug : stop mark set\n");
1068               break;
1069 
1070 	/* ###------------------------------------------------------### */
1071 	/*    _back COMMAND : pop structures from the stack until a	*/
1072 	/* marked structure is found. Call read_field to read the	*/
1073 	/* structure on the top of stack				*/
1074 	/* ###------------------------------------------------------### */
1075 
1076             case _back_DFN :
1077               while ((stkpnt != 0) && (stk[--stkpnt].mark != 1));
1078               dispflg = 1;
1079               break;
1080 
1081 	/* ###------------------------------------------------------### */
1082 	/*    _jump COMMAND : push on the stack the structure saved in	*/
1083 	/* the jump table. Call read_field to read the structure on the	*/
1084 	/* top of stack							*/
1085 	/* ###------------------------------------------------------### */
1086 
1087             case _jump_DFN :
1088               if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
1089                 {
1090                 push (stk, &stkpnt, jtab[nmbrs[1]].data, jtab[nmbrs[1]].type);
1091                 dispflg = 1;
1092                 }
1093               else
1094                 fprintf (stderr ,"unrecognized command\n");
1095               break;
1096 
1097 	/* ###------------------------------------------------------### */
1098 	/*    _up COMMAND : pop structure from the stack. Call		*/
1099 	/* read_field to read the structure on the top of stack		*/
1100 	/* ###------------------------------------------------------### */
1101 
1102             case _up_DFN :
1103               if (wrdcnt == 1)
1104                 {
1105                 pop (&stkpnt, 1);
1106                 dispflg = 1;
1107                 }
1108               else
1109                 {
1110                 if ((wrdcnt == 2) && (flags [1] == 1))
1111                   {
1112                   pop (&stkpnt, nmbrs [1] + 1);
1113                   dispflg = 1;
1114                   }
1115                 else
1116                   fprintf (stderr ,"unrecognized command\n");
1117                 }
1118               break;
1119 
1120 	/* ###------------------------------------------------------### */
1121 	/*    _save COMMAND : save the structure on the top of stack in	*/
1122 	/* the jump table						*/
1123 	/* ###------------------------------------------------------### */
1124 
1125             case _save_DFN :
1126               if ((wrdcnt == 2) && (flags [1] == 1) && (nmbrs [1] < 10))
1127                 jtab [nmbrs[1]] = stk [stkpnt];
1128               else
1129                 fprintf (stderr ,"unrecognized command\n");
1130               break;
1131 
1132 	/* ###------------------------------------------------------### */
1133 	/*    _display COMMAND : display a specified field as an	*/
1134 	/* immediate							*/
1135 	/* ###------------------------------------------------------### */
1136 
1137             case _display_DFN :
1138               if ((wrdcnt == 3) && (indxs [1] != _error_DFN))
1139                 disp_immd (str, pnt [indxs [1]], indxs [2]);
1140               else
1141                 fprintf (stderr ,"unrecognized command\n");
1142               break;
1143 
1144             }
1145           break;
1146 
1147         case POINTER_DFN :
1148           if (idx == next_DFN)
1149             {
1150             if ((wrdcnt == 1) || ((wrdcnt == 2) && (flags [1] == 0)))
1151               {
1152               push (stk, &stkpnt, pnt [idx].dat, pshtype);
1153               dispflg = 1;
1154               }
1155             else
1156               {
1157               if (((wrdcnt == 3) || (wrdcnt == 2)) && (flags [1] == 1))
1158                 {
1159                 pnt [idx].dat = (void *) goforward (pnt [idx].dat, nmbrs [1]);
1160                 push (stk, &stkpnt, pnt [idx].dat, pshtype);
1161                 dispflg = 1;
1162                 }
1163               else
1164                 fprintf (stderr ,"unrecognized command\n");
1165               }
1166             }
1167           else
1168             {
1169             push (stk, &stkpnt, pnt [idx].dat, pshtype);
1170             dispflg = 1;
1171             }
1172           break;
1173 
1174         case ARRAY_DFN :
1175           if ((wrdcnt > 1) && (flags [1] == 1))
1176             {
1177             size = siz [(typ [idx] & TYPE_DFN)];
1178             pntr = (void *)
1179                    (((unsigned long) pnt [idx].dat) + (size * nmbrs [1]));
1180             push (stk, &stkpnt, pntr, pshtype);
1181             dispflg = 1;
1182             }
1183           else
1184             fprintf (stderr ,"unrecognized command\n");
1185           break;
1186 
1187         case ARYOFPNT_DFN :
1188           if ((wrdcnt > 1) && (flags [1] == 1))
1189             {
1190             size = sizeof (void *);
1191             pntr = * (void **)
1192                      (((unsigned long) pnt [idx].dat) + (size * nmbrs [1]));
1193             push (stk, &stkpnt, pntr, pshtype);
1194             dispflg = 1;
1195             }
1196           else
1197             fprintf (stderr ,"unrecognized command\n");
1198           break;
1199 
1200         }
1201 
1202       if (dispflg == 1)
1203         {
1204         dispflg = 0;
1205         display (stk [stkpnt], pnt, typ, str);
1206         }
1207 
1208       }
1209 
1210     printf ("\n\nCOMMAND > ");
1211 
1212     getline (&line, &lline, stdin);
1213     if (strcmp (line ,"."))
1214       {
1215       wrdcnt = splitline (words, line);
1216       idx    = translate (words, wrdcnt, str, nmbrs, flags, indxs);
1217       }
1218     }
1219     free (line);
1220 
1221   }
1222