Ejemplo n.º 1
0
int main(int argc, char **argv)
{
    ptable_s table;
    supermach_s *machine;
    printf("reading: %s\n",argv[1]);

    machine = build_smachine (_COMPINITID_, MACH_ARGS);

    if (argc < 2)
        read_lines(machine, "samples/workingtest");
    else
        read_lines(machine, argv[1]);
    populate_reserved (machine, "keywords");
    run_machine (machine);
    //cleanup(machine)
    table = build_ptable("samples/commandlinegrammar", machine);
    synan (machine, table);
    fprintlistingfile(machine);
    fprinttokenfile(machine);
    printlistingfile(machine);
    fprint_ptable (&table);
    //printtokenfile(machine);
    cleanup(machine);
    return 0;
}
Ejemplo n.º 2
0
/*
 * Find the extended partition entry in a partition table
 * and build the partition if it exists.
 */
static struct ptable_list_s *
find_ext_pentry(off_t offset, struct ptable_entry *table)
{
     int i;
     fbvar_t *sectsize_var;
     unsigned sectsize;

     /* get the sector size from the fatback variable table */
     sectsize_var = get_fbvar("sectsize");
     if (!sectsize_var->val.ival) {
          display(NORMAL, "Error: sectsize set to 0!\n");
          free(sectsize_var);
          return 0;
     }
     sectsize = sectsize_var->val.ival;
     free(sectsize_var);
     
     /* find the extend entry in the partition table */
     for (i = 0; i < NUM_PTABLE_ENTRIES; i++)
          if (is_extended_part(&table[i])) {
               offset += table[i].offset * sectsize;
               return (build_ptable(offset));
          }
     return NULL;
}
Ejemplo n.º 3
0
/*
 * This is the main initialization interface to this module.
 * it reads in the partition tables recursively and sets the 
 * Sector_size variable for the module
 */
int map_partitions(void)
{
     if (!(Ptable_list = build_ptable((off_t)0))) {
          free(Ptable_list);
          display(VERBOSE, "Unable to map partitions\n");
          return 0;
     } else
          return part_count(Ptable_list);
}