diff --git a/driver-vpi/main.c b/driver-vpi/main.c index 130efe464..d208764cd 100644 --- a/driver-vpi/main.c +++ b/driver-vpi/main.c @@ -1,38 +1,59 @@ +/* + * Copyright (c) 2002 Gus Baldauf (gus@picturel.com) + * + * This source code is free software; you can redistribute it + * and/or modify it in source code form under the terms of the GNU + * General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + /* * iverilog-vpi.c * - * this program is provides the functionality - * of iverilog-vpi.sh under Win32 + * this program provides the functionality of iverilog-vpi.sh under Win32 */ #include #include #include +#include +#include + #include /* Macros used for compiling and linking */ -#define IVERILOG_VPI_CC "gcc" -#define IVERILOG_VPI_CXX "gcc" +#define IVERILOG_VPI_CC "gcc" /* no .exe extension */ +#define IVERILOG_VPI_CXX "gcc" /* no .exe extension */ #define IVERILOG_VPI_CFLAGS "-O" /* -I appended later */ -#define IVERILOG_VPI_LD "gcc" +#define IVERILOG_VPI_LD "gcc" /* no .exe extension */ #define IVERILOG_VPI_LDFLAGS "-shared -Wl,--enable-auto-image-base" #define IVERILOG_VPI_LDLIBS "-lveriuser -lvpi" /* -L prepended later */ /* pointers to global strings */ static struct global_strings { - char *pCCSRC; // list of C source files - char *pCXSRC; // list of C++ source files - char *pOBJ; // list of object files - char *pLIB; // list of library files - char *pOUT; // output file name (.vpi extension) - char *pMINGW; // path to MinGW directory - char *pIVL; // path to IVL directory - char *pCFLAGS; // CFLAGS option - char *pLDLIBS; // LDLIBS option - char *pNewPath; // new PATH environment variable setting + char *pCCSRC; /* list of C source files */ + char *pCXSRC; /* list of C++ source files */ + char *pOBJ; /* list of object files */ + char *pLIB; /* list of library files */ + char *pOUT; /* output file name (.vpi extension), if 0 length then no source files specified */ + char *pMINGW; /* path to MinGW directory */ + char *pIVL; /* path to IVL directory */ + char *pCFLAGS; /* CFLAGS option */ + char *pLDLIBS; /* LDLIBS option */ + char *pNewPath; /* new PATH environment variable setting */ } gstr; @@ -61,9 +82,11 @@ static void myExit(int exitVal) /* display usage summary and exit */ -static void usage(char *name) +static void usage() { - fprintf(stderr,"usage: %s [--name=name] [-llibrary] [-mingw=dir] [-ivl=dir] sourcefile...\n",name); + fprintf(stderr,"usage: iverilog-vpi [--name=name] [-llibrary] [-mingw=dir] [-ivl=dir] sourcefile...\n"); + fprintf(stderr," or iverilog-vpi -mingw=dir\n"); + fprintf(stderr," or iverilog-vpi -ivl=dir\n"); myExit(1); } @@ -204,7 +227,7 @@ static int GetRegistryKey(char *key, char **value) fprintf(stderr,"error: out of memory\n"); myExit(4); } - regKeyBuffer[regKeySize] = 0; // makes sure there is a trailing NULL + regKeyBuffer[regKeySize] = 0; /* makes sure there is a trailing NULL */ lrv = RegQueryValueEx(hkKey,key,NULL,®KeyType,regKeyBuffer,®KeySize); if ((lrv != ERROR_SUCCESS) || (regKeyType != REG_SZ) || (!regKeySize)) { @@ -241,13 +264,16 @@ static void SetRegistryKey(char *key, char *value) RegSetValueEx(hkKey,key,0,REG_SZ,value,strlen(value)+1); RegCloseKey(hkKey); + + printf("info: storing %s in Windows' registry entry\n",value); + printf(" HKEY_LOCAL_MACHINE\\Software\\Icarus Verilog\\%s\n",key); } /* parse the command line, assign results to global variable strings */ static int parse(int argc, char *argv[]) { - int idx; + int idx, srcFileCnt=0; char dot_c_ext[] = ".c"; char dot_cc_ext[] = ".cc"; @@ -262,18 +288,21 @@ static int parse(int argc, char *argv[]) for (idx=1; idx