Skip to content

Commit

Permalink
fix: dev: relax ifdef check in cmd.c and make it windows-specific
Browse files Browse the repository at this point in the history
* cleanup extern hacks and make Io_MvLoadFileBz2 static instead

Signed-off-by: Stephen L Arnold <[email protected]>
  • Loading branch information
sarnold committed Dec 10, 2023
1 parent 8752528 commit 1a70e05
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
9 changes: 4 additions & 5 deletions src/base/cmd/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@
***********************************************************************/

#if (defined(WIN32) || defined(__MINGW32__)) && !defined(__cplusplus)
#if (defined(WIN32) || defined(__MINGW32__))
#include <process.h>
#else
#include <dirent.h>
#include <unistd.h>
#endif

#include "base/abc/abc.h"
#include "base/io/ioInt.h"
#include "base/main/mainInt.h"
#include "cmdInt.h"
#include "misc/util/utilSignal.h"
Expand All @@ -51,7 +50,7 @@ static int CmdCommandUnsetVariable ( Abc_Frame_t * pAbc, int argc, char ** argv
static int CmdCommandUndo ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int CmdCommandRecall ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int CmdCommandEmpty ( Abc_Frame_t * pAbc, int argc, char ** argv );
#if (defined(WIN32) || defined(__MINGW32__)) && !defined(__cplusplus)
#if (defined(WIN32) || defined(__MINGW32__))
static int CmdCommandScanDir ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int CmdCommandRenameFiles ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int CmdCommandLs ( Abc_Frame_t * pAbc, int argc, char ** argv );
Expand Down Expand Up @@ -104,7 +103,7 @@ void Cmd_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "Basic", "undo", CmdCommandUndo, 0 );
Cmd_CommandAdd( pAbc, "Basic", "recall", CmdCommandRecall, 0 );
Cmd_CommandAdd( pAbc, "Basic", "empty", CmdCommandEmpty, 0 );
#if (defined(WIN32) || defined(__MINGW32__)) && !defined(__cplusplus)
#if (defined(WIN32) || defined(__MINGW32__))
Cmd_CommandAdd( pAbc, "Basic", "scandir", CmdCommandScanDir, 0 );
Cmd_CommandAdd( pAbc, "Basic", "renamefiles", CmdCommandRenameFiles, 0 );
Cmd_CommandAdd( pAbc, "Basic", "ls", CmdCommandLs, 0 );
Expand Down Expand Up @@ -1149,7 +1148,7 @@ int CmdCommandUndo( Abc_Frame_t * pAbc, int argc, char **argv )
#endif


#if (defined(WIN32) || defined(__MINGW32__)) && !defined(__cplusplus)
#if (defined(WIN32) || defined(__MINGW32__))
#include <direct.h>
#include <io.h>

Expand Down
2 changes: 0 additions & 2 deletions src/base/io/ioInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ ABC_NAMESPACE_HEADER_START
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////

extern char * Io_MvLoadFileBz2( char * pFileName, int * pnFileSize );


ABC_NAMESPACE_HEADER_END

Expand Down
5 changes: 3 additions & 2 deletions src/base/io/ioReadBlifMv.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ static void Io_MvFree( Io_MvMan_t * p );
static Io_MvMod_t * Io_MvModAlloc();
static void Io_MvModFree( Io_MvMod_t * p );
static char * Io_MvLoadFile( char * pFileName );
static char * Io_MvLoadFileBz2( char * pFileName, long * pnFileSize );
static void Io_MvReadPreparse( Io_MvMan_t * p );
static int Io_MvReadInterfaces( Io_MvMan_t * p );
static Abc_Des_t * Io_MvParse( Io_MvMan_t * p );
Expand All @@ -115,7 +116,7 @@ static int Io_MvParseLineMv( Io_MvMod_t * p, char * pLine );
static int Io_MvParseLineNamesMv( Io_MvMod_t * p, char * pLine, int fReset );
static int Io_MvParseLineNamesBlif( Io_MvMod_t * p, char * pLine );
static int Io_MvParseLineShortBlif( Io_MvMod_t * p, char * pLine );
static int Io_MvParseLineLtlProperty( Io_MvMod_t * p, char * pLine );
static int Io_MvParseLineLtlProperty( Io_MvMod_t * p, char * pLine );
static int Io_MvParseLineGateBlif( Io_MvMod_t * p, Vec_Ptr_t * vTokens );
static Io_MvVar_t * Abc_NtkMvVarDup( Abc_Ntk_t * pNtk, Io_MvVar_t * pVar );

Expand Down Expand Up @@ -548,7 +549,7 @@ typedef struct buflist {
struct buflist * next;
} buflist;

char * Io_MvLoadFileBz2( char * pFileName, long * pnFileSize )
static char * Io_MvLoadFileBz2( char * pFileName, long * pnFileSize )
{
FILE * pFile;
long nFileSize = 0;
Expand Down

0 comments on commit 1a70e05

Please sign in to comment.