ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
cmdUtils.c
Go to the documentation of this file.
1
20
21#include "base/abc/abc.h"
22#include "base/main/mainInt.h"
24#include "cmdInt.h"
25#include <ctype.h>
26
28 // proper declaration of isspace
29
33
34static int CmdCommandPrintCompare( Abc_Command ** ppC1, Abc_Command ** ppC2 );
35
39
51int cmdCheckShellEscape( Abc_Frame_t * pAbc, int argc, char ** argv)
52{
53 int RetValue;
54 if (argv[0][0] == '!')
55 {
56#if defined(__wasm)
57 RetValue = -1;
58#else
59 const int size = 4096;
60 int i;
61 char * buffer = ABC_ALLOC(char, 10000);
62 strncpy (buffer, &argv[0][1], size);
63 for (i = 1; i < argc; ++i)
64 {
65 strncat (buffer, " ", size);
66 strncat (buffer, argv[i], size);
67 }
68 if (buffer[0] == 0)
69 strncpy (buffer, "/bin/sh", size);
70 RetValue = system (buffer);
71 ABC_FREE( buffer );
72
73 // NOTE: Since we reconstruct the cmdline by concatenating
74 // the parts, we lose information. So a command like
75 // `!ls "file name"` will be sent to the system as
76 // `ls file name` which is a BUG
77#endif
78 return 1;
79 }
80 else
81 {
82 return 0;
83 }
84}
85
97int CmdCommandDispatch( Abc_Frame_t * pAbc, int * pargc, char *** pargv )
98{
99 int argc = *pargc;
100 char ** argv = *pargv;
101 char ** argv2;
102
103 Abc_Ntk_t * pNetCopy;
104 int (*pFunc) ( Abc_Frame_t *, int, char ** );
105 Abc_Command * pCommand;
106 char * value;
107 int fError;
108 double clk;
109
110 if ( argc == 0 )
111 return 0;
112
113 if ( cmdCheckShellEscape( pAbc, argc, argv ) == 1 )
114 return 0;
115
116 // get the command
117 if ( ! st__lookup( pAbc->tCommands, argv[0], (char **)&pCommand ) )
118 { // the command is not in the table
119 // if there is only one word with an extension, assume this is file to be read
120 if ( argc == 1 && strstr( argv[0], "." ) )
121 {
122 // add command 'read' assuming that this is the file name
123 argv2 = CmdAddToArgv( argc, argv );
124 CmdFreeArgv( argc, argv );
125 argc = argc+1;
126 argv = argv2;
127 *pargc = argc;
128 *pargv = argv;
129 if ( ! st__lookup( pAbc->tCommands, argv[0], (char **)&pCommand ) )
130 assert( 0 );
131 }
132 else
133 {
134 fprintf( pAbc->Err, "** cmd error: unknown command '%s'\n", argv[0] );
135 fprintf( pAbc->Err, "(this is likely caused by using an alias defined in \"abc.rc\"\n" );
136 fprintf( pAbc->Err, "without having this file in the current or parent directory)\n" );
137 return 1;
138 }
139 }
140
141 // get the backup network if the command is going to change the network
142 if ( pCommand->fChange )
143 {
144 if ( pAbc->pNtkCur && Abc_FrameIsFlagEnabled( "backup" ) )
145 {
146 pNetCopy = Abc_NtkDup( pAbc->pNtkCur );
147 Abc_FrameSetCurrentNetwork( pAbc, pNetCopy );
148 // swap the current network and the backup network
149 // to prevent the effect of resetting the short names
151 }
152 }
153
154 // execute the command
155 clk = Extra_CpuTimeDouble();
156 pFunc = (int (*)(Abc_Frame_t *, int, char **))pCommand->pFunc;
157 fError = (*pFunc)( pAbc, argc, argv );
158 pAbc->TimeCommand += Extra_CpuTimeDouble() - clk;
159
160 // automatic execution of arbitrary command after each command
161 // usually this is a passive command ...
162 if ( fError == 0 && !pAbc->fAutoexac )
163 {
164 if ( st__lookup( pAbc->tFlags, "autoexec", &value ) )
165 {
166 pAbc->fAutoexac = 1;
167 fError = Cmd_CommandExecute( pAbc, value );
168 pAbc->fAutoexac = 0;
169 }
170 }
171 return fError;
172}
173
185const char * CmdSplitLine( Abc_Frame_t * pAbc, const char *sCommand, int *argc, char ***argv )
186{
187 const char *p, *start;
188 char c;
189 int i, j;
190 char *new_arg;
191 Vec_Ptr_t * vArgs;
192 int single_quote, double_quote;
193
194 vArgs = Vec_PtrAlloc( 10 );
195
196 p = sCommand;
197 for ( ;; )
198 {
199 // skip leading white space
200 while ( isspace( ( int ) *p ) )
201 {
202 p++;
203 }
204
205 // skip until end of this token
206 single_quote = double_quote = 0;
207 for ( start = p; ( c = *p ) != '\0'; p++ )
208 {
209 if ( c == ';' || c == '#' || isspace( ( int ) c ) )
210 {
211 if ( !single_quote && !double_quote )
212 {
213 break;
214 }
215 }
216 if ( c == '\'' )
217 {
218 single_quote = !single_quote;
219 }
220 if ( c == '"' )
221 {
222 double_quote = !double_quote;
223 }
224 }
225 if ( single_quote || double_quote )
226 {
227 ( void ) fprintf( pAbc->Err, "** cmd warning: ignoring unbalanced quote ...\n" );
228 }
229 if ( start == p )
230 break;
231
232 new_arg = ABC_ALLOC( char, p - start + 1 );
233 j = 0;
234 for ( i = 0; i < p - start; i++ )
235 {
236 c = start[i];
237 if ( ( c != '\'' ) && ( c != '\"' ) )
238 {
239 new_arg[j++] = isspace( ( int ) c ) ? ' ' : start[i];
240 }
241 }
242 new_arg[j] = '\0';
243 Vec_PtrPush( vArgs, new_arg );
244 }
245
246 *argc = vArgs->nSize;
247 *argv = (char **)Vec_PtrReleaseArray( vArgs );
248 Vec_PtrFree( vArgs );
249 if ( *p == ';' )
250 {
251 p++;
252 }
253 else if ( *p == '#' )
254 {
255 for ( ; *p != 0; p++ ); // skip to end of line
256 }
257 return p;
258}
259
271int CmdApplyAlias( Abc_Frame_t * pAbc, int *argcp, char ***argvp, int *loop )
272{
273 int i, argc, stopit, added, offset, did_subst, subst, fError, newc, j;
274 const char *arg;
275 char **argv, **newv;
276 Abc_Alias *alias;
277
278 argc = *argcp;
279 argv = *argvp;
280 stopit = 0;
281 for ( ; *loop < 200; ( *loop )++ )
282 {
283 if ( argc == 0 )
284 return 0;
285 if ( stopit != 0 || st__lookup( pAbc->tAliases, argv[0], (char **) &alias ) == 0 )
286 {
287 return 0;
288 }
289 if ( strcmp( argv[0], alias->argv[0] ) == 0 )
290 {
291 stopit = 1;
292 }
293 ABC_FREE( argv[0] );
294 added = alias->argc - 1;
295
296 /* shift all the arguments to the right */
297 if ( added != 0 )
298 {
299 argv = ABC_REALLOC( char *, argv, argc + added );
300 for ( i = argc - 1; i >= 1; i-- )
301 {
302 argv[i + added] = argv[i];
303 }
304 for ( i = 1; i <= added; i++ )
305 {
306 argv[i] = NULL;
307 }
308 argc += added;
309 }
310 subst = 0;
311 for ( i = 0, offset = 0; i < alias->argc; i++, offset++ )
312 {
313 arg = CmdHistorySubstitution( pAbc, alias->argv[i], &did_subst );
314 if ( arg == NULL )
315 {
316 *argcp = argc;
317 *argvp = argv;
318 return ( 1 );
319 }
320 if ( did_subst != 0 )
321 {
322 subst = 1;
323 }
324 fError = 0;
325 do
326 {
327 arg = CmdSplitLine( pAbc, arg, &newc, &newv );
328 /*
329 * If there's a complete `;' terminated command in `arg',
330 * when split_line() returns arg[0] != '\0'.
331 */
332 if ( arg[0] == '\0' )
333 { /* just a bunch of words */
334 break;
335 }
336 fError = CmdApplyAlias( pAbc, &newc, &newv, loop );
337 if ( fError == 0 )
338 {
339 fError = CmdCommandDispatch( pAbc, &newc, &newv );
340 }
341 CmdFreeArgv( newc, newv );
342 }
343 while ( fError == 0 );
344 if ( fError != 0 )
345 {
346 *argcp = argc;
347 *argvp = argv;
348 return ( 1 );
349 }
350 added = newc - 1;
351 if ( added != 0 )
352 {
353 argv = ABC_REALLOC( char *, argv, argc + added );
354 for ( j = argc - 1; j > offset; j-- )
355 {
356 argv[j + added] = argv[j];
357 }
358 argc += added;
359 }
360 for ( j = 0; j <= added; j++ )
361 {
362 argv[j + offset] = newv[j];
363 }
364 ABC_FREE( newv );
365 offset += added;
366 }
367 if ( subst == 1 )
368 {
369 for ( i = offset; i < argc; i++ )
370 {
371 ABC_FREE( argv[i] );
372 }
373 argc = offset;
374 }
375 *argcp = argc;
376 *argvp = argv;
377 }
378
379 fprintf( pAbc->Err, "** cmd warning: alias loop\n" );
380 return 1;
381}
382
394char * CmdHistorySubstitution( Abc_Frame_t * pAbc, char *line, int *changed )
395{
396 // as of today, no history substitution
397 *changed = 0;
398 return line;
399}
400
412FILE * CmdFileOpen( Abc_Frame_t * pAbc, char *sFileName, char *sMode, char **pFileNameReal, int silent )
413{
414 char * sRealName, * sPathUsr, * sPathLib, * sPathAll;
415 FILE * pFile;
416
417 if (strcmp(sFileName, "-") == 0) {
418 if (strcmp(sMode, "w") == 0) {
419 sRealName = Extra_UtilStrsav( "stdout" );
420 pFile = stdout;
421 }
422 else {
423 sRealName = Extra_UtilStrsav( "stdin" );
424 pFile = stdin;
425 }
426 }
427 else {
428 sRealName = NULL;
429 if (strcmp(sMode, "r") == 0) {
430
431 /* combine both pathes if exist */
432 sPathUsr = Cmd_FlagReadByName(pAbc,"open_path");
433 sPathLib = Cmd_FlagReadByName(pAbc,"lib_path");
434
435 if ( sPathUsr == NULL && sPathLib == NULL ) {
436 sPathAll = NULL;
437 }
438 else if ( sPathUsr == NULL ) {
439 sPathAll = Extra_UtilStrsav( sPathLib );
440 }
441 else if ( sPathLib == NULL ) {
442 sPathAll = Extra_UtilStrsav( sPathUsr );
443 }
444 else {
445 sPathAll = ABC_ALLOC( char, strlen(sPathLib)+strlen(sPathUsr)+5 );
446 sprintf( sPathAll, "%s:%s",sPathUsr, sPathLib );
447 }
448 if ( sPathAll != NULL ) {
449 sRealName = Extra_UtilFileSearch(sFileName, sPathAll, "r");
450 ABC_FREE( sPathAll );
451 }
452 }
453 if (sRealName == NULL) {
454 sRealName = Extra_UtilTildeExpand(sFileName);
455 }
456
457 if ((pFile = fopen(sRealName, sMode)) == NULL) {
458 if (! silent) {
459// perror(sRealName);
460 Abc_Print( 1, "Cannot open file \"%s\".\n", sRealName );
461 }
462 }
463 else
464 {
465 // print the path/name of the resource file 'abc.rc' that is being loaded
466 if ( !silent && strlen(sRealName) >= 6 && strcmp( sRealName + strlen(sRealName) - 6, "abc.rc" ) == 0 )
467 Abc_Print( 1, "Loading resource file \"%s\".\n", sRealName );
468 }
469 }
470 if ( pFileNameReal )
471 *pFileNameReal = sRealName;
472 else
473 ABC_FREE(sRealName);
474
475 return pFile;
476}
477
489void CmdFreeArgv( int argc, char **argv )
490{
491 int i;
492 for ( i = 0; i < argc; i++ )
493 ABC_FREE( argv[i] );
494 ABC_FREE( argv );
495}
496char ** CmdDupArgv( int argc, char **argv )
497{
498 char ** argvNew = ABC_ALLOC( char *, argc );
499 int i;
500 for ( i = 0; i < argc; i++ )
501 argvNew[i] = Abc_UtilStrsav( argv[i] );
502 return argvNew;
503}
504
516char ** CmdAddToArgv( int argc, char ** argv )
517{
518 char ** argv2;
519 int i;
520 argv2 = ABC_ALLOC( char *, argc + 1 );
521 argv2[0] = Extra_UtilStrsav( "read" );
522// argv2[0] = Extra_UtilStrsav( "&r" );
523 for ( i = 0; i < argc; i++ )
524 argv2[i+1] = Extra_UtilStrsav( argv[i] );
525 return argv2;
526}
527
539void CmdCommandFree( Abc_Command * pCommand )
540{
541 ABC_FREE( pCommand->sGroup );
542 ABC_FREE( pCommand->sName );
543 ABC_FREE( pCommand );
544}
545
546
558void CmdCommandPrint( Abc_Frame_t * pAbc, int fPrintAll, int fDetails )
559{
560 const char *key;
561 char *value;
562 st__generator * gen;
563 Abc_Command ** ppCommands;
564 Abc_Command * pCommands;
565 int nCommands, iGroupStart, i, j;
566 char * sGroupCur;
567 int LenghtMax, nColumns, iCom = 0;
568 FILE *backupErr = pAbc->Err;
569
570 // put all commands into one array
571 nCommands = st__count( pAbc->tCommands );
572 ppCommands = ABC_ALLOC( Abc_Command *, nCommands );
573 i = 0;
574 st__foreach_item( pAbc->tCommands, gen, &key, &value )
575 {
576 pCommands = (Abc_Command *)value;
577 if ( fPrintAll || pCommands->sName[0] != '_' )
578 ppCommands[i++] = pCommands;
579 }
580 nCommands = i;
581
582 // sort command by group and then by name, alphabetically
583 qsort( (void *)ppCommands, (size_t)nCommands, sizeof(Abc_Command *),
584 (int (*)(const void *, const void *)) CmdCommandPrintCompare );
585 assert( CmdCommandPrintCompare( ppCommands, ppCommands + nCommands - 1 ) <= 0 );
586
587 // get the longest command name
588 LenghtMax = 0;
589 for ( i = 0; i < nCommands; i++ )
590 if ( LenghtMax < (int)strlen(ppCommands[i]->sName) )
591 LenghtMax = (int)strlen(ppCommands[i]->sName);
592 // get the number of columns
593 nColumns = 79 / (LenghtMax + 2);
594
595 // print the starting message
596 fprintf( pAbc->Out, " Welcome to ABC compiled on %s %s!", __DATE__, __TIME__ );
597
598 // print the command by group
599 sGroupCur = NULL;
600 iGroupStart = 0;
601 pAbc->Err = pAbc->Out;
602 for ( i = 0; i < nCommands; i++ )
603 if ( sGroupCur && strcmp( sGroupCur, ppCommands[i]->sGroup ) == 0 )
604 { // this command belongs to the same group as the previous one
605 if ( iCom++ % nColumns == 0 )
606 fprintf( pAbc->Out, "\n" );
607 // print this command
608 fprintf( pAbc->Out, " %-*s", LenghtMax, ppCommands[i]->sName );
609 }
610 else
611 { // this command starts the new group of commands
612 // start the new group
613 if ( fDetails && i != iGroupStart )
614 { // print help messages for all commands in the previous groups
615 fprintf( pAbc->Out, "\n" );
616 for ( j = iGroupStart; j < i; j++ )
617 {
618 char *tmp_cmd;
619 fprintf( pAbc->Out, "\n" );
620 // fprintf( pAbc->Out, "--- %s ---\n", ppCommands[j]->sName );
621 tmp_cmd = ABC_ALLOC(char, strlen(ppCommands[j]->sName)+4);
622 (void) sprintf(tmp_cmd, "%s -h", ppCommands[j]->sName);
623 (void) Cmd_CommandExecute( pAbc, tmp_cmd );
624 ABC_FREE(tmp_cmd);
625 }
626 fprintf( pAbc->Out, "\n" );
627 fprintf( pAbc->Out, " ----------------------------------------------------------------------" );
628 iGroupStart = i;
629 }
630 fprintf( pAbc->Out, "\n" );
631 fprintf( pAbc->Out, "\n" );
632 fprintf( pAbc->Out, "%s commands:\n", ppCommands[i]->sGroup );
633 // print this command
634 fprintf( pAbc->Out, " %-*s", LenghtMax, ppCommands[i]->sName );
635 // remember current command group
636 sGroupCur = ppCommands[i]->sGroup;
637 // reset the command counter
638 iCom = 1;
639 }
640 if ( fDetails && i != iGroupStart )
641 { // print help messages for all commands in the previous groups
642 fprintf( pAbc->Out, "\n" );
643 for ( j = iGroupStart; j < i; j++ )
644 {
645 char *tmp_cmd;
646 fprintf( pAbc->Out, "\n" );
647 // fprintf( pAbc->Out, "--- %s ---\n", ppCommands[j]->sName );
648 tmp_cmd = ABC_ALLOC(char, strlen(ppCommands[j]->sName)+4);
649 (void) sprintf(tmp_cmd, "%s -h", ppCommands[j]->sName);
650 (void) Cmd_CommandExecute( pAbc, tmp_cmd );
651 ABC_FREE(tmp_cmd);
652 }
653 }
654 pAbc->Err = backupErr;
655 fprintf( pAbc->Out, "\n" );
656 ABC_FREE( ppCommands );
657}
658
670int CmdCommandPrintCompare( Abc_Command ** ppC1, Abc_Command ** ppC2 )
671{
672 Abc_Command * pC1 = *ppC1;
673 Abc_Command * pC2 = *ppC2;
674 int RetValue;
675
676 RetValue = strcmp( pC1->sGroup, pC2->sGroup );
677 if ( RetValue < 0 )
678 return -1;
679 if ( RetValue > 0 )
680 return 1;
681 // the command belong to the same group
682
683 // put commands with "_" at the end of the list
684 if ( pC1->sName[0] != '_' && pC2->sName[0] == '_' )
685 return -1;
686 if ( pC1->sName[0] == '_' && pC2->sName[0] != '_' )
687 return 1;
688
689 RetValue = strcmp( pC1->sName, pC2->sName );
690 if ( RetValue < 0 )
691 return -1;
692 if ( RetValue > 0 )
693 return 1;
694 // should not be two indentical commands
695 assert( 0 );
696 return 0;
697}
698
710int CmdNamePrintCompare( char ** ppC1, char ** ppC2 )
711{
712 return strcmp( *ppC1, *ppC2 );
713}
714
726void CmdPrintTable( st__table * tTable, int fAliases )
727{
728 st__generator * gen;
729 const char ** ppNames;
730 const char * key;
731 char* value;
732 int nNames, i;
733
734 // collect keys in the array
735 ppNames = ABC_ALLOC( const char *, st__count(tTable) );
736 nNames = 0;
737 st__foreach_item( tTable, gen, &key, &value )
738 ppNames[nNames++] = key;
739
740 // sort array by name
741 qsort( (void *)ppNames, (size_t)nNames, sizeof(char *),
742 (int (*)(const void *, const void *))CmdNamePrintCompare );
743
744 // print in this order
745 for ( i = 0; i < nNames; i++ )
746 {
747 st__lookup( tTable, ppNames[i], &value );
748 if ( fAliases )
750 else
751 fprintf( stdout, "%-15s %-15s\n", ppNames[i], value );
752 }
753 ABC_FREE( ppNames );
754}
755
767void Gia_ManKissatCall( Abc_Frame_t * pAbc, char * pFileName, char * pArgs, int nConfs, int nTimeLimit, int fSat, int fUnsat, int fPrintCex, int fVerbose )
768{
769 char Command[1000], Buffer[100];
770 char * pNameWin = "kissat.exe";
771 char * pNameUnix = "kissat";
772 char * pKissatName = NULL;
773 //FILE * pFile = NULL;
774
775 // get the names from the resource file
776 if ( Cmd_FlagReadByName(pAbc, "kissatwin") )
777 pNameWin = Cmd_FlagReadByName(pAbc, "kissatwin");
778 if ( Cmd_FlagReadByName(pAbc, "kissatunix") )
779 pNameUnix = Cmd_FlagReadByName(pAbc, "kissatunix");
780/*
781 // check if the binary is available
782 if ( (pFile = fopen( pNameWin, "r" )) )
783 pKissatName = pNameWin;
784 else if ( (pFile = fopen( pNameUnix, "r" )) )
785 pKissatName = pNameUnix;
786 else if ( pFile == NULL )
787 {
788 fprintf( stdout, "Cannot find Kissat binary \"%s\" or \"%s\" in the current directory.\n", pNameWin, pNameUnix );
789 return;
790 }
791 fclose( pFile );
792*/
793
794#ifdef _WIN32
795 pKissatName = pNameWin;
796#else
797 pKissatName = pNameUnix;
798#endif
799
800 sprintf( Command, "%s", pKissatName );
801 if ( pArgs )
802 {
803 strcat( Command, " " );
804 strcat( Command, pArgs );
805 }
806 if ( !pArgs || (strcmp(pArgs, "-h") && strcmp(pArgs, "--help")) )
807 {
808 if ( !fVerbose )
809 strcat( Command, " -q" );
810 if ( !fPrintCex )
811 strcat( Command, " -n" );
812 if ( fSat )
813 strcat( Command, " --sat" );
814 if ( fUnsat )
815 strcat( Command, " --unsat" );
816 if ( nConfs )
817 {
818 sprintf( Buffer, " --conflicts=%d", nConfs );
819 strcat( Command, Buffer );
820 }
821 if ( nTimeLimit )
822 {
823 sprintf( Buffer, " --time=%d", nTimeLimit );
824 strcat( Command, Buffer );
825 }
826 strcat( Command, " " );
827 strcat( Command, pFileName );
828 }
829 if ( fVerbose )
830 printf( "Running command: %s\n", Command );
831 if ( Util_SignalSystem( Command ) == -1 )
832 {
833 fprintf( stdout, "The following command has returned a strange exit status:\n" );
834 fprintf( stdout, "\"%s\"\n", Command );
835 }
836}
837
838
850char * Cmd_GenScript( char ** pComms, int nComms, int nParts )
851{
852 static char pScript[1000]; int c;
853 pScript[0] = 0;
854 for ( c = 0; c < nParts; c++ ) {
855 strcat( pScript, pComms[rand() % nComms] );
856 strcat( pScript, "; " );
857 }
858 strcat( pScript, "print_stats" );
859 return pScript;
860}
861void Cmd_CommandSGen( Abc_Frame_t * pAbc, int nParts, int nIters, int fVerbose )
862{
863 Abc_Ntk_t * pCopy = Abc_NtkDup( Abc_FrameReadNtk(pAbc) );
864 Abc_Ntk_t * pBest = Abc_NtkDup( Abc_FrameReadNtk(pAbc) );
865 Abc_Ntk_t * pCur = NULL; int i;
866 char * pComms[6] = { "balance", "rewrite", "rewrite -z", "refactor", "refactor -z", "resub" };
867 srand( time(NULL) );
868 for ( i = 0; i < nIters; i++ )
869 {
870 char * pScript = Cmd_GenScript( pComms, 6, nParts );
872 if ( Abc_FrameIsBatchMode() )
873 {
874 if ( Cmd_CommandExecute(pAbc, pScript) )
875 {
876 Abc_Print( 1, "Something did not work out with the command \"%s\".\n", pScript );
877 return;
878 }
879 }
880 else
881 {
883 if ( Cmd_CommandExecute(pAbc, pScript) )
884 {
885 Abc_Print( 1, "Something did not work out with the command \"%s\".\n", pScript );
887 return;
888 }
890 }
891 pCur = Abc_FrameReadNtk(pAbc);
892 if ( Abc_NtkNodeNum(pCur) < Abc_NtkNodeNum(pBest) ) {
893 Abc_Obj_t * pObj; int k;
894 Abc_NtkForEachObj( pBest, pObj, k )
895 pObj->fMarkA = pObj->fMarkB = pObj->fMarkC = 0;
896 Abc_NtkDelete( pBest );
897 pBest = Abc_NtkDup( pCur );
898 }
899 }
900 Abc_FrameSetCurrentNetwork( pAbc, pBest );
901 Abc_NtkDelete( pCopy );
902}
903
908
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition abc.h:449
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition abcNtk.c:472
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_REALLOC(type, obj, num)
Definition abc_global.h:268
#define ABC_FREE(obj)
Definition abc_global.h:267
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
Definition abcapis.h:38
ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame()
Definition mainFrame.c:643
ABC_DLL void Abc_FrameSetBatchMode(int Mode)
Definition mainFrame.c:111
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition mainFrame.c:327
ABC_DLL int Abc_FrameIsBatchMode()
Definition mainFrame.c:110
ABC_DLL int Abc_FrameIsFlagEnabled(char *pFlag)
Definition mainFrame.c:138
ABC_DLL void Abc_FrameSetCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
Definition mainFrame.c:441
ABC_DLL void Abc_FrameSwapCurrentAndBackup(Abc_Frame_t *p)
Definition mainFrame.c:496
ABC_NAMESPACE_IMPL_START typedef signed char value
void CmdCommandAliasPrint(Abc_Frame_t *pAbc, Abc_Alias *pAlias)
Definition cmdAlias.c:72
void Gia_ManKissatCall(Abc_Frame_t *pAbc, char *pFileName, char *pArgs, int nConfs, int nTimeLimit, int fSat, int fUnsat, int fPrintCex, int fVerbose)
Definition cmdUtils.c:767
int CmdCommandDispatch(Abc_Frame_t *pAbc, int *pargc, char ***pargv)
Definition cmdUtils.c:97
int cmdCheckShellEscape(Abc_Frame_t *pAbc, int argc, char **argv)
FUNCTION DEFINITIONS ///.
Definition cmdUtils.c:51
void Cmd_CommandSGen(Abc_Frame_t *pAbc, int nParts, int nIters, int fVerbose)
Definition cmdUtils.c:861
FILE * CmdFileOpen(Abc_Frame_t *pAbc, char *sFileName, char *sMode, char **pFileNameReal, int silent)
Definition cmdUtils.c:412
char ** CmdDupArgv(int argc, char **argv)
Definition cmdUtils.c:496
void CmdCommandFree(Abc_Command *pCommand)
Definition cmdUtils.c:539
char ** CmdAddToArgv(int argc, char **argv)
Definition cmdUtils.c:516
const char * CmdSplitLine(Abc_Frame_t *pAbc, const char *sCommand, int *argc, char ***argv)
Definition cmdUtils.c:185
char * CmdHistorySubstitution(Abc_Frame_t *pAbc, char *line, int *changed)
Definition cmdUtils.c:394
int CmdNamePrintCompare(char **ppC1, char **ppC2)
Definition cmdUtils.c:710
char * Cmd_GenScript(char **pComms, int nComms, int nParts)
Definition cmdUtils.c:850
void CmdCommandPrint(Abc_Frame_t *pAbc, int fPrintAll, int fDetails)
Definition cmdUtils.c:558
int CmdApplyAlias(Abc_Frame_t *pAbc, int *argcp, char ***argvp, int *loop)
Definition cmdUtils.c:271
void CmdPrintTable(st__table *tTable, int fAliases)
Definition cmdUtils.c:726
void CmdFreeArgv(int argc, char **argv)
Definition cmdUtils.c:489
char * Cmd_FlagReadByName(Abc_Frame_t *pAbc, char *flag)
DECLARATIONS ///.
Definition cmdFlag.c:47
struct MvAlias Abc_Alias
Definition cmd.h:40
typedefABC_NAMESPACE_HEADER_START struct MvCommand Abc_Command
INCLUDES ///.
Definition cmd.h:39
ABC_DLL int Cmd_CommandExecute(Abc_Frame_t *pAbc, const char *sCommand)
Definition cmdApi.c:193
Cube * p
Definition exorList.c:222
Cube ** ppC2
Definition exorList.c:1014
Cube ** ppC1
Definition exorList.c:1013
char * Extra_UtilStrsav(const char *s)
char * Extra_UtilTildeExpand(char *fname)
char * Extra_UtilFileSearch(char *file, char *path, char *mode)
double Extra_CpuTimeDouble()
enum keys key
Definition main.h:25
int st__lookup(st__table *table, const char *key, char **value)
Definition st.c:114
#define st__count(table)
Definition st.h:71
#define st__foreach_item(table, gen, key, value)
Definition st.h:107
unsigned fMarkC
Definition abc.h:136
unsigned fMarkB
Definition abc.h:135
unsigned fMarkA
Definition abc.h:134
Definition st.h:52
ABC_NAMESPACE_IMPL_START int Util_SignalSystem(const char *cmd)
DECLARATIONS ///.
Definition utilSignal.c:44
#define assert(ex)
Definition util_old.h:213
char * strncat()
int strlen()
char * strncpy()
int system()
int strcmp()
char * sprintf()
char * strstr()
char * strcat()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42