abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
bar.h File Reference

Go to the source code of this file.

Macros

#define BAR_PROGRESS_USE   1
 INCLUDES ///. More...
 

Typedefs

typedef struct Bar_Progress_t_ Bar_Progress_t
 BASIC TYPES ///. More...
 

Functions

Bar_Progress_tBar_ProgressStart (FILE *pFile, int nItemsTotal)
 MACRO DEFINITIONS ///. More...
 
void Bar_ProgressStop (Bar_Progress_t *p)
 
void Bar_ProgressUpdate_int (Bar_Progress_t *p, int nItemsCur, char *pString)
 
static void Bar_ProgressUpdate (Bar_Progress_t *p, int nItemsCur, char *pString)
 

Macro Definition Documentation

#define BAR_PROGRESS_USE   1

INCLUDES ///.

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

FileName [bar.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Progress bar.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]PARAMETERS ///

Definition at line 42 of file bar.h.

Typedef Documentation

BASIC TYPES ///.

Definition at line 48 of file bar.h.

Function Documentation

Bar_Progress_t* Bar_ProgressStart ( FILE *  pFile,
int  nItemsTotal 
)

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

MACRO DEFINITIONS ///.

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

Synopsis [Starts the progress bar.]

Description [The first parameter is the output stream (pFile), where the progress is printed. The current printing position should be the first one on the given line. The second parameters is the total number of items that correspond to 100% position of the progress bar.]

SideEffects []

SeeAlso []

Definition at line 66 of file bar.c.

67 {
68  Bar_Progress_t * p;
69  Abc_Frame_t * pFrame;
70  pFrame = Abc_FrameReadGlobalFrame();
71  if ( pFrame == NULL )
72  return NULL;
73  if ( !Abc_FrameShowProgress(pFrame) ) return NULL;
74  p = ABC_ALLOC( Bar_Progress_t, 1 );
75  memset( p, 0, sizeof(Bar_Progress_t) );
76  p->pFile = pFile;
77  p->nItemsTotal = nItemsTotal;
78  p->posTotal = 78;
79  p->posCur = 1;
80  p->nItemsNext = (int)((7.0+p->posCur)*p->nItemsTotal/p->posTotal);
81  Bar_ProgressShow( p, NULL );
82  return p;
83 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nItemsNext
Definition: bar.c:38
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
static void Bar_ProgressShow(Bar_Progress_t *p, char *pString)
Definition: bar.c:144
int posTotal
Definition: bar.c:40
DECLARATIONS ///.
Definition: bar.c:36
FILE * pFile
Definition: bar.c:42
int nItemsTotal
Definition: bar.c:39
ABC_DLL int Abc_FrameShowProgress(Abc_Frame_t *p)
Definition: mainFrame.c:265
int posCur
Definition: bar.c:41
ABC_DLL Abc_Frame_t * Abc_FrameReadGlobalFrame()
Definition: mainFrame.c:616
void Bar_ProgressStop ( Bar_Progress_t p)

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

Synopsis [Stops the progress bar.]

Description []

SideEffects []

SeeAlso []

Definition at line 126 of file bar.c.

127 {
128  if ( p == NULL ) return;
129  Bar_ProgressClean( p );
130  ABC_FREE( p );
131 }
static void Bar_ProgressClean(Bar_Progress_t *p)
Definition: bar.c:174
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Bar_ProgressUpdate ( Bar_Progress_t p,
int  nItemsCur,
char *  pString 
)
inlinestatic

Definition at line 63 of file bar.h.

63  {
64  if ( BAR_PROGRESS_USE && p && (nItemsCur < *((int*)p)) ) return; Bar_ProgressUpdate_int(p, nItemsCur, pString); }
void Bar_ProgressUpdate_int(Bar_Progress_t *p, int nItemsCur, char *pString)
Definition: bar.c:96
#define BAR_PROGRESS_USE
INCLUDES ///.
Definition: bar.h:42
void Bar_ProgressUpdate_int ( Bar_Progress_t p,
int  nItemsCur,
char *  pString 
)

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

Synopsis [Updates the progress bar.]

Description []

SideEffects []

SeeAlso []

Definition at line 96 of file bar.c.

97 {
98  if ( p == NULL ) return;
99  if ( nItemsCur < p->nItemsNext )
100  return;
101  if ( nItemsCur >= p->nItemsTotal )
102  {
103  p->posCur = 78;
104  p->nItemsNext = 0x7FFFFFFF;
105  }
106  else
107  {
108  p->posCur += 7;
109  p->nItemsNext = (int)((7.0+p->posCur)*p->nItemsTotal/p->posTotal);
110  }
111  Bar_ProgressShow( p, pString );
112 }
int nItemsNext
Definition: bar.c:38
static void Bar_ProgressShow(Bar_Progress_t *p, char *pString)
Definition: bar.c:144
int posTotal
Definition: bar.c:40
int nItemsTotal
Definition: bar.c:39
int posCur
Definition: bar.c:41