Changeset 1488


Ignore:
Timestamp:
12/15/11 13:19:56 (18 months ago)
Author:
tsv
Message:

Flat branch update. Collection of fixes and small improvements, required for futher module.

  • Fixed Makefiles to correct clean/create modules
  • Make menu title possible to have non langid values
  • Make load_from_file() much more universal
  • variable names enhahcements
Location:
branches/reyalp-flt
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/reyalp-flt/CHDK/Makefile

    r1007 r1488  
    2828clean: 
    2929        rm -f $(GENLUA) 
     30        rm -f MODULES/*.flt 
    3031 
    3132include $(topdir)bottom.inc 
  • branches/reyalp-flt/Makefile

    r1481 r1488  
    1111firsub: all 
    1212        mkdir -p  $(topdir)bin 
     13        mkdir -p  $(topdir)CHDK/MODULES 
    1314        cp $(topdir)loader/$(PLATFORM)/main.bin  $(topdir)bin/main.bin 
    1415ifndef NOZERO100K 
  • branches/reyalp-flt/core/gui_menu.h

    r1467 r1488  
    5050typedef struct { 
    5151    char                symbol; 
    52     short               title; 
     52    int                 title; 
    5353    void                (*on_change)(unsigned int item); 
    5454    const CMenuItem     *menu; 
  • branches/reyalp-flt/core/module_load.c

    r1483 r1488  
    109109                strcpy(tgt,name); 
    110110        else 
    111    sprintf(tgt,"A/CHDK/MODULES/%s",name); 
     111   sprintf(tgt,"%s/%s",MODULES_PATH,name); 
    112112} 
    113113 
  • branches/reyalp-flt/core/module_load.h

    r1483 r1488  
    88// This is main CHDK trunk 
    99#define CURRENT_CHDK_BRANCH 1 
     10 
     11#define MODULES_PATH "A/CHDK/MODULES" 
     12 
     13 
     14// Base typedefs 
     15//------------------- 
    1016 
    1117#define EXPORTLIST_MAGIC_NUMBER  0x43215678 
     
    2228}; 
    2329 
     30 
     31// Common module functions 
     32//------------------------- 
     33 
    2434int module_check_is_exist(char* name); 
    2535int module_find(char * name ); 
     
    3242void module_set_flags(unsigned int idx, char value); 
    3343 
     44void* module_get_adr(unsigned int idx); 
     45 
     46 
     47// Asynchronous unloading 
     48//------------------------- 
    3449void module_async_unload(unsigned int idx); 
    3550void module_async_unload_allrunned(int enforce); 
    3651void module_tick_unloader(); 
    3752 
    38 void* module_get_adr(unsigned int idx); 
    39  
    40  
     53// In-module binding to conf. 
     54//--------------------------- 
    4155#define CONF_BIND_INT(idConf,var)  if ( conf_getValue(idConf, &configVal) == CONF_VALUE ) {     var = configVal.pInt; } else { return 1;} 
    4256#define CONF_BIND_COLOR(idConf,var)  if ( conf_getValue(idConf, &configVal) == CONF_VALUE ) {   var = (color*)configVal.pInt; } else { return 1;} 
  • branches/reyalp-flt/core/modules/Makefile

    r1483 r1488  
    134134 
    135135clean: 
    136         rm -f *.o *.elf.syms *.elf $(OBJS) $(OPT_OBJS) 
     136        rm -f *.o *.elf.syms *.elf *.flt $(OBJS) $(OPT_OBJS) 
    137137 
    138138distclean: clean 
  • branches/reyalp-flt/include/lang.h

    r1393 r1488  
    55extern void lang_init(int num); 
    66 
    7 extern void lang_parse_from_mem(char *buf); 
    87extern void lang_load_from_file(const char *filename); 
    98extern void lang_map_preparsed_from_mem( char* gui_lang_default, int num ); 
    109 
    11 typedef void (*callback_process_file)(char* buf); 
    12 extern void load_from_file(const char *filename, callback_process_file callback) ; 
     10typedef int (*callback_process_file)(char* buf, int size); 
     11extern int load_from_file(const char *filename, callback_process_file callback) ; 
    1312 
    1413extern char* lang_str(int str); 
  • branches/reyalp-flt/lib/lang/lang.c

    r1393 r1488  
    6969// buf - source array (content of file.lng ) 
    7070//------------------------------------------------------------------- 
    71 void lang_parse_from_mem(char *buf) { 
     71int lang_parse_from_mem(char *buf, int size) { 
    7272    char *p, *s, *e; 
    7373    int i; 
     74 
     75        if  ( size <= 0 ) 
     76          return 0; 
    7477 
    7578    e = buf-1; 
     
    9598        } 
    9699    } 
     100        return 1; 
    97101} 
    98102 
     
    116120} 
    117121 
    118  
     122// PURPOSE: 
    119123// Universal file processor 
    120124// Load file, process by callback, unalloc/close file 
     125// RETURN: 
     126//       Transfer return value from callback 
     127// NOTE: 
     128//       Call callback even if fail to load/malloc (size=-1 if no file, size=0 if empty)  
    121129//------------------------------------------------------------------- 
    122 void load_from_file(const char *filename, callback_process_file callback) 
     130int load_from_file(const char *filename, callback_process_file callback) 
    123131{ 
    124132    int f, size; 
     
    126134    char *buf; 
    127135 
     136        buf = 0; 
     137    size = -1; 
     138 
    128139    f = open(filename, O_RDONLY, 0777); 
    129     if (f>=0) { 
     140    if (f>=0) 
    130141        size = (stat((char*)filename, &st)==0)?st.st_size:0; 
    131         if (size) { 
     142    if (size>0 ) 
    132143            buf = umalloc(size+1); 
    133144            if (buf) { 
    134145                size = read(f, buf, size); 
    135146                buf[size]=0; 
    136                 callback(buf); 
     147        } 
     148 
     149        size = callback( buf, size); 
     150 
     151        if ( buf ) 
    137152                ufree(buf); 
    138             } 
    139         } 
     153    if (f>=0) 
    140154        close(f); 
    141     } 
     155 
     156        return size; 
    142157} 
    143158 
  • branches/reyalp-flt/tools/elf2flt/elfflt.c

    r1483 r1488  
    698698            printf("\n"); 
    699699        } 
    700         printf("->Module Info: %s\n", get_flat_string(_module_info->ModuleInfo) ); 
     700        printf("->Module Info: %s\n", get_flat_string(_module_info->description) ); 
    701701  } 
    702702 
  • branches/reyalp-flt/tools/elf2flt/flt.h

    r1483 r1488  
    9696        int32_t moduleName;                     // pointer to string with module name or -LANG_ID 
    9797        uint16_t major_ver, minor_ver; 
    98         int32_t ModuleInfo; 
     98        int32_t description;            // pointer to string with module description 
    9999}; 
    100100 
  • branches/reyalp-flt/tools/elf2flt/fltdump.c

    r1483 r1488  
    159159                    printf("\n"); 
    160160                } 
    161                 printf("->Module Info: %s\n", get_flat_string(_module_info->ModuleInfo) ); 
     161                printf("->Module Info: %s\n", get_flat_string(_module_info->description) ); 
    162162        } 
    163163                 
Note: See TracChangeset for help on using the changeset viewer.