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 use ioAbc.h for missing symbol
* remove superfluous dirent dep on windows

Signed-off-by: Stephen L Arnold <[email protected]>
  • Loading branch information
sarnold committed Dec 10, 2023
1 parent 8752528 commit 088ae33
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 42 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/conda-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ jobs:
conda devenv
conda activate abc
conda info --envs
conda list
echo $CONDA_PREFIX
find $CONDA_PREFIX -maxdepth 2 -type d -name bin
cat $(find $CONDA_PREFIX -maxdepth 5 -type f -name dirent.h) || true
echo $PATH
ctest --build-generator "${{ matrix.generator }}" \
--build-and-test . build \
--build-options ${CMAKE_ARGS} ${{ matrix.extra_args }} \
Expand Down
1 change: 0 additions & 1 deletion environment.devenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dependencies:
- readline=8.1 # [unix]
- zlib
- libpng
- dirent # [win]

environment:
CPATH:
Expand Down
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 088ae33

Please sign in to comment.