コード例 #1
0
ファイル: dumpnames.c プロジェクト: gitpan/btparse
boolean process_file (char *filename)
{
   FILE *  infile;
   AST *   entry;
   boolean status, 
           overall_status;

   infile = fopen (filename, "r");
   if (infile == NULL)
   {
      perror (filename);
      return FALSE;
   }

   overall_status = TRUE;                  /* assume success */
   while (1)
   {
      entry = bt_parse_entry (infile, filename, 0, &status);
      overall_status &= status;
      if (!entry) break;
      dump_names (entry);
      bt_free_ast (entry);
   }
   
   return overall_status;

} /* process_file () */
コード例 #2
0
ファイル: ar.c プロジェクト: meesokim/z88dk
void dump_object( FILE *fp, char *filename )
{
    long obj_start = ftell(fp) - 8;		/* before signature */
    int org = -1;
    long fp_modname, fp_expr, fp_names, fp_extern, fp_code;

    if ( file_version >= 8 )
        ; /* no object ORG - ORG is now per section */
    else if ( file_version >= 5 )
        org		= (int) xfread_long( fp, filename );
    else
        org		= xfread_word( fp, filename );

    fp_modname	= xfread_long( fp, filename );
    fp_expr		= xfread_long( fp, filename );
    fp_names	= xfread_long( fp, filename );
    fp_extern	= xfread_long( fp, filename );
    fp_code		= xfread_long( fp, filename );

    /* module name */
    fseek( fp, obj_start + fp_modname, SEEK_SET );
    printf("  Name: %s\n", xfread_string( fp, filename ) );

    /* org */
    if ( org >= 0 )
        printf("  Org:  $%04X\n", org );

    /* names */
    if ( fp_names >= 0 )
        dump_names( fp, filename,
                    obj_start + fp_names,
                    obj_start + END( fp_extern, fp_modname ) );

    /* extern */
    if ( fp_extern >= 0 )
        dump_extern( fp, filename,
                     obj_start + fp_extern,
                     obj_start + fp_modname );

    /* expressions */
    if ( fp_expr >= 0 && opt_showexpr )
        dump_expr( fp, filename,
                   obj_start + fp_expr,
                   obj_start + END( fp_names, END( fp_extern, fp_modname ) ) );

    /* code */
    if ( fp_code >= 0 && opt_dump_code )
        dump_code( fp, filename, obj_start + fp_code );
}
コード例 #3
0
ファイル: sstest.c プロジェクト: Ghnuberath/gnumeric
static void
test_insdel_rowcol_names (void)
{
	Workbook *wb;
	Sheet *sheet1,*sheet2;
	const char *test_name = "test_insdel_rowcol_names";
	GOUndo *undo;
	int i;

	mark_test_start (test_name);

	wb = workbook_new ();
	sheet1 = workbook_sheet_add (wb, -1,
				     GNM_DEFAULT_COLS, GNM_DEFAULT_ROWS);
	sheet2 = workbook_sheet_add (wb, -1,
				     GNM_DEFAULT_COLS, GNM_DEFAULT_ROWS);

	define_name ("Print_Area", "Sheet1!$A$1:$IV$65536", sheet1);
	define_name ("Print_Area", "Sheet2!$A$1:$IV$65536", sheet2);

	define_name ("NAMEGA1", "A1", wb);
	define_name ("NAMEG2", "$A$14+Sheet1!$A$14+Sheet2!$A$14", wb);

	define_name ("NAMEA1", "A1", sheet1);
	define_name ("NAMEA2", "A2", sheet1);
	define_name ("NAMEA1ABS", "$A$1", sheet1);
	define_name ("NAMEA2ABS", "$A$2", sheet1);

	dump_names (wb);

	for (i = 3; i >= 0; i--) {
		g_printerr ("About to insert before column %d on %s\n",
			    i, sheet1->name_unquoted);
		sheet_insert_cols (sheet1, i, 12, &undo, NULL);
		dump_names (wb);
		g_printerr ("Undoing.\n");
		go_undo_undo_with_data (undo, NULL);
		g_object_unref (undo);
		g_printerr ("Done.\n");
	}

	for (i = 3; i >= 0; i--) {
		g_printerr ("About to insert before column %d on %s\n",
			    i, sheet2->name_unquoted);
		sheet_insert_cols (sheet2, i, 12, &undo, NULL);
		dump_names (wb);
		g_printerr ("Undoing.\n");
		go_undo_undo_with_data (undo, NULL);
		g_object_unref (undo);
		g_printerr ("Done.\n");
	}

	for (i = 3; i >= 0; i--) {
		g_printerr ("About to delete column %d on %s\n",
			    i, sheet1->name_unquoted);
		sheet_delete_cols (sheet1, i, 1, &undo, NULL);
		dump_names (wb);
		g_printerr ("Undoing.\n");
		go_undo_undo_with_data (undo, NULL);
		g_object_unref (undo);
		g_printerr ("Done.\n");
	}

	g_object_unref (wb);

	mark_test_end (test_name);
}