New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Changeset 81757


Ignore:
Timestamp:
08/04/11 11:00:25 (4 years ago)
Author:
cal@…
Message:

rev-upgrade: Add function to get the readable name from a cpu_type_t

Location:
branches/gsoc11-rev-upgrade/base/src/machista1.0
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/gsoc11-rev-upgrade/base/src/machista1.0/libmachista.c

    r80736 r81757  
    8484} 
    8585 
     86const char *macho_get_arch_name (cpu_type_t cputype) { 
     87    const NXArchInfo *archInfo = NXGetArchInfoFromCpuType(cputype, CPU_SUBTYPE_MULTIPLE);        
     88    if (!archInfo) { 
     89        return NULL; 
     90    } 
     91    return archInfo->name; 
     92} 
     93 
    8694/* Some byteswap wrappers */ 
    8795static uint32_t macho_swap32 (uint32_t input) { 
  • branches/gsoc11-rev-upgrade/base/src/machista1.0/libmachista.h

    r80510 r81757  
    112112 
    113113/** 
     114 * Returns a readable version of any cpu_type_t constant. Returns a valid pointer to the first 
     115 * character in a 0-terminated string or NULL on error. The pointer must not be free()'d after use. 
     116 */ 
     117const char *macho_get_arch_name(cpu_type_t cputype); 
     118 
     119/** 
    114120 * Parses the Mach-O file indicated by filepath and writes a pointer to a macho_t describing the 
    115121 * Mach-O file into the location idicated by res. Returns MACHO_SUCCESS on success or any of the 
  • branches/gsoc11-rev-upgrade/base/src/machista1.0/machista.i

    r80760 r81757  
    152152char *macho_format_dylib_version(uint32_t); 
    153153 
     154/** 
     155 * map macho_get_arch_name() 
     156 * The memory for the returned char * comes from NXGetArchInfoFromCpuType(), 
     157 * which is documentet in arch(3), without ever mentioning any memory issues. I 
     158 * assume it's static memory, that should not be free()'d. 
     159 */ 
     160%rename(get_arch_name) macho_get_arch_name; 
     161const char *macho_get_arch_name(cpu_type_t); 
     162 
  • branches/gsoc11-rev-upgrade/base/src/machista1.0/machista_wrap.c

    r81254 r81757  
    22932293 
    22942294 
     2295SWIGINTERN int 
     2296_wrap_get_arch_name(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { 
     2297  cpu_type_t arg1 ; 
     2298  int val1 ; 
     2299  int ecode1 = 0 ; 
     2300  char *result = 0 ; 
     2301   
     2302  if (SWIG_GetArgs(interp, objc, objv,"o:machista::get_arch_name cpu_type_t ",(void *)0) == TCL_ERROR) SWIG_fail; 
     2303  ecode1 = SWIG_AsVal_int SWIG_TCL_CALL_ARGS_2(objv[1], &val1); 
     2304  if (!SWIG_IsOK(ecode1)) { 
     2305    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "get_arch_name" "', argument " "1"" of type '" "cpu_type_t""'"); 
     2306  }  
     2307  arg1 = (cpu_type_t)(val1); 
     2308  result = (char *)macho_get_arch_name(arg1); 
     2309  Tcl_SetObjResult(interp,SWIG_FromCharPtr((const char *)result)); 
     2310  { 
     2311    free(result); 
     2312  } 
     2313  return TCL_OK; 
     2314fail: 
     2315  return TCL_ERROR; 
     2316} 
     2317 
     2318 
    22952319 
    22962320static swig_command_info swig_commands[] = { 
     
    23172341    { SWIG_prefix "strerror", (swig_wrapper_func) _wrap_strerror, NULL}, 
    23182342    { SWIG_prefix "format_dylib_version", (swig_wrapper_func) _wrap_format_dylib_version, NULL}, 
     2343    { SWIG_prefix "get_arch_name", (swig_wrapper_func) _wrap_get_arch_name, NULL}, 
    23192344    {0, 0, 0} 
    23202345}; 
Note: See TracChangeset for help on using the changeset viewer.