2 * This file is part of the Alliance CAD System
3 * Copyright (C) Laboratoire LIP6 - Département ASIM
4 * Universite Pierre et Marie Curie
6 * Home page : http://www-asim.lip6.fr/alliance/
7 * E-mail support : mailto:alliance-support@asim.lip6.fr
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.
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
24 /*******************************************************************************
27 * Author(s) : Gregoire AVOT *
28 * Updates : June, 12th 1998 *
29 * Updates : June, 30th 1998 Create unique name on losig where no one *
32 *******************************************************************************/
46 /******************************************************************************/
48 #define MAL_CON 0x00000001
49 #define MAL_INS 0x00000002
50 #define MAL_TRS 0x00000004
51 #define MAL_WIR 0x00000008
52 #define MAL_CAP 0x00000010
53 #define MAL_CTC 0x00000020
54 #define MAL_SIG 0x00000040
55 #define MAL_EOF 0x00000080
56 #define MAL_HEA 0x00000100
58 /* Tampon de lecture */
59 #define MALBUFMAX 524288
61 /* ptype sur losig -> verification unicite du signal */
62 #define MALDEFINED 11223344
64 /* ptype sur losig -> nom unique */
65 #define SIGHT 199806301
78 char *insname
; /* namealloc */
79 char *modelename
; /* namealloc */
80 chain_list
*interface
;
83 /******************************************************************************/
85 int nbitem
__P(( chain_list
* ));
86 char decode_dir
__P(( char*, char*, int ));
87 char decode_type
__P(( char*, char*, int ));
88 losig_list
* decode_sig
__P(( lofig_list
*, chain_list
*, char*, int,
91 lotrs_list
* decode_trs
__P(( lofig_list
*, chain_list
*, char*, int,
94 int decode_int
__P(( char*, char*, int ));
95 double decode_float
__P(( char*, char*, int ));
96 data_locon
* decode_locon
__P(( lofig_list
*, chain_list
*, char*, int ));
97 lowire_list
* decode_lowire
__P(( losig_list
*, chain_list
*, char*, int ));
98 loctc_list
* decode_loctc
__P(( lofig_list
*, chain_list
*, char*, int ));
99 float decode_capa
__P(( losig_list
*, chain_list
*, char*, int ));
100 int type_line
__P(( chain_list
*, char*, int ));
101 chain_list
* read_line
__P(( FILE*, char*, int ));
102 void free_line
__P(( chain_list
* ));
103 void mal_error
__P((char *,...));
104 void chk_header
__P(( chain_list
*, char*, int ));
105 unsigned char decode_layer
__P(( char*, char*, int ));
106 data_loins
* decode_ins
__P(( chain_list
*, char*, int ));
107 loins_list
* end_ins
__P(( lofig_list
*, lofig_list
**, data_loins
*,
110 void complete_ins
__P(( lofig_list
*, data_loins
*, chain_list
*,
114 /*** Macro and function for debug *********************************************/
116 /* Set the define 'ALDEBUG' will ENABLE debug mode */
123 chain_list
* al_dbg_addchain
124 __P(( chain_list
*, void*, int ));
125 void al_dbg_freechain
126 __P(( chain_list
* ));
129 void al_dbg_init
__P(( void ));
131 #define ALMAXCHAIN 1024
133 chain_list
* al_chain_pt
[ALMAXCHAIN
];
134 int al_chain_lg
[ALMAXCHAIN
];
136 #define al_addchain( a, b ) al_dbg_addchain( a, b, __LINE__ )
137 #define al_freechain( a ) al_dbg_freechain( a )
141 #define al_addchain( a, b ) addchain( a, b )
142 #define al_freechain( a ) freechain( a )
146 /******************************************************************************/
154 for( scan
= head
, count
= 0 ; scan
; scan
= scan
->NEXT
, count
++ );
158 /******************************************************************************/
160 char decode_dir( elem
, fname
, mal_line
)
165 if( strcasecmp( elem
, "IN" ) == 0 ) return( 'I' );
166 if( strcasecmp( elem
, "OUT" ) == 0 ) return( 'O' );
167 if( strcasecmp( elem
, "INOUT" ) == 0 ) return( 'B' );
168 if( strcasecmp( elem
, "UNKNOWN" ) == 0 ) return( 'X' );
169 if( strcasecmp( elem
, "TRISTATE" ) == 0 ) return( 'Z' );
170 if( strcasecmp( elem
, "TRANSCV" ) == 0 ) return( 'T' );
172 mal_error( fname
, mal_line
, "Bad direction [%s] for connector.\n", elem
);
178 /******************************************************************************/
180 char decode_type( elem
, fname
, mal_line
)
185 if( strcasecmp( elem
, "INTERNAL" ) == 0 ) return( 'I' );
186 if( strcasecmp( elem
, "EXTERNAL" ) == 0 ) return( 'E' );
188 mal_error( fname
, mal_line
, "Bad type [%s] for connector.\n", elem
);
194 /******************************************************************************/
196 float decode_capa( ptsig
, line
, fname
, mal_line
)
204 if( nbitem( line
) != 1 )
205 mal_error( fname
, mal_line
, "Bad number of argument.\n");
210 capa
= (float)decode_float( (char*) line
->DATA
, fname
, mal_line
);
211 rcn_addcapa( ptsig
, capa
);
216 /******************************************************************************/
218 data_loins
* decode_ins( line
, fname
, mal_line
)
225 if( nbitem( line
) != 2 )
226 mal_error( fname
, mal_line
, "Bad number of argument.\n");
228 newins
= (data_loins
*) mbkalloc( sizeof( data_loins
) );
229 newins
->modelename
= namealloc( (char*) line
->DATA
);
230 newins
->insname
= namealloc( (char*) line
->NEXT
->DATA
);
231 newins
->interface
= NULL
;
236 /******************************************************************************/
238 lotrs_list
* decode_trs( ptfig
, line
, fname
, mal_line
, version
)
268 /* Version 4 : type L W D G S XS XD PS PD X Y
269 * Version 5 : type L W D G S XS XD PS PD X Y [ nd ng ns ]
270 * Version 6 : type L W D G S B XS XD PS PD X Y [ nd ng ns nb ] nom
273 if( ( version
== 6 && n
!= 14 && n
!= 18 ) ||
274 ( version
== 5 && n
!= 12 && n
!= 15 ) ||
275 ( version
== 4 && n
!= 12 ) )
276 mal_error( fname
, mal_line
, "Bad number of element (%d).\n", n
);
279 if( strcasecmp( (char*)line
->DATA
, "P" ) == 0 ) type
= TRANSP
;
280 if( strcasecmp( (char*)line
->DATA
, "N" ) == 0 ) type
= TRANSN
;
284 "Unknown transistor type [%s].\n",
289 l
= decode_float( (char*)line
->DATA
, fname
, mal_line
) * (double)SCALE_X
;
292 w
= decode_float( (char*)line
->DATA
, fname
, mal_line
) * (double)SCALE_X
;
295 drain
= givelosig( ptfig
, decode_int( (char*)line
->DATA
, fname
, mal_line
) );
298 grid
= givelosig( ptfig
, decode_int( (char*)line
->DATA
, fname
, mal_line
) );
301 source
= givelosig( ptfig
, decode_int( (char*)line
->DATA
, fname
, mal_line
) );
308 n
= decode_int( (char*)line
->DATA
, fname
, mal_line
);
310 bulk
= givelosig( ptfig
, n
);
315 xs
= decode_float( (char*)line
->DATA
, fname
, mal_line
) * (double)SCALE_X
;
318 xd
= decode_float( (char*)line
->DATA
, fname
, mal_line
) * (double)SCALE_X
;
321 ps
= decode_float( (char*)line
->DATA
, fname
, mal_line
) * (double)SCALE_X
;
324 pd
= decode_float( (char*)line
->DATA
, fname
, mal_line
) * (double)SCALE_X
;
327 x
= decode_float( (char*)line
->DATA
, fname
, mal_line
) * (double)SCALE_X
;
330 y
= decode_float( (char*)line
->DATA
, fname
, mal_line
) * (double)SCALE_X
;
338 if( version
== 5 || version
== 6 )
340 if( line
&& line
->NEXT
) /* 3 or 4 physicals node are coming */
342 phdrain
= decode_int( (char*)line
->DATA
, fname
, mal_line
);
345 phgrid
= decode_int( (char*)line
->DATA
, fname
, mal_line
);
348 phsource
= decode_int( (char*)line
->DATA
, fname
, mal_line
);
353 phbulk
= decode_int( (char*)line
->DATA
, fname
, mal_line
);
362 name
= namealloc( (char*)line
->DATA
);
366 pttrs
= addlotrs( ptfig
, type
, x
, y
, w
, l
, ps
, pd
, xs
, xd
,
367 grid
, source
, drain
, bulk
,
373 if( !pttrs
->DRAIN
->SIG
->PRCN
)
374 addlorcnet( pttrs
->DRAIN
->SIG
);
376 setloconnode( pttrs
->DRAIN
, phdrain
);
381 if( !pttrs
->GRID
->SIG
->PRCN
)
382 addlorcnet( pttrs
->GRID
->SIG
);
384 setloconnode( pttrs
->GRID
, phgrid
);
389 if( !pttrs
->SOURCE
->SIG
->PRCN
)
390 addlorcnet( pttrs
->SOURCE
->SIG
);
392 setloconnode( pttrs
->SOURCE
, phsource
);
397 if( !pttrs
->BULK
->SIG
->PRCN
)
398 addlorcnet( pttrs
->BULK
->SIG
);
400 setloconnode( pttrs
->BULK
, phbulk
);
406 /******************************************************************************/
408 void complete_ins( ptfig
, ins
, line
, fname
, mal_line
)
417 ptcon
= decode_locon( ptfig
, line
, fname
, mal_line
);
418 ptcon
->name
= namealloc( ptcon
->name
);
420 ins
->interface
= al_addchain( ins
->interface
, ptcon
);
423 /******************************************************************************/
425 loctc_list
* decode_loctc( ptfig
, line
, fname
, mal_line
)
439 if( nbitem( line
) != 5 )
440 mal_error( fname
, mal_line
, "Bad number of argument.\n");
442 capa
= (float)decode_float( (char*)line
->DATA
, fname
, mal_line
);
445 idxsig1
= decode_int( (char*)line
->DATA
, fname
, mal_line
);
448 node1
= decode_int( (char*)line
->DATA
, fname
, mal_line
);
451 idxsig2
= decode_int( (char*)line
->DATA
, fname
, mal_line
);
454 node2
= decode_int( (char*)line
->DATA
, fname
, mal_line
);
457 ptsig1
= givelosig( ptfig
, idxsig1
);
458 ptsig2
= givelosig( ptfig
, idxsig2
);
461 addlorcnet( ptsig1
);
464 addlorcnet( ptsig2
);
466 return( addloctc( ptsig1
, node1
, ptsig2
, node2
, capa
) );
469 /******************************************************************************/
471 lowire_list
* decode_lowire( ptsig
, line
, fname
, mal_line
)
491 if( nbitem( line
) != 9 )
492 mal_error( fname
, mal_line
, "Bad number of argument.\n" );
497 n1
= decode_int( line
->DATA
, fname
, mal_line
);
500 n2
= decode_int( line
->DATA
, fname
, mal_line
);
506 r
= (float)decode_float( line
->DATA
, fname
, mal_line
);
509 c
= (float)decode_float( line
->DATA
, fname
, mal_line
);
512 x
= (float)decode_float( line
->DATA
, fname
, mal_line
);
515 y
= (float)decode_float( line
->DATA
, fname
, mal_line
);
518 dx
= (float)decode_float( line
->DATA
, fname
, mal_line
);
521 dy
= (float)decode_float( line
->DATA
, fname
, mal_line
);
529 return( addlowire( ptsig
, 0, r
, c
, n1
, n2
) );
532 /******************************************************************************/
534 losig_list
* decode_sig( ptfig
, line
, fname
, mal_line
, version
)
548 char *ptallocsigname
;
553 if( ( nbitem( line
) < 2 && version
== 6 ) ||
554 ( nbitem( line
) < 3 && version
== 5 ) ||
555 ( nbitem( line
) < 3 && version
== 4 )
557 mal_error( fname
, mal_line
, "Incomplete line.\n" );
559 idx
= decode_int( (char*)line
->DATA
, fname
, mal_line
);
561 ptsig
= givelosig( ptfig
, idx
);
563 if( getptype( ptsig
->USER
, MALDEFINED
) )
564 mal_error( fname
, mal_line
, "Signal %d yet defined.\n", idx
);
566 type
= decode_type( (char*)line
->DATA
, fname
, mal_line
);
571 if( version
== 5 || version
== 4 )
576 capa
= (float)decode_float( (char*) line
->DATA
, fname
, mal_line
);
577 rcn_addcapa( ptsig
, capa
);
582 htsigname
= (ht
*) ( getptype( ptfig
->USER
, SIGHT
)->DATA
);
586 for( ; line
; line
= line
->NEXT
)
588 ptsig
->NAMECHAIN
= addchain( ptsig
->NAMECHAIN
,
589 namealloc( (char*) line
->DATA
)
591 addhtitem( htsigname
, ptsig
->NAMECHAIN
->DATA
, 1 );
596 /* Le parser al ajoute un nom si le signal n'en possede pas deja.
597 * Bizare : ce n'est pas au parser de faire ce boulot.
600 sprintf( signame
, "mbk_sig%ld", ptsig
->INDEX
);
601 ptallocsigname
= namealloc( signame
) ;
603 if( gethtitem( htsigname
, ptallocsigname
) != EMPTYHT
)
605 /* En theorie, sur 11 caracteres, on arrive a 3E15 pour index.
606 * En pratique, on s'en fout.
613 sprintf( signame
, "mbk_sig012345" );
616 for( i
= 5 ; i
>= 0 ; i
-- )
618 signame
[12-i
] = k
/ j
+ 'a' ;
619 k
= k
- ( ( k
/ j
) * j
) ;
622 ptallocsigname
= namealloc( signame
) ;
625 while( gethtitem( htsigname
, ptallocsigname
) != EMPTYHT
);
628 ptsig
->NAMECHAIN
= addchain( ptsig
->NAMECHAIN
, ptallocsigname
);
629 addhtitem( htsigname
, ptsig
->NAMECHAIN
->DATA
, 1 );
632 ptsig
->USER
= addptype( ptsig
->USER
, MALDEFINED
, (void*)1 );
636 /******************************************************************************/
638 int decode_int( elem
, fname
, mal_line
)
646 v
= strtol( elem
, &stop
, 10 );
649 mal_error( fname
, mal_line
, "Not an integer [%s].\n", elem
);
654 /******************************************************************************/
656 double decode_float( elem
, fname
, mal_line
)
664 v
= strtod( elem
, &stop
);
667 mal_error( fname
, mal_line
, "Not a float [%s].\n", elem
);
672 /******************************************************************************/
674 data_locon
* decode_locon( ptfig
, line
, fname
, mal_line
)
682 newcon
= (data_locon
*) mbkalloc( sizeof( data_locon
) );
684 if( nbitem( line
) < 4 )
685 mal_error( fname
, mal_line
, "Bad description of connector.\n" );
687 newcon
->name
= (char*) line
->DATA
;
690 newcon
->dir
= decode_dir( (char*) line
->DATA
, fname
, mal_line
);
693 newcon
->type
= decode_type( (char*) line
->DATA
, fname
, mal_line
);
697 if( ptfig->MODE != 'C' )
700 newcon
->ptsig
= givelosig( ptfig
, decode_int( (char*) line
->DATA
,
706 newcon
->ptsig
->TYPE
= 'E';
713 newcon
->phcon
= NULL
;
714 for( ; line
; line
= line
->NEXT
)
715 newcon
->phcon
= addnum( newcon
->phcon
,
716 decode_int( (char*) line
->DATA
, fname
, mal_line
)
722 /******************************************************************************/
724 int type_line( head
, fname
, mal_line
)
731 type
= (char*) head
->DATA
;
733 if( strcasecmp( type
, "H" ) == 0 ) return ( MAL_HEA
);
734 if( strcasecmp( type
, "S" ) == 0 ) return ( MAL_SIG
);
735 if( strcasecmp( type
, "I" ) == 0 ) return ( MAL_INS
);
736 if( strcasecmp( type
, "C" ) == 0 ) return ( MAL_CON
);
737 if( strcasecmp( type
, "W" ) == 0 ) return ( MAL_WIR
);
738 if( strcasecmp( type
, "Q" ) == 0 ) return ( MAL_CAP
);
739 if( strcasecmp( type
, "K" ) == 0 ) return ( MAL_CTC
);
740 if( strcasecmp( type
, "T" ) == 0 ) return ( MAL_TRS
);
741 if( strcasecmp( type
, "EOF" ) == 0 ) return ( MAL_EOF
);
743 mal_error( fname
, mal_line
, "Unknown element [%s].\n", type
);
749 /******************************************************************************/
751 chain_list
* read_line( df
, fname
, mal_line
)
756 char buffer
[MALBUFMAX
];
757 char word
[MALBUFMAX
];
767 if( fgets( buffer
, MALBUFMAX
, df
) == NULL
)
768 mal_error( fname
, mal_line
, "Error when reading input file.\n" );
771 mal_error( fname
, mal_line
, "End of file before end of parsing.\n" );
773 lg
= strlen( buffer
);
775 if( lg
== MALBUFMAX
-1 )
776 mal_error( fname
, mal_line
, "Line exceed %d characters.\n", MALBUFMAX
);
780 if( buffer
[lg
-1] != '\n' )
783 fprintf( stderr
, "Ligne non terminee par '\\n'.\n" );
784 fprintf( stderr
, "\"%s\"\n", buffer
);
790 /* En tete de ligne : soit 'EOF', soit 'X '. L'espace apres le X est le
791 * seul qui doit etre pris en compte comme separateur. */
792 if( lg
== 4 && strcmp( "EOF\n", buffer
)==0 )
794 elem
= (char*)mbkalloc( sizeof(char) * 4 );
795 strncpy( elem
, buffer
, 3 );
797 decomp
= al_addchain( decomp
, elem
);
801 /* decode le premier argument de type 'X ' */
802 if( buffer
[1] != ' ' )
803 mal_error( fname
, mal_line
, "Bad type of line.\n" );
805 elem
= (char*)mbkalloc( sizeof(char) * 2 );
808 decomp
= al_addchain( decomp
, elem
);
810 /* Decode le reste de la ligne */
812 for( i
=2; i
<lg
; i
++ )
814 if( ( buffer
[i
] >= 'A' && buffer
[i
] <= 'Z' ) ||
815 ( buffer
[i
] >= 'a' && buffer
[i
] <= 'z' ) ||
816 ( buffer
[i
] >= '0' && buffer
[i
] <= '9' ) ||
817 strchr( " <>[]._-|/", buffer
[i
] ) )
824 word
[j
++] = buffer
[i
];
828 if( onword
) /* On vient de terminer un mot */
832 elem
= (char*)mbkalloc( j
* sizeof(char) );
833 memcpy( elem
, word
, j
);
834 decomp
= al_addchain( decomp
, elem
);
839 /* Ici si des symbols sont considérés comme des mots à part entière */
844 mal_error( fname
, mal_line
, "Blank line.\n" );
846 return( reverse( decomp
) );
849 /******************************************************************************/
851 void free_line( head
)
854 chain_list
*trashing
;
856 for( trashing
= head
; trashing
; trashing
= trashing
->NEXT
)
857 mbkfree( trashing
->DATA
);
859 al_freechain( head
);
862 /******************************************************************************/
864 void mal_error( char *fname
, ... )
870 va_start( index
, fname
);
871 // fname = va_arg( index, char* );
872 line
= va_arg( index
, int );
873 fmt
= va_arg( index
, char* );
878 "*** mbk error in loadlofig ( al ) file %s line %d ***\n",
882 vfprintf( stderr
, fmt
, index
);
887 /******************************************************************************/
889 void chk_header( line
, fname
, mal_line
)
896 type
= type_line( line
, fname
, mal_line
);
898 if( type
!= MAL_HEA
)
899 mal_error( fname
, mal_line
, "Can't find header.\n" );
901 if( ! line
->NEXT
|| ! line
->NEXT
->NEXT
)
902 mal_error( fname
, mal_line
, "Incomplete header.\n" );
904 if( strcasecmp( (char*) line
->NEXT
->DATA
, fname
) != 0 )
907 "Bad circuit name : %s insteated of %s.\n",
908 (char*) line
->NEXT
->DATA
,
912 if( strcasecmp( (char*) line
->NEXT
->NEXT
->DATA
, "L" ) != 0 )
913 mal_error( fname
, mal_line
, "Bad type of view (not logical).\n" );
916 /******************************************************************************/
918 loins_list
* end_ins( ptfig
, tetemodele
, newins
, fname
, mal_line
)
920 lofig_list
**tetemodele
;
925 lofig_list
*ptmodele
;
935 ptmodele
= getlomodel( *tetemodele
, newins
->modelename
);
938 *tetemodele
= addlomodel( *tetemodele
, newins
->modelename
);
939 ptmodele
= *tetemodele
;
941 /* Building connectors for new model */
942 for( scan
= newins
->interface
; scan
; scan
= scan
->NEXT
)
943 addlocon( *tetemodele
, ((data_locon
*)scan
->DATA
)->name
, NULL
, 'X');
947 /* Create losig in the same order of the locon in the model */
949 for( scancon
= ptmodele
->LOCON
, nb
= 0 ;
951 scancon
= scancon
->NEXT
, nb
++
954 htcon
= addht( nb
/10+1 );
956 for( scan
= newins
->interface
; scan
; scan
= scan
->NEXT
)
957 addhtitem( htcon
, ((data_locon
*)scan
->DATA
)->name
, (long)(scan
) );
959 for( scancon
= ptmodele
->LOCON
; scancon
; scancon
= scancon
->NEXT
)
961 scan
= (chain_list
*)gethtitem( htcon
, scancon
->NAME
);
962 if( ((long)(scan
)) != EMPTYHT
)
963 headsig
= al_addchain( headsig
, ((data_locon
*)scan
->DATA
)->ptsig
);
968 "Bad interface for instance %s of model %s.\n",
978 headsig
= reverse( headsig
);
980 ins
= addloins( ptfig
, newins
->insname
, ptmodele
, headsig
);
982 newins
->interface
= reverse( newins
->interface
);
983 for( scan
= newins
->interface
, scancon
= ins
->LOCON
;
985 scan
= scan
->NEXT
, scancon
= scancon
->NEXT
988 dtcon
= (data_locon
*)scan
->DATA
;
989 scancon
->DIRECTION
= dtcon
->dir
;
991 if( dtcon
->phcon
&& !scancon
->SIG
->PRCN
)
992 addlorcnet( scancon
->SIG
);
995 for( scannum
= dtcon
->phcon
; scannum
; scannum
= scannum
->NEXT
)
996 setloconnode( scancon
, scannum
->DATA
);
999 al_freechain( headsig
);
1001 for( scan
= newins
->interface
; scan
; scan
= scan
->NEXT
)
1003 freenum( ((data_locon
*)(scan
->DATA
))->phcon
);
1004 mbkfree( scan
->DATA
);
1007 al_freechain( newins
->interface
);
1014 /******************************************************************************/
1016 void alcloadlofig6( ptfig
, fname
, mode
, in
, version
)
1023 chain_list
*line
; /* line read from file */
1024 int type
; /* type of line */
1025 int mal_line
; /* line number in file */
1026 data_locon
*newcon
; /* data extract from object 'C' */
1027 locon_list
*newlocon
; /* new locon */
1028 losig_list
*newlosig
; /* new losig */
1029 num_list
*scannum
; /* to scan phcon */
1030 int compose
=0; /* Valid elements for currents object */
1031 lofig_list
*tetemodele
; /* model list used */
1032 data_loins
*newins
; /* new instance */
1033 losig_list
*scansig
; /* to clean the USER field of losig */
1034 locon_list
*figcon
; /* for mode c : connector of lofig */
1035 ht
*htsigname
; /* create an unique name on losig */
1047 htsigname
= addht( 1024 );
1048 ptfig
->USER
= addptype( ptfig
->USER
, SIGHT
, htsigname
);
1051 /* check the name */
1054 line
= read_line( in
, fname
, mal_line
);
1055 chk_header( line
, fname
, mal_line
);
1058 /* externals connectors */
1060 figcon
= ptfig
->LOCON
;
1065 line
= read_line( in
, fname
, mal_line
);
1066 type
= type_line( line
, fname
, mal_line
);
1068 if( type
== MAL_CON
)
1070 newcon
= decode_locon( ptfig
, line
->NEXT
, fname
, mal_line
);
1073 newlocon
= addlocon( ptfig
, newcon
->name
, newcon
->ptsig
, newcon
->dir
);
1077 /*newlocon->SIG = newcon->ptsig;*/
1078 figcon
= figcon
->NEXT
;
1081 if( mode
!= 'C' && newcon
->phcon
)
1083 if( !newcon
->ptsig
->PRCN
)
1084 addlorcnet( newcon
->ptsig
);
1086 for( scannum
= newcon
->phcon
; scannum
; scannum
= scannum
->NEXT
)
1087 setloconnode( newlocon
, scannum
->DATA
);
1090 /* del the newcon */
1091 freenum( newcon
->phcon
);
1098 while( type
== MAL_CON
);
1101 /* Internal description of figure */
1105 while( type
!= MAL_EOF
&& type
!= MAL_CTC
)
1114 newins
= decode_ins( line
->NEXT
, fname
, mal_line
);
1119 decode_trs( ptfig
, line
->NEXT
, fname
, mal_line
, version
);
1124 compose
= MAL_WIR
| MAL_CAP
;
1130 newlosig
= decode_sig( ptfig
, line
->NEXT
, fname
, mal_line
, version
);
1134 /* erreur : element non reconnu. */
1135 mal_error( fname
, mal_line
, "Incorrect file structure.\n" );
1141 line
= read_line( in
, fname
, mal_line
);
1142 type
= type_line( line
, fname
, mal_line
);
1144 while ( type
& compose
)
1148 complete_ins( ptfig
, newins
, line
->NEXT
, fname
, mal_line
);
1156 decode_lowire( newlosig
, line
->NEXT
, fname
, mal_line
);
1159 decode_capa( newlosig
, line
->NEXT
, fname
, mal_line
);
1166 line
= read_line( in
, fname
, mal_line
);
1167 type
= type_line( line
, fname
, mal_line
);
1170 /* terminate current element */
1172 end_ins( ptfig
, &tetemodele
, newins
, fname
, mal_line
);
1177 while( type
== MAL_CTC
)
1179 decode_loctc( ptfig
, line
->NEXT
, fname
, mal_line
);
1183 line
= read_line( in
, fname
, mal_line
);
1184 type
= type_line( line
, fname
, mal_line
);
1188 if( type
!= MAL_EOF
)
1189 mal_error( fname
, mal_line
, "Incorrect file structure.\n" );
1191 freelomodel( tetemodele
);
1192 for( scansig
= ptfig
->LOSIG
; scansig
; scansig
= scansig
->NEXT
)
1193 scansig
->USER
= delptype( scansig
->USER
, MALDEFINED
);
1199 ptfig
->USER
= delptype( ptfig
->USER
, SIGHT
);
1205 lofigchain( ptfig
);
1209 /******* Function for debug ***************************************************/
1213 chain_list
* al_dbg_addchain( head
, data
, ligne
)
1220 for( i
=0 ; i
< ALMAXCHAIN
; i
++ )
1221 if( al_chain_lg
[i
] == 0 )
1224 if( i
== ALMAXCHAIN
)
1226 printf( "\n*** Debuggage AL : tableau al_chain plein.\n" );
1230 al_chain_lg
[i
] = ligne
;
1231 al_chain_pt
[i
] = addchain( head
, data
);
1233 return( al_chain_pt
[i
] );
1236 void al_freechain( head
)
1242 for( scan
= head
; scan
; scan
= scan
->NEXT
)
1244 for( i
= 0 ; i
< ALMAXCHAIN
; i
++ )
1245 if( al_chain_pt
[i
] == scan
)
1247 if( i
== ALMAXCHAIN
)
1249 printf( "\n*** Debuggage AL : chain_list a liberer non trouvee.\n" );
1257 void al_dbg_chkchain( void )
1261 for( i
=0 ; i
< ALMAXCHAIN
; i
++ )
1263 if( al_chain_lg
[i
] )
1264 printf( "*** Debuggage AL : Element alloue ligne %d non libere.\n",
1270 void al_dbg_init( void )
1274 printf( "*** Parser al v6.03. Debug\n" );
1275 for( i
=0 ; i
<ALMAXCHAIN
; i
++ )