abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
vecStr.h File Reference
#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  Vec_Str_t_
 

Macros

#define Vec_StrForEachEntry(vVec, Entry, i)   for ( i = 0; (i < Vec_StrSize(vVec)) && (((Entry) = Vec_StrEntry(vVec, i)), 1); i++ )
 MACRO DEFINITIONS ///. More...
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Vec_Str_t_ 
Vec_Str_t
 INCLUDES ///. More...
 

Functions

static Vec_Str_tVec_StrAlloc (int nCap)
 FUNCTION DEFINITIONS ///. More...
 
static Vec_Str_tVec_StrStart (int nSize)
 
static Vec_Str_tVec_StrAllocArray (char *pArray, int nSize)
 
static Vec_Str_tVec_StrAllocArrayCopy (char *pArray, int nSize)
 
static Vec_Str_tVec_StrDup (Vec_Str_t *pVec)
 
static Vec_Str_tVec_StrDupArray (Vec_Str_t *pVec)
 
static void Vec_StrZero (Vec_Str_t *p)
 
static void Vec_StrErase (Vec_Str_t *p)
 
static void Vec_StrFree (Vec_Str_t *p)
 
static void Vec_StrFreeP (Vec_Str_t **p)
 
static char * Vec_StrReleaseArray (Vec_Str_t *p)
 
static char * Vec_StrArray (Vec_Str_t *p)
 
static int Vec_StrSize (Vec_Str_t *p)
 
static int Vec_StrCap (Vec_Str_t *p)
 
static double Vec_StrMemory (Vec_Str_t *p)
 
static char Vec_StrEntry (Vec_Str_t *p, int i)
 
static char * Vec_StrEntryP (Vec_Str_t *p, int i)
 
static void Vec_StrWriteEntry (Vec_Str_t *p, int i, char Entry)
 
static char Vec_StrEntryLast (Vec_Str_t *p)
 
static void Vec_StrGrow (Vec_Str_t *p, int nCapMin)
 
static void Vec_StrFill (Vec_Str_t *p, int nSize, char Fill)
 
static void Vec_StrFillExtra (Vec_Str_t *p, int nSize, char Fill)
 
static char Vec_StrGetEntry (Vec_Str_t *p, int i)
 
static void Vec_StrSetEntry (Vec_Str_t *p, int i, char Entry)
 
static void Vec_StrShrink (Vec_Str_t *p, int nSizeNew)
 
static void Vec_StrClear (Vec_Str_t *p)
 
static void Vec_StrPush (Vec_Str_t *p, char Entry)
 
static char Vec_StrPop (Vec_Str_t *p)
 
static void Vec_StrPrintNum (Vec_Str_t *p, int Num)
 
static void Vec_StrPrintNumStar (Vec_Str_t *p, int Num, int nDigits)
 
static void Vec_StrPrintStr (Vec_Str_t *p, const char *pStr)
 
static void Vec_StrAppend (Vec_Str_t *p, const char *pString)
 
static void Vec_StrCopy (Vec_Str_t *p, const char *pString)
 
static void Vec_StrReverseOrder (Vec_Str_t *p)
 
static int Vec_StrSum (Vec_Str_t *p)
 
static int Vec_StrEqual (Vec_Str_t *p1, Vec_Str_t *p2)
 
static int Vec_StrSortCompare1 (char *pp1, char *pp2)
 
static int Vec_StrSortCompare2 (char *pp1, char *pp2)
 
static void Vec_StrSort (Vec_Str_t *p, int fReverse)
 
static int Vec_StrCompareVec (Vec_Str_t *p1, Vec_Str_t *p2)
 
static void Vec_StrPutI_ne (Vec_Str_t *vOut, int Val)
 
static int Vec_StrGetI_ne (Vec_Str_t *vOut, int *pPos)
 
static void Vec_StrPutI (Vec_Str_t *vOut, int Val)
 
static int Vec_StrGetI (Vec_Str_t *vOut, int *pPos)
 
static void Vec_StrPutW (Vec_Str_t *vOut, word Val)
 
static word Vec_StrGetW (Vec_Str_t *vOut, int *pPos)
 
static void Vec_StrPutF (Vec_Str_t *vOut, float Val)
 
static float Vec_StrGetF (Vec_Str_t *vOut, int *pPos)
 
static void Vec_StrPutD (Vec_Str_t *vOut, double Val)
 
static double Vec_StrGetD (Vec_Str_t *vOut, int *pPos)
 
static void Vec_StrPutS (Vec_Str_t *vOut, char *pStr)
 
static char * Vec_StrGetS (Vec_Str_t *vOut, int *pPos)
 
static void Vec_StrPutC (Vec_Str_t *vOut, char c)
 
static char Vec_StrGetC (Vec_Str_t *vOut, int *pPos)
 

Macro Definition Documentation

#define Vec_StrForEachEntry (   vVec,
  Entry,
 
)    for ( i = 0; (i < Vec_StrSize(vVec)) && (((Entry) = Vec_StrEntry(vVec, i)), 1); i++ )

MACRO DEFINITIONS ///.

Definition at line 54 of file vecStr.h.

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Vec_Str_t_ Vec_Str_t

INCLUDES ///.

CFile****************************************************************

FileName [vecStr.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Resizable arrays.]

Synopsis [Resizable arrays of characters.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
vecStr.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 42 of file vecStr.h.

Function Documentation

static Vec_Str_t* Vec_StrAlloc ( int  nCap)
inlinestatic

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Allocates a vector with the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 72 of file vecStr.h.

73 {
74  Vec_Str_t * p;
75  p = ABC_ALLOC( Vec_Str_t, 1 );
76  if ( nCap > 0 && nCap < 16 )
77  nCap = 16;
78  p->nSize = 0;
79  p->nCap = nCap;
80  p->pArray = p->nCap? ABC_ALLOC( char, p->nCap ) : NULL;
81  return p;
82 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * pArray
Definition: bblif.c:51
int nSize
Definition: bblif.c:50
int nCap
Definition: bblif.c:49
static Vec_Str_t* Vec_StrAllocArray ( char *  pArray,
int  nSize 
)
inlinestatic

Function*************************************************************

Synopsis [Creates the vector from an integer array of the given size.]

Description []

SideEffects []

SeeAlso []

Definition at line 115 of file vecStr.h.

116 {
117  Vec_Str_t * p;
118  p = ABC_ALLOC( Vec_Str_t, 1 );
119  p->nSize = nSize;
120  p->nCap = nSize;
121  p->pArray = pArray;
122  return p;
123 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * pArray
Definition: bblif.c:51
int nSize
Definition: bblif.c:50
int nCap
Definition: bblif.c:49
static Vec_Str_t* Vec_StrAllocArrayCopy ( char *  pArray,
int  nSize 
)
inlinestatic

Function*************************************************************

Synopsis [Creates the vector from an integer array of the given size.]

Description []

SideEffects []

SeeAlso []

Definition at line 136 of file vecStr.h.

137 {
138  Vec_Str_t * p;
139  p = ABC_ALLOC( Vec_Str_t, 1 );
140  p->nSize = nSize;
141  p->nCap = nSize;
142  p->pArray = ABC_ALLOC( char, nSize );
143  memcpy( p->pArray, pArray, sizeof(char) * nSize );
144  return p;
145 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * pArray
Definition: bblif.c:51
int nSize
Definition: bblif.c:50
int nCap
Definition: bblif.c:49
static void Vec_StrAppend ( Vec_Str_t p,
const char *  pString 
)
inlinestatic

Function*************************************************************

Synopsis [Appends the string to the char vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 645 of file vecStr.h.

646 {
647  Vec_StrPrintStr( p, pString );
648 }
static void Vec_StrPrintStr(Vec_Str_t *p, const char *pStr)
Definition: vecStr.h:627
static char* Vec_StrArray ( Vec_Str_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 272 of file vecStr.h.

273 {
274  return p->pArray;
275 }
char * pArray
Definition: bblif.c:51
static int Vec_StrCap ( Vec_Str_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 304 of file vecStr.h.

305 {
306  return p->nCap;
307 }
int nCap
Definition: bblif.c:49
static void Vec_StrClear ( Vec_Str_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 519 of file vecStr.h.

520 {
521  p->nSize = 0;
522 }
int nSize
Definition: bblif.c:50
static int Vec_StrCompareVec ( Vec_Str_t p1,
Vec_Str_t p2 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 793 of file vecStr.h.

794 {
795  if ( p1 == NULL || p2 == NULL )
796  return (p1 != NULL) - (p2 != NULL);
797  if ( Vec_StrSize(p1) != Vec_StrSize(p2) )
798  return Vec_StrSize(p1) - Vec_StrSize(p2);
799  return memcmp( Vec_StrArray(p1), Vec_StrArray(p2), Vec_StrSize(p1) );
800 }
static char * Vec_StrArray(Vec_Str_t *p)
Definition: vecStr.h:272
int memcmp()
static int Vec_StrSize(Vec_Str_t *p)
Definition: vecStr.h:288
static void Vec_StrCopy ( Vec_Str_t p,
const char *  pString 
)
inlinestatic

Definition at line 649 of file vecStr.h.

650 {
651  Vec_StrClear( p );
652  Vec_StrAppend( p, pString );
653  Vec_StrPush( p, '\0' );
654 }
static void Vec_StrClear(Vec_Str_t *p)
Definition: vecStr.h:519
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static void Vec_StrAppend(Vec_Str_t *p, const char *pString)
Definition: vecStr.h:645
static Vec_Str_t* Vec_StrDup ( Vec_Str_t pVec)
inlinestatic

Function*************************************************************

Synopsis [Duplicates the integer array.]

Description []

SideEffects []

SeeAlso []

Definition at line 158 of file vecStr.h.

159 {
160  Vec_Str_t * p;
161  p = ABC_ALLOC( Vec_Str_t, 1 );
162  p->nSize = pVec->nSize;
163  p->nCap = pVec->nCap;
164  p->pArray = p->nCap? ABC_ALLOC( char, p->nCap ) : NULL;
165  memcpy( p->pArray, pVec->pArray, sizeof(char) * pVec->nSize );
166  return p;
167 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * pArray
Definition: bblif.c:51
int nSize
Definition: bblif.c:50
int nCap
Definition: bblif.c:49
static Vec_Str_t* Vec_StrDupArray ( Vec_Str_t pVec)
inlinestatic

Function*************************************************************

Synopsis [Transfers the array into another vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 180 of file vecStr.h.

181 {
182  Vec_Str_t * p;
183  p = ABC_ALLOC( Vec_Str_t, 1 );
184  p->nSize = pVec->nSize;
185  p->nCap = pVec->nCap;
186  p->pArray = pVec->pArray;
187  pVec->nSize = 0;
188  pVec->nCap = 0;
189  pVec->pArray = NULL;
190  return p;
191 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * pArray
Definition: bblif.c:51
int nSize
Definition: bblif.c:50
int nCap
Definition: bblif.c:49
static char Vec_StrEntry ( Vec_Str_t p,
int  i 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 336 of file vecStr.h.

337 {
338  assert( i >= 0 && i < p->nSize );
339  return p->pArray[i];
340 }
char * pArray
Definition: bblif.c:51
#define assert(ex)
Definition: util_old.h:213
static char Vec_StrEntryLast ( Vec_Str_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 387 of file vecStr.h.

388 {
389  assert( p->nSize > 0 );
390  return p->pArray[p->nSize-1];
391 }
char * pArray
Definition: bblif.c:51
int nSize
Definition: bblif.c:50
#define assert(ex)
Definition: util_old.h:213
static char* Vec_StrEntryP ( Vec_Str_t p,
int  i 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 353 of file vecStr.h.

354 {
355  assert( i >= 0 && i < p->nSize );
356  return p->pArray + i;
357 }
char * pArray
Definition: bblif.c:51
#define assert(ex)
Definition: util_old.h:213
static int Vec_StrEqual ( Vec_Str_t p1,
Vec_Str_t p2 
)
inlinestatic

Function*************************************************************

Synopsis [Compares two strings.]

Description []

SideEffects []

SeeAlso []

Definition at line 708 of file vecStr.h.

709 {
710  int i;
711  if ( p1->nSize != p2->nSize )
712  return 0;
713  for ( i = 0; i < p1->nSize; i++ )
714  if ( p1->pArray[i] != p2->pArray[i] )
715  return 0;
716  return 1;
717 }
char * pArray
Definition: bblif.c:51
int nSize
Definition: bblif.c:50
static void Vec_StrErase ( Vec_Str_t p)
inlinestatic

Definition at line 210 of file vecStr.h.

211 {
212  ABC_FREE( p->pArray );
213  p->nSize = 0;
214  p->nCap = 0;
215 }
char * pArray
Definition: bblif.c:51
#define ABC_FREE(obj)
Definition: abc_global.h:232
int nSize
Definition: bblif.c:50
int nCap
Definition: bblif.c:49
static void Vec_StrFill ( Vec_Str_t p,
int  nSize,
char  Fill 
)
inlinestatic

Function*************************************************************

Synopsis [Fills the vector with given number of entries.]

Description []

SideEffects []

SeeAlso []

Definition at line 423 of file vecStr.h.

424 {
425  int i;
426  Vec_StrGrow( p, nSize );
427  p->nSize = nSize;
428  for ( i = 0; i < p->nSize; i++ )
429  p->pArray[i] = Fill;
430 }
static void Vec_StrGrow(Vec_Str_t *p, int nCapMin)
Definition: vecStr.h:404
char * pArray
Definition: bblif.c:51
int nSize
Definition: bblif.c:50
static void Vec_StrFillExtra ( Vec_Str_t p,
int  nSize,
char  Fill 
)
inlinestatic

Function*************************************************************

Synopsis [Fills the vector with given number of entries.]

Description []

SideEffects []

SeeAlso []

Definition at line 443 of file vecStr.h.

444 {
445  int i;
446  if ( nSize <= p->nSize )
447  return;
448  if ( nSize > 2 * p->nCap )
449  Vec_StrGrow( p, nSize );
450  else if ( nSize > p->nCap )
451  Vec_StrGrow( p, 2 * p->nCap );
452  for ( i = p->nSize; i < nSize; i++ )
453  p->pArray[i] = Fill;
454  p->nSize = nSize;
455 }
static void Vec_StrGrow(Vec_Str_t *p, int nCapMin)
Definition: vecStr.h:404
char * pArray
Definition: bblif.c:51
int nSize
Definition: bblif.c:50
int nCap
Definition: bblif.c:49
static void Vec_StrFree ( Vec_Str_t p)
inlinestatic

Definition at line 216 of file vecStr.h.

217 {
218  ABC_FREE( p->pArray );
219  ABC_FREE( p );
220 }
char * pArray
Definition: bblif.c:51
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_StrFreeP ( Vec_Str_t **  p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 233 of file vecStr.h.

234 {
235  if ( *p == NULL )
236  return;
237  ABC_FREE( (*p)->pArray );
238  ABC_FREE( (*p) );
239 }
#define ABC_FREE(obj)
Definition: abc_global.h:232
static char Vec_StrGetC ( Vec_Str_t vOut,
int *  pPos 
)
inlinestatic

Definition at line 914 of file vecStr.h.

915 {
916  return Vec_StrEntry(vOut, (*pPos)++);
917 }
static char Vec_StrEntry(Vec_Str_t *p, int i)
Definition: vecStr.h:336
static double Vec_StrGetD ( Vec_Str_t vOut,
int *  pPos 
)
inlinestatic

Definition at line 888 of file vecStr.h.

889 {
890  union { double num; unsigned char data[8]; } tmp;
891  int i, Lim = sizeof(double);
892  for ( i = 0; i < Lim; i++ )
893  tmp.data[i] = Vec_StrEntry( vOut, (*pPos)++ );
894  return tmp.num;
895 }
static char Vec_StrEntry(Vec_Str_t *p, int i)
Definition: vecStr.h:336
static char Vec_StrGetEntry ( Vec_Str_t p,
int  i 
)
inlinestatic

Function*************************************************************

Synopsis [Returns the entry even if the place not exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 468 of file vecStr.h.

469 {
470  Vec_StrFillExtra( p, i + 1, 0 );
471  return Vec_StrEntry( p, i );
472 }
static void Vec_StrFillExtra(Vec_Str_t *p, int nSize, char Fill)
Definition: vecStr.h:443
static char Vec_StrEntry(Vec_Str_t *p, int i)
Definition: vecStr.h:336
static float Vec_StrGetF ( Vec_Str_t vOut,
int *  pPos 
)
inlinestatic

Definition at line 870 of file vecStr.h.

871 {
872  union { float num; unsigned char data[4]; } tmp;
873  tmp.data[0] = Vec_StrEntry( vOut, (*pPos)++ );
874  tmp.data[1] = Vec_StrEntry( vOut, (*pPos)++ );
875  tmp.data[2] = Vec_StrEntry( vOut, (*pPos)++ );
876  tmp.data[3] = Vec_StrEntry( vOut, (*pPos)++ );
877  return tmp.num;
878 }
static char Vec_StrEntry(Vec_Str_t *p, int i)
Definition: vecStr.h:336
static int Vec_StrGetI ( Vec_Str_t vOut,
int *  pPos 
)
inlinestatic

Definition at line 837 of file vecStr.h.

838 {
839  unsigned char ch;
840  int i = 0, Val = 0;
841  while ( (ch = Vec_StrEntry(vOut, (*pPos)++)) & 0x80 )
842  Val |= ((ch & 0x7f) << (7 * i++));
843  return Val | (ch << (7 * i));
844 }
static char Vec_StrEntry(Vec_Str_t *p, int i)
Definition: vecStr.h:336
static int Vec_StrGetI_ne ( Vec_Str_t vOut,
int *  pPos 
)
inlinestatic

Definition at line 821 of file vecStr.h.

822 {
823  int i;
824  int Val = 0;
825 // for ( i = 0; i < 4; i++ )
826  for ( i = 3; i >= 0; i-- )
827  Val |= ((int)(unsigned char)Vec_StrEntry(vOut, (*pPos)++) << (8*i));
828  return Val;
829 }
static char Vec_StrEntry(Vec_Str_t *p, int i)
Definition: vecStr.h:336
static char* Vec_StrGetS ( Vec_Str_t vOut,
int *  pPos 
)
inlinestatic

Definition at line 903 of file vecStr.h.

904 {
905  char * pStr = Vec_StrEntryP( vOut, *pPos );
906  while ( Vec_StrEntry(vOut, (*pPos)++) );
907  return Abc_UtilStrsav(pStr);
908 }
static char Vec_StrEntry(Vec_Str_t *p, int i)
Definition: vecStr.h:336
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static char * Vec_StrEntryP(Vec_Str_t *p, int i)
Definition: vecStr.h:353
static word Vec_StrGetW ( Vec_Str_t vOut,
int *  pPos 
)
inlinestatic

Definition at line 852 of file vecStr.h.

853 {
854  int i;
855  word Val = 0;
856  for ( i = 0; i < 8; i++ )
857  Val |= ((word)(unsigned char)Vec_StrEntry(vOut, (*pPos)++) << (8*i));
858  return Val;
859 }
static char Vec_StrEntry(Vec_Str_t *p, int i)
Definition: vecStr.h:336
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_StrGrow ( Vec_Str_t p,
int  nCapMin 
)
inlinestatic

Function*************************************************************

Synopsis [Resizes the vector to the given capacity.]

Description []

SideEffects []

SeeAlso []

Definition at line 404 of file vecStr.h.

405 {
406  if ( p->nCap >= nCapMin )
407  return;
408  p->pArray = ABC_REALLOC( char, p->pArray, nCapMin );
409  p->nCap = nCapMin;
410 }
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
char * pArray
Definition: bblif.c:51
int nCap
Definition: bblif.c:49
static double Vec_StrMemory ( Vec_Str_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 320 of file vecStr.h.

321 {
322  return !p ? 0.0 : 1.0 * sizeof(char) * p->nCap + sizeof(Vec_Str_t);
323 }
int nCap
Definition: bblif.c:49
static char Vec_StrPop ( Vec_Str_t p)
inlinestatic

Function*************************************************************

Synopsis [Returns the last entry and removes it from the list.]

Description []

SideEffects []

SeeAlso []

Definition at line 558 of file vecStr.h.

559 {
560  assert( p->nSize > 0 );
561  return p->pArray[--p->nSize];
562 }
char * pArray
Definition: bblif.c:51
int nSize
Definition: bblif.c:50
#define assert(ex)
Definition: util_old.h:213
static void Vec_StrPrintNum ( Vec_Str_t p,
int  Num 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 575 of file vecStr.h.

576 {
577  int i;
578  char Digits[16];
579  if ( Num == 0 )
580  {
581  Vec_StrPush( p, '0' );
582  return;
583  }
584  if ( Num < 0 )
585  {
586  Vec_StrPush( p, '-' );
587  Num = -Num;
588  }
589  for ( i = 0; Num; Num /= 10, i++ )
590  Digits[i] = Num % 10;
591  for ( i--; i >= 0; i-- )
592  Vec_StrPush( p, (char)('0' + Digits[i]) );
593 }
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static void Vec_StrPrintNumStar ( Vec_Str_t p,
int  Num,
int  nDigits 
)
inlinestatic

Definition at line 594 of file vecStr.h.

595 {
596  int i;
597  char Digits[16] = {0};
598  if ( Num == 0 )
599  {
600  for ( i = 0; i < nDigits; i++ )
601  Vec_StrPush( p, '0' );
602  return;
603  }
604  if ( Num < 0 )
605  {
606  Vec_StrPush( p, '-' );
607  Num = -Num;
608  nDigits--;
609  }
610  for ( i = 0; Num; Num /= 10, i++ )
611  Digits[i] = Num % 10;
612  for ( i = Abc_MaxInt(i, nDigits)-1; i >= 0; i-- )
613  Vec_StrPush( p, (char)('0' + Digits[i]) );
614 }
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static void Vec_StrPrintStr ( Vec_Str_t p,
const char *  pStr 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 627 of file vecStr.h.

628 {
629  int i, Length = strlen(pStr);
630  for ( i = 0; i < Length; i++ )
631  Vec_StrPush( p, pStr[i] );
632 }
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
int strlen()
static void Vec_StrPush ( Vec_Str_t p,
char  Entry 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 535 of file vecStr.h.

536 {
537  if ( p->nSize == p->nCap )
538  {
539  if ( p->nCap < 16 )
540  Vec_StrGrow( p, 16 );
541  else
542  Vec_StrGrow( p, 2 * p->nCap );
543  }
544  p->pArray[p->nSize++] = Entry;
545 }
static void Vec_StrGrow(Vec_Str_t *p, int nCapMin)
Definition: vecStr.h:404
char * pArray
Definition: bblif.c:51
int nSize
Definition: bblif.c:50
int nCap
Definition: bblif.c:49
static void Vec_StrPutC ( Vec_Str_t vOut,
char  c 
)
inlinestatic

Definition at line 910 of file vecStr.h.

911 {
912  Vec_StrPush( vOut, c );
913 }
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static void Vec_StrPutD ( Vec_Str_t vOut,
double  Val 
)
inlinestatic

Definition at line 880 of file vecStr.h.

881 {
882  union { double num; unsigned char data[8]; } tmp;
883  int i, Lim = sizeof(double);
884  tmp.num = Val;
885  for ( i = 0; i < Lim; i++ )
886  Vec_StrPush( vOut, tmp.data[i] );
887 }
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static void Vec_StrPutF ( Vec_Str_t vOut,
float  Val 
)
inlinestatic

Definition at line 861 of file vecStr.h.

862 {
863  union { float num; unsigned char data[4]; } tmp;
864  tmp.num = Val;
865  Vec_StrPush( vOut, tmp.data[0] );
866  Vec_StrPush( vOut, tmp.data[1] );
867  Vec_StrPush( vOut, tmp.data[2] );
868  Vec_StrPush( vOut, tmp.data[3] );
869 }
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static void Vec_StrPutI ( Vec_Str_t vOut,
int  Val 
)
inlinestatic

Definition at line 831 of file vecStr.h.

832 {
833  for ( ; Val >= 0x80; Val >>= 7 )
834  Vec_StrPush( vOut, (unsigned char)(Val | 0x80) );
835  Vec_StrPush( vOut, (unsigned char)Val );
836 }
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static void Vec_StrPutI_ne ( Vec_Str_t vOut,
int  Val 
)
inlinestatic

Function*************************************************************

Synopsis [Binary I/O for numbers (int/float/etc) and strings (char *).]

Description []

SideEffects []

SeeAlso []

Definition at line 814 of file vecStr.h.

815 {
816  int i;
817 // for ( i = 0; i < 4; i++ )
818  for ( i = 3; i >= 0; i-- )
819  Vec_StrPush( vOut, (char)(Val >> (8*i)) );
820 }
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static void Vec_StrPutS ( Vec_Str_t vOut,
char *  pStr 
)
inlinestatic

Definition at line 897 of file vecStr.h.

898 {
899  while ( *pStr )
900  Vec_StrPush( vOut, *pStr++ );
901  Vec_StrPush( vOut, (char)0 );
902 }
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static void Vec_StrPutW ( Vec_Str_t vOut,
word  Val 
)
inlinestatic

Definition at line 846 of file vecStr.h.

847 {
848  int i;
849  for ( i = 0; i < 8; i++ )
850  Vec_StrPush( vOut, (char)(Val >> (8*i)) );
851 }
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static char* Vec_StrReleaseArray ( Vec_Str_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 252 of file vecStr.h.

253 {
254  char * pArray = p->pArray;
255  p->nCap = 0;
256  p->nSize = 0;
257  p->pArray = NULL;
258  return pArray;
259 }
char * pArray
Definition: bblif.c:51
int nSize
Definition: bblif.c:50
int nCap
Definition: bblif.c:49
static void Vec_StrReverseOrder ( Vec_Str_t p)
inlinestatic

Function*************************************************************

Synopsis [Reverses the order of entries.]

Description []

SideEffects []

SeeAlso []

Definition at line 667 of file vecStr.h.

668 {
669  int i, Temp;
670  for ( i = 0; i < p->nSize/2; i++ )
671  {
672  Temp = p->pArray[i];
673  p->pArray[i] = p->pArray[p->nSize-1-i];
674  p->pArray[p->nSize-1-i] = Temp;
675  }
676 }
char * pArray
Definition: bblif.c:51
int nSize
Definition: bblif.c:50
static void Vec_StrSetEntry ( Vec_Str_t p,
int  i,
char  Entry 
)
inlinestatic

Function*************************************************************

Synopsis [Inserts the entry even if the place does not exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 485 of file vecStr.h.

486 {
487  Vec_StrFillExtra( p, i + 1, 0 );
488  Vec_StrWriteEntry( p, i, Entry );
489 }
static void Vec_StrFillExtra(Vec_Str_t *p, int nSize, char Fill)
Definition: vecStr.h:443
static void Vec_StrWriteEntry(Vec_Str_t *p, int i, char Entry)
Definition: vecStr.h:370
static void Vec_StrShrink ( Vec_Str_t p,
int  nSizeNew 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 502 of file vecStr.h.

503 {
504  assert( p->nSize >= nSizeNew );
505  p->nSize = nSizeNew;
506 }
int nSize
Definition: bblif.c:50
#define assert(ex)
Definition: util_old.h:213
static int Vec_StrSize ( Vec_Str_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 288 of file vecStr.h.

289 {
290  return p->nSize;
291 }
int nSize
Definition: bblif.c:50
static void Vec_StrSort ( Vec_Str_t p,
int  fReverse 
)
inlinestatic

Function*************************************************************

Synopsis [Sorting the entries by their integer value.]

Description []

SideEffects []

SeeAlso []

Definition at line 772 of file vecStr.h.

773 {
774  if ( fReverse )
775  qsort( (void *)p->pArray, p->nSize, sizeof(char),
776  (int (*)(const void *, const void *)) Vec_StrSortCompare2 );
777  else
778  qsort( (void *)p->pArray, p->nSize, sizeof(char),
779  (int (*)(const void *, const void *)) Vec_StrSortCompare1 );
780 }
static int Vec_StrSortCompare2(char *pp1, char *pp2)
Definition: vecStr.h:751
char * pArray
Definition: bblif.c:51
static int Vec_StrSortCompare1(char *pp1, char *pp2)
Definition: vecStr.h:730
int nSize
Definition: bblif.c:50
static int Vec_StrSortCompare1 ( char *  pp1,
char *  pp2 
)
static

Function*************************************************************

Synopsis [Comparison procedure for two clauses.]

Description []

SideEffects []

SeeAlso []

Definition at line 730 of file vecStr.h.

731 {
732  // for some reason commenting out lines (as shown) led to crashing of the release version
733  if ( *pp1 < *pp2 )
734  return -1;
735  if ( *pp1 > *pp2 ) //
736  return 1;
737  return 0; //
738 }
static int Vec_StrSortCompare2 ( char *  pp1,
char *  pp2 
)
static

Function*************************************************************

Synopsis [Comparison procedure for two clauses.]

Description []

SideEffects []

SeeAlso []

Definition at line 751 of file vecStr.h.

752 {
753  // for some reason commenting out lines (as shown) led to crashing of the release version
754  if ( *pp1 > *pp2 )
755  return -1;
756  if ( *pp1 < *pp2 ) //
757  return 1;
758  return 0; //
759 }
static Vec_Str_t* Vec_StrStart ( int  nSize)
inlinestatic

Function*************************************************************

Synopsis [Allocates a vector with the given size and cleans it.]

Description []

SideEffects []

SeeAlso []

Definition at line 95 of file vecStr.h.

96 {
97  Vec_Str_t * p;
98  p = Vec_StrAlloc( nSize );
99  p->nSize = nSize;
100  memset( p->pArray, 0, sizeof(char) * nSize );
101  return p;
102 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * pArray
Definition: bblif.c:51
static Vec_Str_t * Vec_StrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecStr.h:72
int nSize
Definition: bblif.c:50
static int Vec_StrSum ( Vec_Str_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 689 of file vecStr.h.

690 {
691  int i, Counter = 0;
692  for ( i = 0; i < p->nSize; i++ )
693  Counter += (int)p->pArray[i];
694  return Counter;
695 }
char * pArray
Definition: bblif.c:51
static int Counter
int nSize
Definition: bblif.c:50
static void Vec_StrWriteEntry ( Vec_Str_t p,
int  i,
char  Entry 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 370 of file vecStr.h.

371 {
372  assert( i >= 0 && i < p->nSize );
373  p->pArray[i] = Entry;
374 }
char * pArray
Definition: bblif.c:51
#define assert(ex)
Definition: util_old.h:213
static void Vec_StrZero ( Vec_Str_t p)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 204 of file vecStr.h.

205 {
206  p->pArray = NULL;
207  p->nSize = 0;
208  p->nCap = 0;
209 }
char * pArray
Definition: bblif.c:51
int nSize
Definition: bblif.c:50
int nCap
Definition: bblif.c:49