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 initial extern hacks and try again

Signed-off-by: Stephen L Arnold <sarnold@vctlabs.com>
  • Loading branch information
sarnold committed Dec 10, 2023
1 parent 8752528 commit 5b1d8fb
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 36 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
8 changes: 4 additions & 4 deletions src/base/cmd/cmdInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Synopsis [Internal declarations of the command package.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Expand All @@ -26,6 +26,7 @@
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////

#include "base/io/ioAbc.h"
#include "base/main/mainInt.h"
#include "cmd.h"

Expand All @@ -42,8 +43,8 @@ ABC_NAMESPACE_HEADER_START

struct MvCommand
{
char * sName; // the command name
char * sGroup; // the group name
char * sName; // the command name
char * sGroup; // the group name
Cmd_CommandFuncType pFunc; // the function to execute the command
int fChange; // set to 1 to mark that the network is changed
};
Expand Down Expand Up @@ -89,4 +90,3 @@ extern void CmdPrintTable( st__table * tTable, int fAliases );
ABC_NAMESPACE_HEADER_END

#endif

48 changes: 24 additions & 24 deletions src/base/io/ioAbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Synopsis [External declarations.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Expand Down Expand Up @@ -44,27 +44,27 @@ ABC_NAMESPACE_HEADER_START
////////////////////////////////////////////////////////////////////////

// network functionality
typedef enum {
IO_FILE_NONE = 0,
IO_FILE_AIGER,
IO_FILE_BAF,
IO_FILE_BBLIF,
IO_FILE_BLIF,
IO_FILE_BLIFMV,
IO_FILE_BENCH,
typedef enum {
IO_FILE_NONE = 0,
IO_FILE_AIGER,
IO_FILE_BAF,
IO_FILE_BBLIF,
IO_FILE_BLIF,
IO_FILE_BLIFMV,
IO_FILE_BENCH,
IO_FILE_BOOK,
IO_FILE_CNF,
IO_FILE_DOT,
IO_FILE_EDIF,
IO_FILE_EQN,
IO_FILE_GML,
IO_FILE_JSON,
IO_FILE_LIST,
IO_FILE_PLA,
IO_FILE_MOPLA,
IO_FILE_SMV,
IO_FILE_VERILOG,
IO_FILE_UNKNOWN
IO_FILE_CNF,
IO_FILE_DOT,
IO_FILE_EDIF,
IO_FILE_EQN,
IO_FILE_GML,
IO_FILE_JSON,
IO_FILE_LIST,
IO_FILE_PLA,
IO_FILE_MOPLA,
IO_FILE_SMV,
IO_FILE_VERILOG,
IO_FILE_UNKNOWN
} Io_FileType_t;

////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -110,7 +110,7 @@ extern void Io_WriteBlifLogic( Abc_Ntk_t * pNtk, char * pFileName,
extern void Io_WriteBlif( Abc_Ntk_t * pNtk, char * pFileName, int fWriteLatches, int fBb2Wb, int fSeq );
extern void Io_WriteTimingInfo( FILE * pFile, Abc_Ntk_t * pNtk );
extern void Io_WriteBlifSpecial( Abc_Ntk_t * pNtk, char * FileName, char * pLutStruct, int fUseHie );
/*=== abcWriteBlifMv.c ==========================================================*/
/*=== abcWriteBlifMv.c ==========================================================*/
extern void Io_WriteBlifMv( Abc_Ntk_t * pNtk, char * FileName );
/*=== abcWriteBench.c =========================================================*/
extern int Io_WriteBench( Abc_Ntk_t * pNtk, const char * FileName );
Expand Down Expand Up @@ -159,7 +159,8 @@ extern FILE * Io_FileOpen( const char * FileName, const char * PathV
/*=== ioJson.c ===========================================================*/
extern void Io_ReadJson( char * pFileName );
extern void Io_WriteJson( char * pFileName );

/*=== ioReadBlifMv.c =====================================================*/
extern char * Io_MvLoadFileBz2( char * pFileName, long * pnFileSize );


ABC_NAMESPACE_HEADER_END
Expand All @@ -171,4 +172,3 @@ ABC_NAMESPACE_HEADER_END
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////

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
2 changes: 1 addition & 1 deletion src/base/io/ioReadBlifMv.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,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

0 comments on commit 5b1d8fb

Please sign in to comment.