28#define COMMAND_OPTION(x,a,b) ((0 == strcmp(x,a)) || (0 == strcmp(x,b)))
30#define OPTION_00(x) COMMAND_OPTION(x, "-?", "-help" )
31#define OPTION_01(x) COMMAND_OPTION(x, "-h", "-hdr" )
32#define OPTION_02(x) COMMAND_OPTION(x, "-n", "-net" )
33#define OPTION_03(x) COMMAND_OPTION(x, "-g", "-gen" )
34#define OPTION_04(x) COMMAND_OPTION(x, "-d", "-dir" )
35#define OPTION_05(x) COMMAND_OPTION(x, "-u", "-user" )
36#define OPTION_06(x) COMMAND_OPTION(x, "-e", "-expand" )
37#define OPTION_07(x) COMMAND_OPTION(x, "-l", "-list" )
38#define OPTION_08(x) COMMAND_OPTION(x, "-v", "-verbose")
39#define OPTION_09(x) COMMAND_OPTION(x, "-a", "-author" )
40#define OPTION_10(x) COMMAND_OPTION(x, "-b", "-built" )
70 (void) fprintf(
STDERR,
" ***\n");
71 (void) fprintf(
STDERR,
"\n USAGE:\n");
72 (void) fprintf(
STDERR,
"\n %s fnam", command);
73 (void) fprintf(
STDERR,
" [-d dlib][-h hlib][-n nlib][-g glib][-u \"user\"][-l | -e | -a | -b]\n");
74 (void) fprintf(
STDERR,
" %s -?\n", command);
75 (void) fprintf(
STDERR,
"\n Where:\n");
76 (void) fprintf(
STDERR,
" 'fnam' Full pathname of the main netlist to compile in ANSI-C\n");
77 (void) fprintf(
STDERR,
" 'dlib' Default directory containing libraries 'Hdr', 'Net', 'Gen'\n");
78 (void) fprintf(
STDERR,
" 'hlib' Library of header files (reset default 'dlib/Hdr')\n");
79 (void) fprintf(
STDERR,
" 'nlib' Library of reusable cells (reset default 'dlib/Net')\n");
80 (void) fprintf(
STDERR,
" 'glib' Library of reusable generators (reset default 'dlib/Gen')\n");
81 (void) fprintf(
STDERR,
" 'user' User's name or ID\n");
82 (void) fprintf(
STDERR,
" '-a' Program identification\n");
83 (void) fprintf(
STDERR,
" '-b' Built information\n");
84 (void) fprintf(
STDERR,
" '-l' List the nodes and variables (no compilation, no expansion)\n");
85 (void) fprintf(
STDERR,
" '-e' Expand the input netlists (no compilation, no list )\n");
86 (void) fprintf(
STDERR,
" '-?' This usage\n");
87 (void) fprintf(
STDERR,
"\n*** Report bugs, suggestions to yves.leduc.be@gmail.com ***\n");
109 int hflag, nflag, gflag, fflag, dflag, uflag;
115 char initials[3] =
" ";
116 char *s = (
char*) NULL;
117 char *command = (
char*) NULL;
118 char *generic_name = (
char*) NULL;
121 if (
'X' == buffer[0]) {
123 (void) fprintf(
STDERR,
"\n\n **** *************************************************************\n");
124 (void) fprintf(
STDERR,
" **** *** BETA RELEASE of NAPA %-6s ***\n", buffer);
125 (void) fprintf(
STDERR,
" **** *** Contact Yves Leduc, yves.leduc.be@gmail.com ***\n");
126 (void) fprintf(
STDERR,
" **** *** to get a stable release. ***\n");
127 (void) fprintf(
STDERR,
" **** *************************************************************\n\n");
141 for (i = 1L; i < c; i++) {
149 n = snprintf(str, (
size_t) 159,
"Type %s -help to get a short usage", command);
150 (void) fprintf(
STDERR,
"\n*** %s %*s ***\n", str, 64 -n,
" ");
151 (void) fprintf(
STDERR,
"\nContact the author Yves Leduc (Email: yves.leduc.be@gmail.com) for further information.\n");
159 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: [-h, -hdr]: header library pathname is missing.\n");
169 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: [-h, -hdr]: only one header library pathname is allowed.\n");
176 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: [-n, -net]: net library pathname is missing.\n");
186 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: [-n, -net]: only one net library pathname is allowed.\n");
193 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: [-g, -gen]: generator library pathname is missing.\n");
203 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: [-g, -gen]: only one generator pathname library is allowed.\n");
210 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: [-d, -dir]: generic library pathname is missing.\n");
220 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: [-d, -dir]: only one generic library pathname library is allowed.\n");
227 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: [-u, -user]: user name is missing.\n");
246 if (
' ' == initials[1]) {
256 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: [-u, -user]: only one user name is allowed.\n");
265 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: [-e, -expand]:");
266 (void) fprintf(
STDERR,
" file expansion and nodes/variables listing are not possible together.\n");
276 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: [-l, -list]:");
277 (void) fprintf(
STDERR,
" nodes/variables listing and file expansion are not possible together.\n");
285 (void) fprintf(
STDERR,
"\n");
287 (void) fprintf(
STDERR,
"\n");
290 (void) fprintf(
STDERR,
"\n*** AUTHOR: Yves Leduc (Email: yves.leduc.be@gmail.com) ***\n");
298 }
else if (
'-' == **v) {
299 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: option '%s' is not recognized as a valid option.\n", *v);
304#if (IS_WIN64 == PLATFORM)
320 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: only one main source file pathname is allowed.\n");
326 (void) fprintf(
STDERR,
"\nNAPA Command Line Error: main source file pathname is missing.\n");
330 if ((!hflag) && (dflag)) {
331 (void) snprintf(buffer, (
size_t) (
STRLENGTH-1L),
"%s/Hdr", generic_name);
334 if ((!nflag) && (dflag)) {
335 (void) snprintf(buffer, (
size_t) (
STRLENGTH-1L),
"%s/Net", generic_name);
338 if ((!gflag) && (dflag)) {
339 (void) snprintf(buffer, (
size_t) (
STRLENGTH-1L),
"%s/Gen", generic_name);
342 if ((!hflag) && (!dflag)) {
345 if ((!nflag) && (!dflag)) {
348 if ((!gflag) && (!dflag)) {
355 if ((dflag) || (NULL != generic_name)) {
359 sec = ((*tminfo).tm_mday * 86400) + ((*tminfo).tm_hour * 3600) + ((*tminfo).tm_min * 60) + (*tminfo).tm_sec;
360 (void) snprintf(buffer, (
size_t) 16,
"%d%d%d", (*tminfo).tm_year-100, (*tminfo).tm_mon+1, sec);
361 if (0 == strcmp(initials,
" ")) {
362 (void) snprintf(
NAPA_Job_ID, (
size_t) 16,
"%s", buffer);
364 (void) snprintf(
NAPA_Job_ID, (
size_t) 18,
"%s%s", initials, buffer);
void process_command_line(long c, char **v)
void tag_executable(const char *d, const char *t)
void print_usage(const char *command)
void print_identification(void)
void print_build_information(void)
void strcpy_alloc(char **dest, const char *sour, const unsigned long *mlin, const unsigned long *mfil)
void strcpy_realloc(char **dest, const char *sour, const unsigned long *mlin, const unsigned long *mfil)
EXTERN char * Generator_Lib_Name
EXTERN char NAPA_Compile_Time[33]
EXTERN char NAPA_Command_Line[2047L]
EXTERN char NAPA_Job_ID[19]
#define NAPA_COMPILER_VERSION
EXTERN char * Header_Lib_Name
EXTERN char * Main_File_Name
EXTERN char NAPA_Identification_String[35]
EXTERN char * Net_Lib_Name
void drop_pathname(char *pnam)