abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ioaUtil.c File Reference
#include "ioa.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START int Ioa_FileSize (char *pFileName)
 DECLARATIONS ///. More...
 
char * Ioa_FileNameGeneric (char *FileName)
 
char * Ioa_FileNameGenericAppend (char *pBase, char *pSuffix)
 
char * Ioa_TimeStamp ()
 

Function Documentation

char* Ioa_FileNameGeneric ( char *  FileName)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 73 of file ioaUtil.c.

74 {
75  char * pDot, * pRes;
76  pRes = Abc_UtilStrsav( FileName );
77  if ( (pDot = strrchr( pRes, '.' )) )
78  *pDot = 0;
79  return pRes;
80 }
char * strrchr()
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
char* Ioa_FileNameGenericAppend ( char *  pBase,
char *  pSuffix 
)

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

Synopsis [Returns the composite name of the file.]

Description []

SideEffects []

SeeAlso []

Definition at line 93 of file ioaUtil.c.

94 {
95  static char Buffer[1000];
96  char * pDot;
97  if ( pBase == NULL )
98  {
99  strcpy( Buffer, pSuffix );
100  return Buffer;
101  }
102  strcpy( Buffer, pBase );
103  if ( (pDot = strrchr( Buffer, '.' )) )
104  *pDot = 0;
105  strcat( Buffer, pSuffix );
106  // find the last occurrance of slash
107  for ( pDot = Buffer + strlen(Buffer) - 1; pDot >= Buffer; pDot-- )
108  if (!((*pDot >= '0' && *pDot <= '9') ||
109  (*pDot >= 'a' && *pDot <= 'z') ||
110  (*pDot >= 'A' && *pDot <= 'Z') ||
111  *pDot == '_' || *pDot == '.') )
112  break;
113  return pDot + 1;
114 }
char * strcpy()
char * strcat()
int strlen()
char * strrchr()
ABC_NAMESPACE_IMPL_START int Ioa_FileSize ( char *  pFileName)

DECLARATIONS ///.

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

FileName [ioaUtil.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Command processing package.]

Synopsis [Procedures to read binary AIGER format developed by Armin Biere, Johannes Kepler University (http://fmv.jku.at/)]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - December 16, 2006.]

Revision [

Id:
ioaUtil.c,v 1.00 2006/12/16 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Returns the file size.]

Description [The file should be closed.]

SideEffects []

SeeAlso []

Definition at line 46 of file ioaUtil.c.

47 {
48  FILE * pFile;
49  int nFileSize;
50  pFile = fopen( pFileName, "r" );
51  if ( pFile == NULL )
52  {
53  printf( "Ioa_FileSize(): The file is unavailable (absent or open).\n" );
54  return 0;
55  }
56  fseek( pFile, 0, SEEK_END );
57  nFileSize = ftell( pFile );
58  fclose( pFile );
59  return nFileSize;
60 }
#define SEEK_END
Definition: zconf.h:392
char* Ioa_TimeStamp ( )

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

Synopsis [Returns the time stamp.]

Description [The file should be closed.]

SideEffects []

SeeAlso []

Definition at line 127 of file ioaUtil.c.

128 {
129  static char Buffer[100];
130  char * TimeStamp;
131  time_t ltime;
132  // get the current time
133  time( &ltime );
134  TimeStamp = asctime( localtime( &ltime ) );
135  TimeStamp[ strlen(TimeStamp) - 1 ] = 0;
136  strcpy( Buffer, TimeStamp );
137  return Buffer;
138 }
char * strcpy()
int strlen()