#include <stdio.h>
Go to the source code of this file.
Data Structures | |
struct | Vec_Str_t_ |
Defines | |
#define | Vec_StrForEachEntry(vVec, Entry, i) for ( i = 0; (i < Vec_StrSize(vVec)) && (((Entry) = Vec_StrEntry(vVec, i)), 1); i++ ) |
Typedefs | |
typedef struct Vec_Str_t_ | Vec_Str_t |
Functions | |
static Vec_Str_t * | Vec_StrAlloc (int nCap) |
static Vec_Str_t * | Vec_StrStart (int nSize) |
static Vec_Str_t * | Vec_StrAllocArray (char *pArray, int nSize) |
static Vec_Str_t * | Vec_StrAllocArrayCopy (char *pArray, int nSize) |
static Vec_Str_t * | Vec_StrDup (Vec_Str_t *pVec) |
static Vec_Str_t * | Vec_StrDupArray (Vec_Str_t *pVec) |
static void | Vec_StrFree (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 char | Vec_StrEntry (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 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 int | Vec_StrBase10Log (unsigned Num) |
static void | Vec_StrPrintNum (Vec_Str_t *p, int Num) |
static void | Vec_StrPrintStr (Vec_Str_t *p, char *pStr) |
static void | Vec_StrAppend (Vec_Str_t *p, char *pString) |
static char | Vec_StrPop (Vec_Str_t *p) |
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) |
#define Vec_StrForEachEntry | ( | vVec, | |||
Entry, | |||||
i | ) | for ( i = 0; (i < Vec_StrSize(vVec)) && (((Entry) = Vec_StrEntry(vVec, i)), 1); i++ ) |
typedef struct Vec_Str_t_ Vec_Str_t |
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 [
] INCLUDES /// PARAMETERS /// BASIC TYPES ///
static Vec_Str_t* Vec_StrAlloc | ( | int | nCap | ) | [inline, static] |
FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Allocates a vector with the given capacity.]
Description []
SideEffects []
SeeAlso []
static Vec_Str_t* Vec_StrAllocArray | ( | char * | pArray, | |
int | nSize | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Creates the vector from an integer array of the given size.]
Description []
SideEffects []
SeeAlso []
static Vec_Str_t* Vec_StrAllocArrayCopy | ( | char * | pArray, | |
int | nSize | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Creates the vector from an integer array of the given size.]
Description []
SideEffects []
SeeAlso []
static void Vec_StrAppend | ( | Vec_Str_t * | p, | |
char * | pString | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Appends the string to the char vector.]
Description []
SideEffects []
SeeAlso []
static char* Vec_StrArray | ( | Vec_Str_t * | p | ) | [inline, static] |
static int Vec_StrBase10Log | ( | unsigned | Num | ) | [inline, static] |
Function********************************************************************
Synopsis [Finds the smallest integer larger of equal than the logarithm.]
Description [Returns [Log10(Num)].]
SideEffects []
SeeAlso []
Definition at line 415 of file vecStr.h.
00416 { 00417 int Res; 00418 assert( Num >= 0 ); 00419 if ( Num == 0 ) return 0; 00420 if ( Num == 1 ) return 1; 00421 for ( Res = 0, Num--; Num; Num /= 10, Res++ ); 00422 return Res; 00423 } /* end of Extra_Base2Log */
static void Vec_StrClear | ( | Vec_Str_t * | p | ) | [inline, static] |
Function*************************************************************
Synopsis [Duplicates the integer array.]
Description []
SideEffects []
SeeAlso []
Function*************************************************************
Synopsis [Transfers the array into another vector.]
Description []
SideEffects []
SeeAlso []
static char Vec_StrEntry | ( | Vec_Str_t * | p, | |
int | i | |||
) | [inline, static] |
static char Vec_StrEntryLast | ( | Vec_Str_t * | p | ) | [inline, static] |
static void Vec_StrFill | ( | Vec_Str_t * | p, | |
int | nSize, | |||
char | Entry | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Fills the vector with given number of entries.]
Description []
SideEffects []
SeeAlso []
Definition at line 339 of file vecStr.h.
00340 { 00341 int i; 00342 Vec_StrGrow( p, nSize ); 00343 p->nSize = nSize; 00344 for ( i = 0; i < p->nSize; i++ ) 00345 p->pArray[i] = Entry; 00346 }
static void Vec_StrFree | ( | Vec_Str_t * | p | ) | [inline, static] |
static void Vec_StrGrow | ( | Vec_Str_t * | p, | |
int | nCapMin | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Resizes the vector to the given capacity.]
Description []
SideEffects []
SeeAlso []
static char Vec_StrPop | ( | Vec_Str_t * | p | ) | [inline, static] |
static void Vec_StrPrintNum | ( | Vec_Str_t * | p, | |
int | Num | |||
) | [inline, static] |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 436 of file vecStr.h.
00437 { 00438 int i, nDigits; 00439 if ( Num < 0 ) 00440 { 00441 Vec_StrPush( p, '-' ); 00442 Num = -Num; 00443 } 00444 if ( Num < 10 ) 00445 { 00446 Vec_StrPush( p, (char)('0' + Num) ); 00447 return; 00448 } 00449 nDigits = Vec_StrBase10Log( Num ); 00450 Vec_StrGrow( p, p->nSize + nDigits ); 00451 for ( i = nDigits - 1; i >= 0; i-- ) 00452 { 00453 Vec_StrWriteEntry( p, p->nSize + i, (char)('0' + Num % 10) ); 00454 Num /= 10; 00455 } 00456 assert( Num == 0 ); 00457 p->nSize += nDigits; 00458 }
static void Vec_StrPrintStr | ( | Vec_Str_t * | p, | |
char * | pStr | |||
) | [inline, static] |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 471 of file vecStr.h.
00472 { 00473 int i, Length = strlen(pStr); 00474 for ( i = 0; i < Length; i++ ) 00475 Vec_StrPush( p, pStr[i] ); 00476 }
static void Vec_StrPush | ( | Vec_Str_t * | p, | |
char | Entry | |||
) | [inline, static] |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 392 of file vecStr.h.
00393 { 00394 if ( p->nSize == p->nCap ) 00395 { 00396 if ( p->nCap < 16 ) 00397 Vec_StrGrow( p, 16 ); 00398 else 00399 Vec_StrGrow( p, 2 * p->nCap ); 00400 } 00401 p->pArray[p->nSize++] = Entry; 00402 }
static char* Vec_StrReleaseArray | ( | Vec_Str_t * | p | ) | [inline, static] |
static void Vec_StrShrink | ( | Vec_Str_t * | p, | |
int | nSizeNew | |||
) | [inline, static] |
static int Vec_StrSize | ( | Vec_Str_t * | p | ) | [inline, static] |
static void Vec_StrSort | ( | Vec_Str_t * | p, | |
int | fReverse | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Sorting the entries by their integer value.]
Description []
SideEffects []
SeeAlso []
Definition at line 568 of file vecStr.h.
00569 { 00570 if ( fReverse ) 00571 qsort( (void *)p->pArray, p->nSize, sizeof(char), 00572 (int (*)(const void *, const void *)) Vec_StrSortCompare2 ); 00573 else 00574 qsort( (void *)p->pArray, p->nSize, sizeof(char), 00575 (int (*)(const void *, const void *)) Vec_StrSortCompare1 ); 00576 }
static int Vec_StrSortCompare1 | ( | char * | pp1, | |
char * | pp2 | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Comparison procedure for two clauses.]
Description []
SideEffects []
SeeAlso []
static int Vec_StrSortCompare2 | ( | char * | pp1, | |
char * | pp2 | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Comparison procedure for two clauses.]
Description []
SideEffects []
SeeAlso []
static Vec_Str_t* Vec_StrStart | ( | int | nSize | ) | [inline, static] |
Function*************************************************************
Synopsis [Allocates a vector with the given size and cleans it.]
Description []
SideEffects []
SeeAlso []
Definition at line 91 of file vecStr.h.
00092 { 00093 Vec_Str_t * p; 00094 p = Vec_StrAlloc( nSize ); 00095 p->nSize = nSize; 00096 memset( p->pArray, 0, sizeof(char) * nSize ); 00097 return p; 00098 }
static void Vec_StrWriteEntry | ( | Vec_Str_t * | p, | |
int | i, | |||
char | Entry | |||
) | [inline, static] |