コード例 #1
0
ファイル: asl.c プロジェクト: mingpen/OpenNT
VOID
ParseArgs (
    IN int      argc,
    IN char     **argv
    )
{
    argv += 1;
    argc -= 1;

    while (argc) {
        if (argv[0][0] == '-') {
            switch ((*argv)[1]) {
                case 'v':
                    Verbose = atoi((*argv)+2);
                    break;

                default:
                    HelpAndExit ("Unkown command line option");
            }

        } else {
            // filename
            if (Source) {
                HelpAndExit ("Only one source name allowed");
            }

            IncludeSource (*argv);
        }

        argc -= 1;
        argv += 1;
    }
}
コード例 #2
0
ファイル: asl.c プロジェクト: mingpen/OpenNT
VOID
__cdecl main (
    IN int      argc,
    IN char     **argv
    )
{
    //
    // Initialize
    //

    InitParse ();
    ParseArgs (argc, argv);
    InitializeListHead (&VerifyRef);

    if (!Source) {
        HelpAndExit (NULL);
    }

    printf ("ACPI Souce Language Assembler Version 0.1\n");
    printf ("Copyright (C) Microsoft Corp 1996. All rights reserved.\n");
    fflush (stdout);

    //
    // Build top level scope & ASL data package for which image
    // can be built in
    //

    DataImage = AllocAl();
    DataImage->Name     = AllocName();
    DataImage->Flags   |= F_AMLPACKAGE | F_PVARIABLE;
    DataImage->Term     = &ImageTerm;
    DataImage->Parent   = DataImage;
    DataImage->DataType = TypeRoot;
    InitializeListHead(&DataImage->FixedList);
    InitializeListHead(&DataImage->u1.VariableList);
    DataImage->Name->NameSeg = (ULONG) '\\';
    AlLoc = DataImage;

    //
    // Parse source
    //

    while (Source) {
        ParseSource ();
        CloseSource ();
    }

    if (Verbose > 1) {
        printf ("NameSpaceDump:\n");
        DumpNameSpace (DataImage->Name, 0);

        //not valid anymore...
        //if (Verbose > 2) {
        //    DumpImage();
        //    printf ("AMLSize %d\n", AMLSize);
        //}
    }

    //
    // Enable AML for data image, and calculate package sizes
    //

    DataImage->Flags |= F_AMLENCODE;
    WriteDefinitionBlocks (DataImage);

    //
    // Remove AML package size from image Al
    //

    DataImage->Flags &= ~F_AMLENCODE;
    DataImage->u.Data.Length = 0;


    //
    // ...
    //

    Terminate ();
}
コード例 #3
0
ファイル: browser.c プロジェクト: mbentz80/jzigbeercp
int
on_launch(int argc, char *argv[])
{
  int i, j;
  char *arg;

  nOut= 0;
  for (i=0 ; i<8 ; i++) {
    outNames[i]= 0;
    outEngines[i]= 0;
    outDraw[i]= outSend[i]= outLengths[i]= 0;
  }
  noDisplay= amBatch= x_only= 0;
  defaultDPI= 100;
  inName= 0;

  p_quitter(&on_quit);
  p_idler(&on_idle);
  p_stdinit(&on_stdin);
  g_stdout = p_stdout;

  for (i=1 ; i<argc ; i++) {
    arg= argv[i];

    if (arg[0]=='-') {
      int fileType= -1;
      arg++;
      if (strcmp(arg, "cgm")==0) {
        fileType= 0;
        i++;
        if (i>=argc) return MessageAndExit("Missing file or display name");
        arg= argv[i];
      } else if (strcmp(arg, "ps")==0) {
        fileType= 1;
        i++;
        if (i>=argc) return MessageAndExit("Missing file or display name");
        arg= argv[i];
      } else if (strcmp(arg, "in")==0) {
        i++;
        if (i>=argc) return MessageAndExit("Missing file or display name");
        if (inName) return HelpAndExit();
        else inName= argv[i];
      } else if (strcmp(arg, "display")==0 || strcmp(arg, "d")==0) {
        fileType= 2;
        i++;
        if (i>=argc) return MessageAndExit("Missing file or display name");
        arg= argv[i];
      } else if (strcmp(arg, "f")==0) {
        amBatch= 1;
        fileType= 1;
        arg= "*stdout*";
      } else if (strcmp(arg, "nd")==0) noDisplay= 1;
      else if (strcmp(arg, "b")==0) amBatch= 1;
      else if (strcmp(arg, "nowarn")==0) no_warnings= 1;
      else if (strcmp(arg, "geometry")==0) {
        char *suffix;
        int w=0,h=0;
        i++;
        if (i>=argc) MessageAndExit("Missing geometry");
        arg = argv[i];
        w = (int)strtol(arg, &suffix, 10);
        if (suffix!=arg && *suffix=='x') {
          arg = suffix+1;
          h = (int)strtol(arg, &suffix, 10);
        }
        if (w < 10 || h < 10) MessageAndExit("Invalid geometry");
        gx75width = gx100width = w;
        gx75height = gx100height = h;
      } else if (strcmp(arg, "75")==0) defaultDPI= 75;
      else if (strcmp(arg, "100")==0) defaultDPI= 100;
      else if (strcmp(arg, "gks")==0) {
        gx75width= gx75height= 600;     /* 8x8 X window size */
        gx100width= gx100height= 800;   /* 8x8 X window size */
        cgmScaleToFit= 1;               /* 8x8 PostScript plotting area */
        gtDoEscapes= 0;
      } else if (strcmp(arg, "x")==0) x_only= 1;
      else if (strcmp(arg, "gks")==0) {
        cgmScaleToFit= 1;
        gtDoEscapes= 0;
      }
      else if (strcmp(arg, "fmbug")==0) epsFMbug= 1;
      else if (strcmp(arg, "bg0fg1")==0) bg0fg1= 1;
      else if (strcmp(arg, "esc0")==0) gtDoEscapes= 0;
      else if (strcmp(arg, "esc1")==0) gtDoEscapes= 1;
      else return HelpAndExit();

      if (fileType>=0) {
        if (nOut>=8)
          return MessageAndExit("At most 8 output files/displays allowed");
        for (j=0 ; j<nOut ; j++) if (strcmp(outNames[j], arg)==0)
          return MessageAndExit("Duplicate output filenames not allowed");
        outNames[nOut]= arg;
        outTypes[nOut]= fileType;
        nOut++;
      }

    } else if (arg[0]<='9' && arg[0]>='0') {
      if (GetPageGroup(arg)) return MessageAndExit("Try again");

    } else if (!inName) {
      inName= arg;

    } else {
      return HelpAndExit();
    }
  }

  if (inName && OpenCGM(inName)) inName= 0;

  if (amBatch) {
    if (!inName)
      return MessageAndExit("Must specify an input CGM file to use -b or -f");
    if (!nOut)
      return MessageAndExit("Must specify some output file to use -b");
    noDisplay= 1;
  }

  /* Create CGM and PostScript engines */
  for (i=0 ; i<nOut ; i++) {
    if (outTypes[i]==0) CreateCGM(i, outNames[i]);
    else if (outTypes[i]==1) CreatePS(i, outNames[i]);
  }

  /* If page list specified, do implied send command */
  if (amBatch && nPageGroups<=0) {
    mPage[0]= 1;
    nPage[0]= 32767;
    sPage[0]= 1;
    nPageGroups= 1;
  }
  if (nPageGroups>0) {
    for (i=0 ; i<8 ; i++) {
      if (!outSend[i]) GpDeactivate(outEngines[i]);
      if (outSend[i] && !GpActivate(outEngines[i])) n_active_groups++;
    }
  }

  g_initializer(&argc, argv);

  return 0;
}