abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cmdUtils.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [cmdUtils.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Command processing package.]
8 
9  Synopsis [Various utilities of the command package.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: cmdUtils.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "base/abc/abc.h"
22 #include "base/main/mainInt.h"
23 #include "cmdInt.h"
24 #include <ctype.h>
25 
27  // proper declaration of isspace
28 
29 ////////////////////////////////////////////////////////////////////////
30 /// DECLARATIONS ///
31 ////////////////////////////////////////////////////////////////////////
32 
33 static int CmdCommandPrintCompare( Abc_Command ** ppC1, Abc_Command ** ppC2 );
34 
35 ////////////////////////////////////////////////////////////////////////
36 /// FUNCTION DEFINITIONS ///
37 ////////////////////////////////////////////////////////////////////////
38 
39 /**Function*************************************************************
40 
41  Synopsis []
42 
43  Description []
44 
45  SideEffects []
46 
47  SeeAlso []
48 
49 ***********************************************************************/
50 int cmdCheckShellEscape( Abc_Frame_t * pAbc, int argc, char ** argv)
51 {
52  int RetValue;
53  if (argv[0][0] == '!')
54  {
55  const int size = 4096;
56  int i;
57  char * buffer = ABC_ALLOC(char, 10000);
58  strncpy (buffer, &argv[0][1], size);
59  for (i = 1; i < argc; ++i)
60  {
61  strncat (buffer, " ", size);
62  strncat (buffer, argv[i], size);
63  }
64  if (buffer[0] == 0)
65  strncpy (buffer, "/bin/sh", size);
66  RetValue = system (buffer);
67  ABC_FREE( buffer );
68 
69  // NOTE: Since we reconstruct the cmdline by concatenating
70  // the parts, we lose information. So a command like
71  // `!ls "file name"` will be sent to the system as
72  // `ls file name` which is a BUG
73 
74  return 1;
75  }
76  else
77  {
78  return 0;
79  }
80 }
81 
82 /**Function*************************************************************
83 
84  Synopsis [Executes one command.]
85 
86  Description []
87 
88  SideEffects []
89 
90  SeeAlso []
91 
92 ***********************************************************************/
93 int CmdCommandDispatch( Abc_Frame_t * pAbc, int * pargc, char *** pargv )
94 {
95  int argc = *pargc;
96  char ** argv = *pargv;
97  char ** argv2;
98 
99  Abc_Ntk_t * pNetCopy;
100  int (*pFunc) ( Abc_Frame_t *, int, char ** );
101  Abc_Command * pCommand;
102  char * value;
103  int fError;
104  double clk;
105 
106  if ( argc == 0 )
107  return 0;
108 
109  if ( cmdCheckShellEscape( pAbc, argc, argv ) == 1 )
110  return 0;
111 
112  // get the command
113  if ( ! st__lookup( pAbc->tCommands, argv[0], (char **)&pCommand ) )
114  { // the command is not in the table
115  // if there is only one word with an extension, assume this is file to be read
116  if ( argc == 1 && strstr( argv[0], "." ) )
117  {
118  // add command 'read' assuming that this is the file name
119  argv2 = CmdAddToArgv( argc, argv );
120  CmdFreeArgv( argc, argv );
121  argc = argc+1;
122  argv = argv2;
123  *pargc = argc;
124  *pargv = argv;
125  if ( ! st__lookup( pAbc->tCommands, argv[0], (char **)&pCommand ) )
126  assert( 0 );
127  }
128  else
129  {
130  fprintf( pAbc->Err, "** cmd error: unknown command '%s'\n", argv[0] );
131  fprintf( pAbc->Err, "(this is likely caused by using an alias defined in \"abc.rc\"\n" );
132  fprintf( pAbc->Err, "without having this file in the current or parent directory)\n" );
133  return 1;
134  }
135  }
136 
137  // get the backup network if the command is going to change the network
138  if ( pCommand->fChange )
139  {
140  if ( pAbc->pNtkCur && Abc_FrameIsFlagEnabled( "backup" ) )
141  {
142  pNetCopy = Abc_NtkDup( pAbc->pNtkCur );
143  Abc_FrameSetCurrentNetwork( pAbc, pNetCopy );
144  // swap the current network and the backup network
145  // to prevent the effect of resetting the short names
147  }
148  }
149 
150  // execute the command
151  clk = Extra_CpuTimeDouble();
152  pFunc = (int (*)(Abc_Frame_t *, int, char **))pCommand->pFunc;
153  fError = (*pFunc)( pAbc, argc, argv );
154  pAbc->TimeCommand += Extra_CpuTimeDouble() - clk;
155 
156  // automatic execution of arbitrary command after each command
157  // usually this is a passive command ...
158  if ( fError == 0 && !pAbc->fAutoexac )
159  {
160  if ( st__lookup( pAbc->tFlags, "autoexec", &value ) )
161  {
162  pAbc->fAutoexac = 1;
163  fError = Cmd_CommandExecute( pAbc, value );
164  pAbc->fAutoexac = 0;
165  }
166  }
167  return fError;
168 }
169 
170 /**Function*************************************************************
171 
172  Synopsis [Splits the command line string into individual commands.]
173 
174  Description []
175 
176  SideEffects []
177 
178  SeeAlso []
179 
180 ***********************************************************************/
181 const char * CmdSplitLine( Abc_Frame_t * pAbc, const char *sCommand, int *argc, char ***argv )
182 {
183  const char *p, *start;
184  char c;
185  int i, j;
186  char *new_arg;
187  Vec_Ptr_t * vArgs;
188  int single_quote, double_quote;
189 
190  vArgs = Vec_PtrAlloc( 10 );
191 
192  p = sCommand;
193  for ( ;; )
194  {
195  // skip leading white space
196  while ( isspace( ( int ) *p ) )
197  {
198  p++;
199  }
200 
201  // skip until end of this token
202  single_quote = double_quote = 0;
203  for ( start = p; ( c = *p ) != '\0'; p++ )
204  {
205  if ( c == ';' || c == '#' || isspace( ( int ) c ) )
206  {
207  if ( !single_quote && !double_quote )
208  {
209  break;
210  }
211  }
212  if ( c == '\'' )
213  {
214  single_quote = !single_quote;
215  }
216  if ( c == '"' )
217  {
218  double_quote = !double_quote;
219  }
220  }
221  if ( single_quote || double_quote )
222  {
223  ( void ) fprintf( pAbc->Err, "** cmd warning: ignoring unbalanced quote ...\n" );
224  }
225  if ( start == p )
226  break;
227 
228  new_arg = ABC_ALLOC( char, p - start + 1 );
229  j = 0;
230  for ( i = 0; i < p - start; i++ )
231  {
232  c = start[i];
233  if ( ( c != '\'' ) && ( c != '\"' ) )
234  {
235  new_arg[j++] = isspace( ( int ) c ) ? ' ' : start[i];
236  }
237  }
238  new_arg[j] = '\0';
239  Vec_PtrPush( vArgs, new_arg );
240  }
241 
242  *argc = vArgs->nSize;
243  *argv = (char **)Vec_PtrReleaseArray( vArgs );
244  Vec_PtrFree( vArgs );
245  if ( *p == ';' )
246  {
247  p++;
248  }
249  else if ( *p == '#' )
250  {
251  for ( ; *p != 0; p++ ); // skip to end of line
252  }
253  return p;
254 }
255 
256 /**Function*************************************************************
257 
258  Synopsis [Replaces parts of the command line string by aliases if given.]
259 
260  Description []
261 
262  SideEffects []
263 
264  SeeAlso []
265 
266 ***********************************************************************/
267 int CmdApplyAlias( Abc_Frame_t * pAbc, int *argcp, char ***argvp, int *loop )
268 {
269  int i, argc, stopit, added, offset, did_subst, subst, fError, newc, j;
270  const char *arg;
271  char **argv, **newv;
272  Abc_Alias *alias;
273 
274  argc = *argcp;
275  argv = *argvp;
276  stopit = 0;
277  for ( ; *loop < 200; ( *loop )++ )
278  {
279  if ( argc == 0 )
280  return 0;
281  if ( stopit != 0 || st__lookup( pAbc->tAliases, argv[0], (char **) &alias ) == 0 )
282  {
283  return 0;
284  }
285  if ( strcmp( argv[0], alias->argv[0] ) == 0 )
286  {
287  stopit = 1;
288  }
289  ABC_FREE( argv[0] );
290  added = alias->argc - 1;
291 
292  /* shift all the arguments to the right */
293  if ( added != 0 )
294  {
295  argv = ABC_REALLOC( char *, argv, argc + added );
296  for ( i = argc - 1; i >= 1; i-- )
297  {
298  argv[i + added] = argv[i];
299  }
300  for ( i = 1; i <= added; i++ )
301  {
302  argv[i] = NULL;
303  }
304  argc += added;
305  }
306  subst = 0;
307  for ( i = 0, offset = 0; i < alias->argc; i++, offset++ )
308  {
309  arg = CmdHistorySubstitution( pAbc, alias->argv[i], &did_subst );
310  if ( arg == NULL )
311  {
312  *argcp = argc;
313  *argvp = argv;
314  return ( 1 );
315  }
316  if ( did_subst != 0 )
317  {
318  subst = 1;
319  }
320  fError = 0;
321  do
322  {
323  arg = CmdSplitLine( pAbc, arg, &newc, &newv );
324  /*
325  * If there's a complete `;' terminated command in `arg',
326  * when split_line() returns arg[0] != '\0'.
327  */
328  if ( arg[0] == '\0' )
329  { /* just a bunch of words */
330  break;
331  }
332  fError = CmdApplyAlias( pAbc, &newc, &newv, loop );
333  if ( fError == 0 )
334  {
335  fError = CmdCommandDispatch( pAbc, &newc, &newv );
336  }
337  CmdFreeArgv( newc, newv );
338  }
339  while ( fError == 0 );
340  if ( fError != 0 )
341  {
342  *argcp = argc;
343  *argvp = argv;
344  return ( 1 );
345  }
346  added = newc - 1;
347  if ( added != 0 )
348  {
349  argv = ABC_REALLOC( char *, argv, argc + added );
350  for ( j = argc - 1; j > offset; j-- )
351  {
352  argv[j + added] = argv[j];
353  }
354  argc += added;
355  }
356  for ( j = 0; j <= added; j++ )
357  {
358  argv[j + offset] = newv[j];
359  }
360  ABC_FREE( newv );
361  offset += added;
362  }
363  if ( subst == 1 )
364  {
365  for ( i = offset; i < argc; i++ )
366  {
367  ABC_FREE( argv[i] );
368  }
369  argc = offset;
370  }
371  *argcp = argc;
372  *argvp = argv;
373  }
374 
375  fprintf( pAbc->Err, "** cmd warning: alias loop\n" );
376  return 1;
377 }
378 
379 /**Function*************************************************************
380 
381  Synopsis [Performs history substitution (now, disabled).]
382 
383  Description []
384 
385  SideEffects []
386 
387  SeeAlso []
388 
389 ***********************************************************************/
390 char * CmdHistorySubstitution( Abc_Frame_t * pAbc, char *line, int *changed )
391 {
392  // as of today, no history substitution
393  *changed = 0;
394  return line;
395 }
396 
397 /**Function*************************************************************
398 
399  Synopsis [Opens the file with path (now, disabled).]
400 
401  Description []
402 
403  SideEffects []
404 
405  SeeAlso []
406 
407 ***********************************************************************/
408 FILE * CmdFileOpen( Abc_Frame_t * pAbc, char *sFileName, char *sMode, char **pFileNameReal, int silent )
409 {
410  char * sRealName, * sPathUsr, * sPathLib, * sPathAll;
411  FILE * pFile;
412 
413  if (strcmp(sFileName, "-") == 0) {
414  if (strcmp(sMode, "w") == 0) {
415  sRealName = Extra_UtilStrsav( "stdout" );
416  pFile = stdout;
417  }
418  else {
419  sRealName = Extra_UtilStrsav( "stdin" );
420  pFile = stdin;
421  }
422  }
423  else {
424  sRealName = NULL;
425  if (strcmp(sMode, "r") == 0) {
426 
427  /* combine both pathes if exist */
428  sPathUsr = Cmd_FlagReadByName(pAbc,"open_path");
429  sPathLib = Cmd_FlagReadByName(pAbc,"lib_path");
430 
431  if ( sPathUsr == NULL && sPathLib == NULL ) {
432  sPathAll = NULL;
433  }
434  else if ( sPathUsr == NULL ) {
435  sPathAll = Extra_UtilStrsav( sPathLib );
436  }
437  else if ( sPathLib == NULL ) {
438  sPathAll = Extra_UtilStrsav( sPathUsr );
439  }
440  else {
441  sPathAll = ABC_ALLOC( char, strlen(sPathLib)+strlen(sPathUsr)+5 );
442  sprintf( sPathAll, "%s:%s",sPathUsr, sPathLib );
443  }
444  if ( sPathAll != NULL ) {
445  sRealName = Extra_UtilFileSearch(sFileName, sPathAll, "r");
446  ABC_FREE( sPathAll );
447  }
448  }
449  if (sRealName == NULL) {
450  sRealName = Extra_UtilTildeExpand(sFileName);
451  }
452 
453  if ((pFile = fopen(sRealName, sMode)) == NULL) {
454  if (! silent) {
455 // perror(sRealName);
456  Abc_Print( 1, "Cannot open file \"%s\".\n", sRealName );
457  }
458  }
459  else
460  {
461  // print the path/name of the resource file 'abc.rc' that is being loaded
462  if ( !silent && strlen(sRealName) >= 6 && strcmp( sRealName + strlen(sRealName) - 6, "abc.rc" ) == 0 )
463  Abc_Print( 1, "Loading resource file \"%s\".\n", sRealName );
464  }
465  }
466  if ( pFileNameReal )
467  *pFileNameReal = sRealName;
468  else
469  ABC_FREE(sRealName);
470 
471  return pFile;
472 }
473 
474 /**Function*************************************************************
475 
476  Synopsis [Frees the previously allocated argv array.]
477 
478  Description []
479 
480  SideEffects []
481 
482  SeeAlso []
483 
484 ***********************************************************************/
485 void CmdFreeArgv( int argc, char **argv )
486 {
487  int i;
488  for ( i = 0; i < argc; i++ )
489  ABC_FREE( argv[i] );
490  ABC_FREE( argv );
491 }
492 char ** CmdDupArgv( int argc, char **argv )
493 {
494  char ** argvNew = ABC_ALLOC( char *, argc );
495  int i;
496  for ( i = 0; i < argc; i++ )
497  argvNew[i] = Abc_UtilStrsav( argv[i] );
498  return argvNew;
499 }
500 
501 /**Function*************************************************************
502 
503  Synopsis [Frees the previously allocated argv array.]
504 
505  Description []
506 
507  SideEffects []
508 
509  SeeAlso []
510 
511 ***********************************************************************/
512 char ** CmdAddToArgv( int argc, char ** argv )
513 {
514  char ** argv2;
515  int i;
516  argv2 = ABC_ALLOC( char *, argc + 1 );
517  argv2[0] = Extra_UtilStrsav( "read" );
518 // argv2[0] = Extra_UtilStrsav( "&r" );
519  for ( i = 0; i < argc; i++ )
520  argv2[i+1] = Extra_UtilStrsav( argv[i] );
521  return argv2;
522 }
523 
524 /**Function*************************************************************
525 
526  Synopsis [Frees the previously allocated command.]
527 
528  Description []
529 
530  SideEffects []
531 
532  SeeAlso []
533 
534 ***********************************************************************/
535 void CmdCommandFree( Abc_Command * pCommand )
536 {
537  ABC_FREE( pCommand->sGroup );
538  ABC_FREE( pCommand->sName );
539  ABC_FREE( pCommand );
540 }
541 
542 
543 /**Function*************************************************************
544 
545  Synopsis [Prints commands alphabetically by group.]
546 
547  Description []
548 
549  SideEffects []
550 
551  SeeAlso []
552 
553 ***********************************************************************/
554 void CmdCommandPrint( Abc_Frame_t * pAbc, int fPrintAll, int fDetails )
555 {
556  const char *key;
557  char *value;
558  st__generator * gen;
559  Abc_Command ** ppCommands;
560  Abc_Command * pCommands;
561  int nCommands, iGroupStart, i, j;
562  char * sGroupCur;
563  int LenghtMax, nColumns, iCom = 0;
564  FILE *backupErr = pAbc->Err;
565 
566  // put all commands into one array
567  nCommands = st__count( pAbc->tCommands );
568  ppCommands = ABC_ALLOC( Abc_Command *, nCommands );
569  i = 0;
570  st__foreach_item( pAbc->tCommands, gen, &key, &value )
571  {
572  pCommands = (Abc_Command *)value;
573  if ( fPrintAll || pCommands->sName[0] != '_' )
574  ppCommands[i++] = pCommands;
575  }
576  nCommands = i;
577 
578  // sort command by group and then by name, alphabetically
579  qsort( (void *)ppCommands, nCommands, sizeof(Abc_Command *),
580  (int (*)(const void *, const void *)) CmdCommandPrintCompare );
581  assert( CmdCommandPrintCompare( ppCommands, ppCommands + nCommands - 1 ) <= 0 );
582 
583  // get the longest command name
584  LenghtMax = 0;
585  for ( i = 0; i < nCommands; i++ )
586  if ( LenghtMax < (int)strlen(ppCommands[i]->sName) )
587  LenghtMax = (int)strlen(ppCommands[i]->sName);
588  // get the number of columns
589  nColumns = 79 / (LenghtMax + 2);
590 
591  // print the starting message
592  fprintf( pAbc->Out, " Welcome to ABC compiled on %s %s!", __DATE__, __TIME__ );
593 
594  // print the command by group
595  sGroupCur = NULL;
596  iGroupStart = 0;
597  pAbc->Err = pAbc->Out;
598  for ( i = 0; i < nCommands; i++ )
599  if ( sGroupCur && strcmp( sGroupCur, ppCommands[i]->sGroup ) == 0 )
600  { // this command belongs to the same group as the previous one
601  if ( iCom++ % nColumns == 0 )
602  fprintf( pAbc->Out, "\n" );
603  // print this command
604  fprintf( pAbc->Out, " %-*s", LenghtMax, ppCommands[i]->sName );
605  }
606  else
607  { // this command starts the new group of commands
608  // start the new group
609  if ( fDetails && i != iGroupStart )
610  { // print help messages for all commands in the previous groups
611  fprintf( pAbc->Out, "\n" );
612  for ( j = iGroupStart; j < i; j++ )
613  {
614  char *tmp_cmd;
615  fprintf( pAbc->Out, "\n" );
616  // fprintf( pAbc->Out, "--- %s ---\n", ppCommands[j]->sName );
617  tmp_cmd = ABC_ALLOC(char, strlen(ppCommands[j]->sName)+4);
618  (void) sprintf(tmp_cmd, "%s -h", ppCommands[j]->sName);
619  (void) Cmd_CommandExecute( pAbc, tmp_cmd );
620  ABC_FREE(tmp_cmd);
621  }
622  fprintf( pAbc->Out, "\n" );
623  fprintf( pAbc->Out, " ----------------------------------------------------------------------" );
624  iGroupStart = i;
625  }
626  fprintf( pAbc->Out, "\n" );
627  fprintf( pAbc->Out, "\n" );
628  fprintf( pAbc->Out, "%s commands:\n", ppCommands[i]->sGroup );
629  // print this command
630  fprintf( pAbc->Out, " %-*s", LenghtMax, ppCommands[i]->sName );
631  // remember current command group
632  sGroupCur = ppCommands[i]->sGroup;
633  // reset the command counter
634  iCom = 1;
635  }
636  if ( fDetails && i != iGroupStart )
637  { // print help messages for all commands in the previous groups
638  fprintf( pAbc->Out, "\n" );
639  for ( j = iGroupStart; j < i; j++ )
640  {
641  char *tmp_cmd;
642  fprintf( pAbc->Out, "\n" );
643  // fprintf( pAbc->Out, "--- %s ---\n", ppCommands[j]->sName );
644  tmp_cmd = ABC_ALLOC(char, strlen(ppCommands[j]->sName)+4);
645  (void) sprintf(tmp_cmd, "%s -h", ppCommands[j]->sName);
646  (void) Cmd_CommandExecute( pAbc, tmp_cmd );
647  ABC_FREE(tmp_cmd);
648  }
649  }
650  pAbc->Err = backupErr;
651  fprintf( pAbc->Out, "\n" );
652  ABC_FREE( ppCommands );
653 }
654 
655 /**Function*************************************************************
656 
657  Synopsis [Comparision function used for sorting commands.]
658 
659  Description []
660 
661  SideEffects []
662 
663  SeeAlso []
664 
665 ***********************************************************************/
667 {
668  Abc_Command * pC1 = *ppC1;
669  Abc_Command * pC2 = *ppC2;
670  int RetValue;
671 
672  RetValue = strcmp( pC1->sGroup, pC2->sGroup );
673  if ( RetValue < 0 )
674  return -1;
675  if ( RetValue > 0 )
676  return 1;
677  // the command belong to the same group
678 
679  // put commands with "_" at the end of the list
680  if ( pC1->sName[0] != '_' && pC2->sName[0] == '_' )
681  return -1;
682  if ( pC1->sName[0] == '_' && pC2->sName[0] != '_' )
683  return 1;
684 
685  RetValue = strcmp( pC1->sName, pC2->sName );
686  if ( RetValue < 0 )
687  return -1;
688  if ( RetValue > 0 )
689  return 1;
690  // should not be two indentical commands
691  assert( 0 );
692  return 0;
693 }
694 
695 /**Function*************************************************************
696 
697  Synopsis [Comparision function used for sorting commands.]
698 
699  Description []
700 
701  SideEffects []
702 
703  SeeAlso []
704 
705 ***********************************************************************/
706 int CmdNamePrintCompare( char ** ppC1, char ** ppC2 )
707 {
708  return strcmp( *ppC1, *ppC2 );
709 }
710 
711 /**Function*************************************************************
712 
713  Synopsis [Comparision function used for sorting commands.]
714 
715  Description []
716 
717  SideEffects []
718 
719  SeeAlso []
720 
721 ***********************************************************************/
722 void CmdPrintTable( st__table * tTable, int fAliases )
723 {
724  st__generator * gen;
725  const char ** ppNames;
726  const char * key;
727  char* value;
728  int nNames, i;
729 
730  // collect keys in the array
731  ppNames = ABC_ALLOC( const char *, st__count(tTable) );
732  nNames = 0;
733  st__foreach_item( tTable, gen, &key, &value )
734  ppNames[nNames++] = key;
735 
736  // sort array by name
737  qsort( (void *)ppNames, nNames, sizeof(char *),
738  (int (*)(const void *, const void *))CmdNamePrintCompare );
739 
740  // print in this order
741  for ( i = 0; i < nNames; i++ )
742  {
743  st__lookup( tTable, ppNames[i], &value );
744  if ( fAliases )
746  else
747  fprintf( stdout, "%-15s %-15s\n", ppNames[i], value );
748  }
749  ABC_FREE( ppNames );
750 }
751 
752 ////////////////////////////////////////////////////////////////////////
753 /// END OF FILE ///
754 ////////////////////////////////////////////////////////////////////////
756 
typedefABC_NAMESPACE_HEADER_START struct MvCommand Abc_Command
INCLUDES ///.
Definition: cmd.h:39
ABC_DLL void Abc_FrameSwapCurrentAndBackup(Abc_Frame_t *p)
Definition: mainFrame.c:451
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
const char * CmdSplitLine(Abc_Frame_t *pAbc, const char *sCommand, int *argc, char ***argv)
Definition: cmdUtils.c:181
char ** argv
Definition: cmdInt.h:55
int argc
Definition: cmdInt.h:54
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * Extra_UtilFileSearch(char *file, char *path, char *mode)
void CmdCommandPrint(Abc_Frame_t *pAbc, int fPrintAll, int fDetails)
Definition: cmdUtils.c:554
int Cmd_CommandExecute(void *pAbc, char *pCommandLine)
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
char * strncpy()
ABC_DLL void Abc_FrameSetCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
Definition: mainFrame.c:396
Definition: cmdInt.h:51
int CmdCommandDispatch(Abc_Frame_t *pAbc, int *pargc, char ***pargv)
Definition: cmdUtils.c:93
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * strncat()
void CmdPrintTable(st__table *tTable, int fAliases)
Definition: cmdUtils.c:722
double Extra_CpuTimeDouble()
static ABC_NAMESPACE_IMPL_START int CmdCommandPrintCompare(Abc_Command **ppC1, Abc_Command **ppC2)
DECLARATIONS ///.
Definition: cmdUtils.c:666
char * Extra_UtilStrsav(const char *s)
int strcmp()
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
#define st__count(table)
Definition: st.h:71
char * strstr()
Definition: st.h:52
int CmdNamePrintCompare(char **ppC1, char **ppC2)
Definition: cmdUtils.c:706
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
char ** CmdAddToArgv(int argc, char **argv)
Definition: cmdUtils.c:512
void * Abc_FrameGetGlobalFrame()
Definition: mainFrame.c:593
static int size
Definition: cuddSign.c:86
char * sprintf()
FILE * CmdFileOpen(Abc_Frame_t *pAbc, char *sFileName, char *sMode, char **pFileNameReal, int silent)
Definition: cmdUtils.c:408
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int system()
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
void CmdCommandAliasPrint(Abc_Frame_t *pAbc, Abc_Alias *pAlias)
Definition: cmdAlias.c:72
char ** CmdDupArgv(int argc, char **argv)
Definition: cmdUtils.c:492
int st__lookup(st__table *table, const char *key, char **value)
Definition: st.c:114
void CmdFreeArgv(int argc, char **argv)
Definition: cmdUtils.c:485
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
enum keys key
ABC_DLL int Abc_FrameIsFlagEnabled(char *pFlag)
Definition: mainFrame.c:113
int value
#define st__foreach_item(table, gen, key, value)
Definition: st.h:107
#define assert(ex)
Definition: util_old.h:213
int strlen()
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
char * Extra_UtilTildeExpand(char *fname)
char * Cmd_FlagReadByName(Abc_Frame_t *pAbc, char *flag)
DECLARATIONS ///.
Definition: cmdFlag.c:47
int cmdCheckShellEscape(Abc_Frame_t *pAbc, int argc, char **argv)
FUNCTION DEFINITIONS ///.
Definition: cmdUtils.c:50
void CmdCommandFree(Abc_Command *pCommand)
Definition: cmdUtils.c:535
int CmdApplyAlias(Abc_Frame_t *pAbc, int *argcp, char ***argvp, int *loop)
Definition: cmdUtils.c:267
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
char * CmdHistorySubstitution(Abc_Frame_t *pAbc, char *line, int *changed)
Definition: cmdUtils.c:390
static void ** Vec_PtrReleaseArray(Vec_Ptr_t *p)
Definition: vecPtr.h:259