Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 1 1-MAY-1994 01:40:06 [LAISHEV.TOOLS.BISON-1_22]VMSGETARGS.C;1 1 /* VMS version of getargs; Uses DCL command parsing. 2 Copyright (C) 1989 Free Software Foundation, Inc. 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2, or (at your option) 7 any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 17 18 19 #include 903 #include 1955 #include 2406 #include "files.h" 2459 2460 /* 2461 * VMS version of getargs(): Uses DCL command parsing 2462 * (argc and argv are ignored) 2463 */ 2464 int verboseflag; 2465 int definesflag; 2466 int debugflag; 2467 int nolinesflag; 2468 extern int fixed_outfiles; 2469 extern char * version_string; 2470 2471 /* Allocate storgate and initialize, since bison uses them elsewhere. */ 2472 char *spec_name_prefix; 2473 char *spec_file_prefix; 2474 2475 /* Forward declarations. */ 2476 int cli_present(); 2477 int cli_get_value(); 2478 2479 getargs(argc,argv) 2480 int argc; 2481 char *argv[]; 1 2482 { 1 2483 register char *cp; 1 2484 static char Input_File[256]; 1 2485 static char output_spec[256], name_prefix_spec[256], file_prefix_spec[256]; 1 2486 extern char *infile; 1 2487 1 2488 verboseflag = 0; 1 2489 definesflag = 0; 1 2490 debugflag = 0; 1 2491 fixed_outfiles = 0; 1 2492 nolinesflag = 0; 1 2493 /* Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 2 1-MAY-1994 01:40:06 [LAISHEV.TOOLS.BISON-1_22]VMSGETARGS.C;1 1 2494 * Check for /VERBOSE qualifier 1 2495 */ 1 2496 if (cli_present("BISON$VERBOSE")) verboseflag = 1; 1 2497 /* 1 2498 * Check for /DEFINES qualifier 1 2499 */ 1 2500 if (cli_present("BISON$DEFINES")) definesflag = 1; 1 2501 /* 1 2502 * Check for /FIXED_OUTFILES qualifier 1 2503 */ 1 2504 if (cli_present("BISON$FIXED_OUTFILES")) fixed_outfiles = 1; 1 2505 if (cli_present("BISON$YACC")) fixed_outfiles = 1; 1 2506 /* 1 2507 * Check for /VERSION qualifier 1 2508 */ 1 2509 if (cli_present("BISON$VERSION")) printf("%s",version_string); 1 2510 /* 1 2511 * Check for /NOLINES qualifier 1 2512 */ 1 2513 if (cli_present("BISON$NOLINES")) nolinesflag = 1; 1 2514 /* 1 2515 * Check for /DEBUG qualifier 1 2516 */ 1 2517 if (cli_present("BISON$DEBUG")) debugflag = 1; 1 2518 /* 1 2519 * Get the filename 1 2520 */ 1 2521 cli_get_value("BISON$INFILE", Input_File, sizeof(Input_File)); 1 2522 /* 1 2523 * Lowercaseify the input filename 1 2524 */ 1 2525 cp = Input_File; 1 2526 while(*cp) 2 2527 { 2 2528 if (isupper(*cp)) *cp = tolower(*cp); 2 2529 cp++; 1 2530 } 1 2531 infile = Input_File; 1 2532 /* 1 2533 * Get the output file 1 2534 */ 1 2535 if (cli_present("BISON$OUTPUT")) 2 2536 { 2 2537 cli_get_value("BISON$OUTPUT", output_spec, sizeof(output_spec)); 2 2538 for (cp = spec_outfile = output_spec; *cp; cp++) 2 2539 if (isupper(*cp)) 2 2540 *cp = tolower(*cp); 1 2541 } 1 2542 /* 1 2543 * Get the output file 1 2544 */ 1 2545 if (cli_present("BISON$FILE_PREFIX")) 2 2546 { 2 2547 cli_get_value("BISON$FILE_PREFIX", file_prefix_spec, 2 2548 sizeof(file_prefix_spec)); 2 2549 for (cp = spec_file_prefix = file_prefix_spec; *cp; cp++) 2 2550 if (isupper(*cp)) Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 3 1-MAY-1994 01:40:06 [LAISHEV.TOOLS.BISON-1_22]VMSGETARGS.C;1 2 2551 *cp = tolower(*cp); 1 2552 } 1 2553 /* 1 2554 * Get the output file 1 2555 */ 1 2556 if (cli_present("BISON$NAME_PREFIX")) 2 2557 { 2 2558 cli_get_value("BISON$NAME_PREFIX", name_prefix_spec, 2 2559 sizeof(name_prefix_spec)); 2 2560 for (cp = spec_name_prefix = name_prefix_spec; *cp; cp++) 2 2561 if (isupper(*cp)) 2 2562 *cp = tolower(*cp); 1 2563 } 1 2564 } 2565 2566 /************ DCL PARSING ROUTINES **********/ 2567 2568 extern unsigned long cli$dcl_parse (); 2569 extern unsigned long cli$present (); 2570 extern unsigned long cli$get_value (); 2571 2572 /* 2573 * See if "NAME" is present 2574 */ 2575 int 2576 cli_present(Name) 2577 char *Name; 1 2578 { 1 2579 struct {int Size; char *Ptr;} Descr; 1 2580 1 2581 Descr.Ptr = Name; 1 2582 Descr.Size = strlen(Name); 1 2583 return((cli$present(&Descr) & 1) ? 1 : 0); 1 2584 } 2585 2586 /* 2587 * Get value of "NAME" 2588 */ 2589 int 2590 cli_get_value(Name,Buffer,Size) 2591 char *Name; 2592 char *Buffer; 1 2593 { 1 2594 struct {int Size; char *Ptr;} Descr1,Descr2; 1 2595 1 2596 Descr1.Ptr = Name; 1 2597 Descr1.Size = strlen(Name); 1 2598 Descr2.Ptr = Buffer; 1 2599 Descr2.Size = Size-1; 2 2600 if (cli$get_value(&Descr1,&Descr2,&Descr2.Size) & 1) { 2 2601 Buffer[Descr2.Size] = 0; 2 2602 return(1); 1 2603 } 1 2604 return(0); 1 2605 } Source Listing 31-MAR-2009 13:04:13 HP C V7.3-009-48GBT Page 4 1-MAY-1994 01:40:06 [LAISHEV.TOOLS.BISON-1_22]VMSGETARGS.C;1 Command Line ------- ---- CC/INCLU=[]/LIS VMSGETARGS.C Hardware: /ARCHITECTURE=GENERIC /OPTIMIZE=TUNE=GENERIC These macros are in effect at the start of the compilation. ----- ------ --- -- ------ -- --- ----- -- --- ------------ __G_FLOAT=1 __DECC=1 vms=1 VMS=1 __32BITS=1 __PRAGMA_ENVIRONMENT=1 __CRTL_VER=80300000 __vms_version="V8.3 " CC$gfloat=1 __X_FLOAT=1 vms_version="V8.3 " __DATE__="Mar 31 2009" __STDC_VERSION__=199901L __DECC_MODE_RELAXED=1 __DECC_VER=70390009 __VMS=1 __ALPHA=1 VMS_VERSION="V8.3 " __IEEE_FLOAT=0 __VMS_VERSION="V8.3 " __TIME__="13:04:13" __Alpha_AXP=1 __VMS_VER=80300022 __BIASED_FLT_ROUNDS=2 __INITIAL_POINTER_SIZE=0 __STDC__=2 __LANGUAGE_C__=1 __vms=1 __alpha=1 __D_FLOAT=0