gboolean wtl_fm_init(void) { if (libsmfm_initialization_failed) return FALSE; if (libsmfm_initialized) return TRUE; GModule * libsmfm = g_module_open("libsmfm-gtk2.so.4", 0); /* if (!libfm) { libfm = g_module_open("libfm-gtk.so.3", 0); } if (!libfm) { libfm = g_module_open("libfm-gtk.so.2", 0); } */ if (!libsmfm) { su_print_error_message("Failed load libsmfm-gtk2.so.4"); goto fail; } #define bind_name(name) if (! g_module_symbol(libsmfm, #name, (gpointer * ) &__##name) ) \ {\ su_print_error_message("Failed resolve %s\n", #name); \ goto fail;\ } bind_name(fm_gtk_init); bind_name(fm_get_gtk_file_menu_for_string); #undef bind_name __fm_gtk_init(NULL); libsmfm_initialized = TRUE; return TRUE; fail: libsmfm_initialization_failed = TRUE; return FALSE; }
static int vobjdump(void) { p = vobj; if (vlen>4 && p[0]==0x56 && p[1]==0x4f && p[2]==0x42 && p[3]==0x4a) { int endian,nsecs,nsyms,i; const char *cpu_name; struct vobj_symbol *vsymbols = NULL; struct vobj_section *vsect = NULL; p += 4; /* skip ID */ endian = (int)*p++; /* endianess */ if (endian<1 || endian>2) { fprintf(stderr,"Wrong endianess: %d\n",endian); return 1; } bpb = (int)read_number(0); /* bits per byte */ if (bpb != 8) { fprintf(stderr,"%d bits per byte not supported!\n",bpb); return 1; } bpt = (int)read_number(0); /* bytes per taddr */ if (bpt > sizeof(taddr)) { fprintf(stderr,"%d bytes per taddr not supported!\n",bpt); return 1; } bptmask = makemask(bpt*bpb); cpu_name = p; skip_string(); /* skip cpu-string */ nsecs = (int)read_number(0); /* number of sections */ nsyms = (int)read_number(0); /* number of symbols */ /* print header */ print_sep(); printf("VOBJ %s (%s endian), %d bits per byte, %d bytes per word.\n" "%d symbol%s.\n%d section%s.\n", cpu_name,endian_name[endian-1],bpb,bpt, nsyms,nsyms==1?emptystr:sstr,nsecs,nsecs==1?emptystr:sstr); /* read symbols */ if (nsyms) { if (vsymbols = malloc(nsyms * sizeof(struct vobj_symbol))) { for (i=0; i<nsyms; i++) read_symbol(&vsymbols[i]); } else { fprintf(stderr,"Cannot allocate %ld bytes for symbols!\n", (long)(nsyms * sizeof(struct vobj_symbol))); return 1; } } /* read and print sections */ if (vsect = malloc(nsecs * sizeof(struct vobj_section))) { for (i=0; i<nsecs; i++) read_section(&vsect[i],vsymbols,nsyms); } else { fprintf(stderr,"Cannot allocate %ld bytes for sections!\n", (long)(nsecs * sizeof(struct vobj_section))); return 1; } /* print symbols */ for (i=0; i<nsyms; i++) { struct vobj_symbol *vs = &vsymbols[i]; if (i == 0) { printf("\n"); print_sep(); printf("SYMBOL TABLE\n" "file offs bind size type def value name\n"); } if (!strncmp(vs->name," *current pc",12)) continue; printf("%08llx: %-4s %08x %-4s %8.8s %8llx %s\n", BPTMASK(vs->offs),bind_name(vs->flags),(unsigned)vs->size, type_name[TYPE(vs)],def_name(vs,vsect,nsecs), BPTMASK(vs->val),vs->name); } } else { fprintf(stderr,"Not a VOBJ file!\n"); return 1; } return 0; }