Changeset 1516


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

reyalp-flt branch update:

  • common unified api versioning
  • unified interaction with loadable libraries. export symbols moved to versioned api structures
  • libcurves interface simplified slightly
Location:
branches/reyalp-flt
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • branches/reyalp-flt/core/conf.c

    r1514 r1516  
    490490        if ( !module_dng_load(LIBDNG_OWNED_BY_RAW) ) 
    491491                return; 
    492         if (!libdng.badpixel_list_loaded_b()) libdng.load_bad_pixels_list_b("A/CHDK/badpixel.bin"); 
    493         if (!libdng.badpixel_list_loaded_b()) conf.dng_raw=0; 
     492        if (!libdng->badpixel_list_loaded_b()) libdng->load_bad_pixels_list_b("A/CHDK/badpixel.bin"); 
     493        if (!libdng->badpixel_list_loaded_b()) conf.dng_raw=0; 
    494494 } 
    495  else if ( libdng.load_bad_pixels_list_b ) { 
    496         libdng.load_bad_pixels_list_b(0);        //unload badpixel.bin 
     495 else if ( libdng && libdng->load_bad_pixels_list_b ) { 
     496        libdng->load_bad_pixels_list_b(0);        //unload badpixel.bin 
    497497        module_dng_unload(LIBDNG_OWNED_BY_RAW); 
    498498 } 
  • branches/reyalp-flt/core/curves.c

    r1514 r1516  
    103103        current_curve_type = curve_type; 
    104104        return 1; 
    105 } 
    106  
    107 void curve_set_mode(int value) { 
    108         if((value>=0) && (value<=4)) *conf_curve_enable=value; 
    109         curve_init_mode(); 
    110105} 
    111106 
     
    411406 
    412407 
     408struct libcurves_sym libcurves = { 
     409                        MAKE_API_VERSION(1,0),          // apiver: increase major if incomplatible changes made in module,  
     410                                                                                // increase minor if compatible changes made(including extending this struct) 
     411                        curve_init_mode, 
     412                        curve_apply 
     413}; 
     414 
    413415int module_idx=-1; 
    414416 
     
    419421void* MODULE_EXPORT_LIST[] = { 
    420422        /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 
    421         /* 1 */ (void*)5, 
    422  
    423                         curve_set_mode, 
    424                         curve_init_mode, 
    425                         curve_apply, 
     423        /* 1 */ (void*)3, 
     424                        &libcurves 
    426425                }; 
    427426 
     
    438437     return 1; 
    439438 
     439  if ( !API_VERSION_MATCH_REQUIREMENT( camera_sensor.api_version, 1, 0 ) ) 
     440         return 1; 
     441 
    440442  // Safe bind of conf. 
    441443  tConfigVal configVal; 
     
    459461        // This could be happens only if on-load mistake 
    460462        // CHDK never unload this library (but load only if needed) 
    461         // Reason: a) curve_set_mode by LUA is not stored anywhere 
    462         //                 b) perfomance reason - to avoid load on each raw_processing 
     463        // Reason: perfomance reason - to avoid load on each raw_processing 
    463464  return 0; 
    464465} 
  • branches/reyalp-flt/core/curves.h

    r1467 r1516  
    44#define CURVE_DIR "A/CHDK/CURVES" 
    55 
     6struct libcurves_sym { 
     7        int version; 
     8 
     9        void (*curve_init_mode)(); 
     10        void (*curve_apply)(); 
     11}; 
     12 
    613 
    714// Defines of exported to chdk symbols 
    815#ifdef THIS_IS_CHDK_CORE 
    916        // This section is for CHDK core 
    10         extern void (*curve_set_mode)(); 
    11         extern void (*curve_init_mode)(); 
    12         extern void (*curve_apply)(); 
     17        extern struct libcurves_sym* libcurves; 
    1318#else 
    1419        // This section is for module 
    15         extern void curve_set_mode(); 
    1620        extern void curve_init_mode(); 
    1721        extern void curve_apply(); 
  • branches/reyalp-flt/core/dng.c

    r1515 r1516  
    749749#include "module_load.h" 
    750750 
    751 void* MODULE_EXPORT_LIST[] = { 
    752         /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 
    753         /* 1 */ (void*)9, 
     751struct libdng_sym libdng = { 
     752                        MAKE_API_VERSION(1,0),          // apiver: increase major if incomplatible changes made in module,  
     753                                                                                // increase minor if compatible changes made(including extending this struct) 
    754754 
    755755                        create_badpixel_bin, 
     
    760760 
    761761                        convert_dng_to_chdk_raw, 
    762                         write_dng, 
     762                        write_dng 
    763763                }; 
    764764 
     765 
     766//------------------------------------------- 
     767void* MODULE_EXPORT_LIST[] = { 
     768        /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 
     769        /* 1 */ (void*)3, 
     770 
     771                        &libdng 
     772                }; 
     773 
     774//-------------------------------------------- 
    765775int _module_loader( void** chdk_export_list ) 
    766776{ 
    767777  if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    768778     return 1; 
     779 
     780  if ( !API_VERSION_MATCH_REQUIREMENT( camera_sensor.api_version, 1, 0 ) ) 
     781         return 1; 
     782  if ( !API_VERSION_MATCH_REQUIREMENT( camera_info.api_version, 1, 0 ) ) 
     783         return 1; 
    769784 
    770785  return 0; 
  • branches/reyalp-flt/core/dng.h

    r1515 r1516  
    66// This is to minimize export list to different modules 
    77struct libdng_sym { 
    8         int  size;                             // simple guard to detect changing list of exported by library symbols 
     8        int  version; 
    99        void (*create_badpixel_bin)(); 
    1010        int  (*raw_init_badpixel_bin)(); 
     
    2121 
    2222        // This section is for CHDK core 
    23         extern struct libdng_sym libdng; 
     23        extern struct libdng_sym* libdng; 
    2424#else 
    2525         
  • branches/reyalp-flt/core/edgeoverlay.c

    r1514 r1516  
    767767 **************************************************************/ 
    768768 
    769 void* MODULE_EXPORT_LIST[] = { 
    770         /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 
    771         /* 1 */ (void*)5, 
     769struct libedgeovr_sym libedgeovr = { 
     770                        MAKE_API_VERSION(1,0),          // apiver: increase major if incomplatible changes made in module,  
     771                                                                                // increase minor if compatible changes made(including extending this struct) 
    772772 
    773773                        edge_overlay, 
    774774                        save_edge_overlay, 
    775775                        load_edge_overlay 
     776                }; 
     777 
     778 
     779void* MODULE_EXPORT_LIST[] = { 
     780        /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 
     781        /* 1 */ (void*)3, 
     782 
     783                        &libedgeovr 
    776784                }; 
    777785 
     
    787795  if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    788796     return 1; 
     797 
     798  if ( !API_VERSION_MATCH_REQUIREMENT( camera_sensor.api_version, 1, 0 ) ) 
     799         return 1; 
     800 
    789801 
    790802  tConfigVal configVal; 
  • branches/reyalp-flt/core/edgeoverlay.h

    r1467 r1516  
    99#define EDGE_SAVE_DIR "A/CHDK/EDGE" 
    1010 
     11struct libedgeovr_sym { 
     12        int  version; 
     13        void (*edge_overlay)(); 
     14        void (*save_edge_overlay)(void); 
     15        void (*load_edge_overlay)( const char* ); 
     16}; 
     17 
     18 
    1119// Defines of exported to chdk symbols 
    1220#ifdef THIS_IS_CHDK_CORE 
    1321        // This section is for CHDK core 
    14         extern void (*edge_overlay)(); 
    15         extern void (*save_edge_overlay)(void); 
    16         extern void (*load_edge_overlay)( const char* ); 
     22        extern struct libedgeovr_sym* libedgeovr; 
    1723#else 
    1824        // This section is for module 
  • branches/reyalp-flt/core/gui.c

    r1514 r1516  
    4747#define OPTIONS_AUTOSAVE 
    4848#define SPLASH_TIME               20 
     49 
     50struct gui_common_api_ver gui_version = { 
     51                MAKE_API_VERSION(1,0),                  // ver of common api: gui_mode, mbox, this structure 
     52                MAKE_API_VERSION(1,0)                   // ver of menu structure 
     53}; 
     54 
    4955 
    5056//shortcuts 
     
    10021008        // because not clear when it finished 
    10031009        if ( module_dng_load(LIBDNG_OWNED_BY_CREATEBADPIXEL) ) 
    1004         libdng.create_badpixel_bin(); 
     1010        libdng->create_badpixel_bin(); 
    10051011} 
    10061012#endif 
     
    10421048    gui_enum_value_change(&conf.curve_enable,change,sizeof(modes)/sizeof(modes[0])); 
    10431049 
    1044         if(change && curve_init_mode) 
    1045                 curve_init_mode(); 
     1050        if(change && libcurves && libcurves->curve_init_mode) 
     1051                libcurves->curve_init_mode(); 
    10461052    return modes[conf.curve_enable]; 
    10471053} 
     
    16461652                // TODO we could sanity check here, but curve_set_type should fail gracefullish 
    16471653                strcpy(conf.curve_file,fn); 
    1648                 if(conf.curve_enable == 1 && curve_init_mode) 
    1649                         curve_init_mode(); 
     1654                if(conf.curve_enable == 1 && libcurves && libcurves->curve_init_mode) 
     1655                        libcurves->curve_init_mode(); 
    16501656        } 
    16511657} 
     
    26872693static void gui_load_edge_selected( const char* fn ) { 
    26882694    if( fn && module_edgeovr_load()) 
    2689                 load_edge_overlay(fn); 
     2695                libedgeovr->load_edge_overlay(fn); 
    26902696} 
    26912697 
    26922698void gui_menuproc_edge_save(int arg) { 
    26932699        if ( module_edgeovr_load() ) 
    2694         save_edge_overlay(); 
     2700        libedgeovr->save_edge_overlay(); 
    26952701} 
    26962702 
  • branches/reyalp-flt/core/gui_debug.c

    r1514 r1516  
    183183     return 1; 
    184184 
     185  if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.common_api, 1, 0 ) ) 
     186          return 1; 
     187 
    185188  tConfigVal configVal; 
    186189  CONF_BIND_INT(195, conf_mem_view_addr_init); 
  • branches/reyalp-flt/core/gui_fselect.c

    r1514 r1516  
    965965 if (!librawop_p) 
    966966        return;         //exit if fail 
     967  if ( !API_VERSION_MATCH_REQUIREMENT( librawop_p->version, 1, 0 ) ) 
     968    return; 
    967969 
    968970 if ((fselect_marked_count()>1) && librawop_p->raw_merge_start(raw_operation)) { 
     
    987989        if (!librawop_p) 
    988990                return;         //exit if fail 
     991        if ( !API_VERSION_MATCH_REQUIREMENT( librawop_p->version, 1, 0 ) ) 
     992                return; 
    989993 
    990994    if(!(raw_subtract_from = malloc(300))) //3x full path 
     
    13251329     return 1; 
    13261330 
     1331  if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.common_api, 1, 0 ) ) 
     1332          return 1; 
     1333 
    13271334  tConfigVal configVal; 
    13281335  CONF_BIND_INT(209, conf_sub_batch_prefix); 
  • branches/reyalp-flt/core/gui_mpopup.c

    r1513 r1516  
    173173     return 1; 
    174174 
     175  if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.common_api, 1, 0 ) ) 
     176          return 1; 
     177 
    175178  return 0; 
    176179} 
  • branches/reyalp-flt/core/gui_palette.c

    r1514 r1516  
    150150  if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    151151     return 1; 
     152  if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.common_api, 1, 0 ) ) 
     153          return 1; 
    152154 
    153155  return 0; 
  • branches/reyalp-flt/core/gui_read.c

    r1514 r1516  
    267267 
    268268    reader_is_active = 0; 
    269             if (!rbf_load(conf_menu_rbf_file)) 
    270                 rbf_load_from_8x16(current_font); 
    271             rbf_set_codepage(FONT_CP_WIN); 
     269    if (!rbf_load(conf_menu_rbf_file)) 
     270        rbf_load_from_8x16(current_font); 
     271    rbf_set_codepage(FONT_CP_WIN); 
    272272        if (read_file >= 0) { 
    273                 close(read_file); 
    274                 read_file=-1; 
     273        close(read_file); 
     274            read_file=-1; 
    275275    } 
    276276} 
     
    300300  if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    301301     return 1; 
     302  if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.common_api, 1, 0 ) ) 
     303          return 1; 
    302304 
    303305  tConfigVal configVal; 
  • branches/reyalp-flt/core/gui_snake.c

    r1514 r1516  
    460460  if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    461461     return 1; 
     462  if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.common_api, 1, 0 ) ) 
     463          return 1; 
    462464 
    463465  return 0; 
  • branches/reyalp-flt/core/gui_sokoban.c

    r1514 r1516  
    474474  if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    475475     return 1; 
     476  if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.common_api, 1, 0 ) ) 
     477          return 1; 
    476478 
    477479  // Safe bind of conf. 
  • branches/reyalp-flt/core/gui_tetris.c

    r1514 r1516  
    755755     return 1; 
    756756 
     757  if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.common_api, 1, 0 ) ) 
     758          return 1; 
    757759 
    758760  return 0; 
  • branches/reyalp-flt/core/luascript.c

    r1514 r1516  
    2121#include "gui_lang.h" 
    2222#include "gui_draw.h" 
     23#include "module_load.h" 
    2324 
    2425#include "../lib/lua/lstate.h"  // for L->nCcalls, baseCcalls 
     
    269270  int value; 
    270271  value=luaL_checknumber( L, 1 ); 
    271   if (module_curves_load()) 
    272     return luaL_argerror(L,1,"fail to load curves module"); 
    273   curve_set_mode(value); 
     272 
     273  conf.curve_enable = value; 
     274  if ( libcurves && libcurves->curve_init_mode) 
     275                libcurves->curve_init_mode(); 
     276 
    274277  return 0; 
    275278} 
     
    13891392  if (!module_rawop_load()) 
    13901393    return luaL_argerror(L,1,"fail to load raw merge module"); 
    1391   if (op == RAW_OPERATION_SUM || op == RAW_OPERATION_AVERAGE) { 
    1392     librawop.raw_merge_start(op); 
     1394 
     1395  if ( API_VERSION_MATCH_REQUIREMENT( librawop->version, 1, 0 ) && 
     1396       (op == RAW_OPERATION_SUM || op == RAW_OPERATION_AVERAGE) ) { 
     1397    librawop->raw_merge_start(op); 
    13931398  } 
    13941399  else { 
     
    14031408  if (!module_rawop_load()) 
    14041409    return luaL_argerror(L,1,"fail to load raw merge module"); 
    1405   librawop.raw_merge_add_file(luaL_checkstring( L, 1 )); 
     1410  librawop->raw_merge_add_file(luaL_checkstring( L, 1 )); 
    14061411  return 0; 
    14071412} 
     
    14111416  if (!module_rawop_load()) 
    14121417    return luaL_argerror(L,1,"fail to load raw merge module"); 
    1413   librawop.raw_merge_end(); 
     1418  librawop->raw_merge_end(); 
    14141419  return 0; 
    14151420} 
  • branches/reyalp-flt/core/main.c

    r1515 r1516  
    1919 
    2020_cam_sensor camera_sensor = {  
     21    MAKE_API_VERSION(1,0), 
     22 
    2123    CAM_SENSOR_BITS_PER_PIXEL,  
    2224    CAM_BLACK_LEVEL, CAM_WHITE_LEVEL, 
     
    6365_cam_info camera_info = 
    6466{ 
     67    MAKE_API_VERSION(1,0), 
     68 
    6569    { 
    6670#if defined(PARAM_CAMERA_NAME) 
     
    275279                                } 
    276280                                else if (module_edgeovr_load()) { 
    277                                         edge_overlay(); 
     281                                        libedgeovr->edge_overlay(); 
    278282                                } 
    279283                        } 
  • branches/reyalp-flt/core/module_exportlist.c

    r1515 r1516  
    301301            &camera_sensor, 
    302302            &altGuiHandler, 
     303            &gui_version, 
    303304                        0 
    304305}; 
  • branches/reyalp-flt/core/module_load.h

    r1493 r1516  
    6060#define CONF_BIND_STR(idConf,var)  if ( conf_getValue(idConf, &configVal) == CONF_CHAR_PTR ) {  var = (char*)configVal.str; } else { return 1;} 
    6161 
     62// API versions check 
     63//--------------------------- 
     64#define MAKE_CHDKVER(major,minor,last) (major*10000+minor*100+last) 
     65#define MAKE_API_VERSION(major,minor) ((major<<16)+minor) 
     66#define API_VERSION_MATCH_REQUIREMENT( api_ver, req_major, req_minor ) ((api_ver>>16)==req_major && (api_ver&0xffff)>=req_minor) 
     67 
    6268 
    6369#endif /* __MODULE_LOAD_H__ */ 
  • branches/reyalp-flt/core/modules.c

    r1512 r1516  
    1717/************* DYNAMIC LIBRARY RAWOPERATION ******/ 
    1818 
    19 int (*raw_merge_start)(int action); 
    20 void (*raw_merge_add_file)(const char * filename); 
    21 void (*raw_merge_end)(void); 
    22 int (*raw_subtract)(const char *from, const char *sub, const char *dest);  
    23  
    2419#if CAM_SENSOR_BITS_PER_PIXEL==10 
    2520#define MODULE_NAME_RAWOP "_rawop10.flt" 
     
    3126 
    3227// This is to minimize sharing sym to use this lib in other modules 
    33 struct librawop_sym librawop; 
     28struct librawop_sym* librawop; 
    3429 
    3530static int bind_module_rawop( void** export_list ) 
     
    3732          // Unbind 
    3833        if ( !export_list ) { 
    39                 librawop.raw_merge_start =0; 
    40                 librawop.raw_merge_add_file =0; 
    41                 librawop.raw_merge_end =0; 
    42                 librawop.raw_subtract =0; 
     34                librawop=0; 
    4335        return 0; 
    4436        } 
     
    4739        if ( (unsigned int)export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    4840             return 1; 
    49         if ( (unsigned int)export_list[1] <6 ) 
    50          return 1; 
    51  
    52         librawop.raw_merge_start = export_list[2]; 
    53         librawop.raw_merge_add_file = export_list[3]; 
    54         librawop.raw_merge_end = export_list[4]; 
    55         librawop.raw_subtract = export_list[5]; 
     41        if ( (unsigned int)export_list[1] <3 ) 
     42         return 1; 
     43 
     44        librawop = export_list[2]; 
     45 
     46        if ( !librawop ) 
     47         return 1; 
     48 
     49    /* NO API VERSION CHECK HERE - EACH MODULE CHECK THIS AGAINST ITS REQUIREMENT 
     50        if ( !API_VERSION_MATCH_REQUIREMENT( librawop->version, 1, 0 ) ) { 
     51                librawop=0; 
     52                return 1; 
     53        } 
     54    */ 
     55 
    5656        return 0; 
    5757} 
     
    5959void module_rawop_unload() 
    6060{ 
    61         if (librawop.raw_merge_start==0) 
     61        if (librawop==0) 
    6262        return; 
    6363 
     
    7171  static int module_idx=-1; 
    7272 
    73   if (librawop.raw_merge_start) 
    74      return &librawop; 
     73  if (librawop) 
     74     return librawop; 
    7575 
    7676  module_idx=module_load(MODULE_NAME_RAWOP, bind_module_rawop ); 
    77   if ( module_idx<0 ) { 
     77  if ( module_idx<0 ) 
    7878         module_unload(MODULE_NAME_RAWOP);   
    79   } 
    80  
    81  
    82   return (librawop.raw_merge_start)?&librawop:0 ; 
     79 
     80  return librawop; 
    8381} 
    8482 
     
    8987#define MODULE_NAME_EDGEOVR "edgeovr.flt" 
    9088 
    91 void (*edge_overlay)(); 
    92 void (*save_edge_overlay)(void); 
    93 void (*load_edge_overlay)( const char* ); 
     89struct libedgeovr_sym* libedgeovr; 
    9490 
    9591static int bind_module_edgeovr( void** export_list ) 
     
    9793          // Unbind 
    9894        if ( !export_list ) { 
    99                 edge_overlay =0; 
    100                 save_edge_overlay =0; 
    101                 load_edge_overlay =0; 
     95                libedgeovr =0; 
    10296        return 0; 
    10397        } 
     
    106100        if ( (unsigned int)export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    107101             return 1; 
    108         if ( (unsigned int)export_list[1] <5 ) 
    109          return 1; 
    110  
    111         edge_overlay = export_list[2]; 
    112         save_edge_overlay = export_list[3]; 
    113         load_edge_overlay = export_list[4]; 
     102        if ( (unsigned int)export_list[1] <3 ) 
     103         return 1; 
     104 
     105        libedgeovr = export_list[2]; 
     106        if ( !libedgeovr ) 
     107         return 1; 
     108        if ( !API_VERSION_MATCH_REQUIREMENT( libedgeovr->version, 1, 0 ) ) { 
     109                libedgeovr=0; 
     110                return 1; 
     111        } 
     112 
    114113        return 0; 
    115114} 
    116115 
    117116// Return: 0-fail, 1-ok 
    118 int module_edgeovr_load() 
    119 { 
    120   if (edge_overlay) 
    121      return 1; 
     117struct libedgeovr_sym* module_edgeovr_load() 
     118{ 
     119  if (libedgeovr) 
     120     return libedgeovr; 
    122121 
    123122  // This flag is because edgeovr called each tick 
     
    141140  } 
    142141 
    143   return (edge_overlay==0)?0:1; 
    144 } 
    145  
     142  return libedgeovr; 
     143} 
     144 
     145 
     146// edgeovr module will never unload to keep its picture 
     147// void module_edgeovr_unload() {} 
    146148 
    147149 
     
    150152#define MODULE_NAME_CURVES "curves.flt" 
    151153 
    152 void (*curve_set_mode)(); 
    153 void (*curve_init_mode)(); 
    154 void (*curve_apply)(); 
    155  
     154struct libcurves_sym* libcurves; 
    156155 
    157156static int bind_module_curves( void** export_list ) 
     
    159158          // Unbind 
    160159        if ( !export_list ) { 
    161                 curve_set_mode =0; 
    162                 curve_init_mode =0; 
    163                 curve_apply =0; 
     160                libcurves=0; 
    164161        return 0; 
    165162        } 
     
    168165        if ( (unsigned int)export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    169166             return 1; 
    170         if ( (unsigned int)export_list[1] <5 ) 
    171          return 1; 
    172  
    173         curve_set_mode = export_list[2]; 
    174         curve_init_mode = export_list[3]; 
    175         curve_apply = export_list[4]; 
    176         return 0; 
    177 } 
    178  
    179 // Return: 0-fail, 1-ok 
    180 int module_curves_load() 
    181 { 
    182  
    183   if (curve_apply) 
    184      return 1; 
     167        if ( (unsigned int)export_list[1] <3 ) 
     168         return 1; 
     169 
     170        libcurves = export_list[2]; 
     171 
     172        if ( !libcurves ) 
     173         return 1; 
     174        if ( !API_VERSION_MATCH_REQUIREMENT( libcurves->version, 1, 0 ) ) { 
     175                librawop=0; 
     176                return 1; 
     177        } 
     178 
     179        return 0; 
     180} 
     181 
     182// Return: 0-fail, addr-ok 
     183struct libcurves_sym* module_curves_load() 
     184{ 
     185  if (libcurves) 
     186     return libcurves; 
    185187 
    186188  static int module_idx=-1; 
     
    198200  } 
    199201 
    200   return (curve_apply==0)?0:1; 
     202  return libcurves; 
    201203} 
    202204 
     
    253255static int module_dng_semaphore; 
    254256 
    255 struct libdng_sym libdng; 
     257struct libdng_sym* libdng; 
    256258 
    257259#if DNG_SUPPORT 
     
    260262          // Unbind 
    261263        if ( !export_list ) { 
    262                 memset(&libdng, 0, sizeof(libdng)); 
     264                libdng=0; 
    263265        return 0; 
    264266        } 
     
    267269        if ( (unsigned int)export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    268270             return 1; 
    269         if ( (unsigned int)export_list[1] < 9 ) 
    270          return 1; 
    271  
    272         libdng.size = ((int)export_list[1])-2; 
    273         libdng.create_badpixel_bin=export_list[2]; 
    274         libdng.raw_init_badpixel_bin=export_list[3]; 
    275         libdng.capture_data_for_exif=export_list[4]; 
    276         libdng.load_bad_pixels_list_b=export_list[5]; 
    277         libdng.badpixel_list_loaded_b=export_list[6]; 
    278  
    279         libdng.convert_dng_to_chdk_raw=export_list[7]; 
    280         libdng.write_dng=export_list[8]; 
     271        if ( (unsigned int)export_list[1] < 3 ) 
     272         return 1; 
     273 
     274        libdng = export_list[2]; 
     275        if ( libdng==0 ) 
     276         return 1; 
     277 
     278        if ( !API_VERSION_MATCH_REQUIREMENT( libdng->version, 1, 0 ) ) { 
     279                libdng=0;                
     280                return 1; 
     281        } 
     282 
    281283        return 0; 
    282284} 
     
    286288{ 
    287289#if DNG_SUPPORT 
    288         if (libdng.create_badpixel_bin==0) 
     290        if (libdng==0) 
    289291        return; 
    290292 
     
    305307 
    306308  module_dng_semaphore|=owner; 
    307   if (libdng.create_badpixel_bin) 
    308      return &libdng; 
     309  if (libdng) 
     310     return libdng; 
    309311 
    310312  module_idx=module_load(MODULE_NAME_DNG, bind_module_dng ); 
     
    318320  } 
    319321 
    320   return (libdng.create_badpixel_bin)?&libdng:0 ; 
     322  return libdng; 
    321323#else 
    322324  return 0; 
     
    335337        if ( !module_dng_load(LIBDNG_OWNED_BY_CONVERT) ) 
    336338                return 0; 
    337         libdng.convert_dng_to_chdk_raw(fn); 
     339        libdng->convert_dng_to_chdk_raw(fn); 
    338340        module_dng_unload(LIBDNG_OWNED_BY_CONVERT); 
    339341        return 1; 
  • branches/reyalp-flt/core/modules.h

    r1512 r1516  
    1414#include "edgeoverlay.h" 
    1515 
    16 int module_edgeovr_load();                                              // 0fail, 1ok 
     16struct libedgeovr_sym* module_edgeovr_load();   // 0fail, addr-ok 
    1717 
    1818// MODULE "CURVES" 
     
    2020#include "curves.h" 
    2121 
    22 int module_curves_load();                                               // 0fail, 1ok 
     22struct libcurves_sym* module_curves_load();             // 0fail, addr-ok 
    2323 
    2424// MODULE "PALETTE" 
  • branches/reyalp-flt/core/modules/module_inspector.c

    r1514 r1516  
    3131  if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    3232     return 1; 
     33 
     34  if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.common_api, 1, 0 ) ) 
     35          return 1; 
    3336 
    3437  _getmeminfo = chdk_export_list[MODULESYM_GETMEMINFO]; 
  • branches/reyalp-flt/core/modules/module_menu.c

    r1514 r1516  
    296296        if ( chdk_export_list[MODULESYM_GUI_MENU_RUN_FLTMODULE] == 0) 
    297297                return 1; 
     298 
     299    if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.menu_api, 1, 0 ) ) 
     300          return 1; 
    298301 
    299302        return 0; 
  • branches/reyalp-flt/core/modules/simple_game.c

    r1514 r1516  
    3232  if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    3333     return 1; 
     34 
     35  if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.common_api, 1, 0 ) ) 
     36          return 1; 
    3437 
    3538  return 0; 
  • branches/reyalp-flt/core/modules/simple_module.c

    r1483 r1516  
    2929  if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    3030     return 1; 
     31 
     32  if ( !API_VERSION_MATCH_REQUIREMENT( gui_version.common_api, 1, 0 ) ) 
     33          return 1; 
    3134 
    3235  return 0; 
  • branches/reyalp-flt/core/raw.c

    r1514 r1516  
    5252    if (conf.dng_raw) {                              
    5353                if ( module_dng_load(LIBDNG_OWNED_BY_RAW) ) 
    54                         libdng.capture_data_for_exif(); 
     54                        libdng->capture_data_for_exif(); 
    5555        } 
    5656#endif     
     
    6363#if DNG_SUPPORT 
    6464    // count/save badpixels if requested 
    65     if( libdng.raw_init_badpixel_bin &&  
    66                 libdng.raw_init_badpixel_bin()) { 
     65    if( libdng->raw_init_badpixel_bin &&  
     66                libdng->raw_init_badpixel_bin()) { 
    6767        return 0; 
    6868    } 
     
    7979        if (conf.curve_enable) { 
    8080                        if (module_curves_load()) 
    81                                 curve_apply(); 
     81                                libcurves->curve_apply(); 
    8282                } 
    8383#endif 
     
    148148            { 
    149149                                if ( module_dng_load(LIBDNG_OWNED_BY_RAW) ) { 
    150                                         libdng.write_dng(fd, rawadr, altrawadr, CAM_UNCACHED_BIT ); 
     150                                        libdng->write_dng(fd, rawadr, altrawadr, CAM_UNCACHED_BIT ); 
    151151} 
    152152            } 
     
    179179    if (conf.curve_enable) { 
    180180                if (module_curves_load()) 
    181                         curve_apply(); 
     181                        libcurves->curve_apply(); 
    182182        } 
    183183#endif 
  • branches/reyalp-flt/core/raw_merge.c

    r1514 r1516  
    379379 **************************************************************/ 
    380380 
    381 void* MODULE_EXPORT_LIST[] = { 
    382         /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 
    383         /* 1 */ (void*)6, 
    384  
     381struct librawop_sym librawop = { 
     382                        MAKE_API_VERSION(1,0),          // apiver: increase major if incomplatible changes made in module,  
     383                                                                                // increase minor if compatible changes made(including extending this struct) 
    385384                        raw_merge_start, 
    386385                        raw_merge_add_file, 
    387386                        raw_merge_end, 
    388387                        raw_subtract 
     388                }; 
     389 
     390 
     391void* MODULE_EXPORT_LIST[] = { 
     392        /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 
     393        /* 1 */ (void*)3, 
     394                 
     395                        &librawop 
    389396                }; 
    390397 
     
    400407  if ( (unsigned int)chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    401408     return 1; 
     409 
     410  if ( !API_VERSION_MATCH_REQUIREMENT( camera_sensor.api_version, 1, 0 ) ) 
     411         return 1; 
    402412 
    403413  return 0; 
  • branches/reyalp-flt/core/raw_merge.h

    r1467 r1516  
    77 
    88struct librawop_sym{ 
     9        int version; 
    910        int (*raw_merge_start)(int action); 
    1011        void (*raw_merge_add_file)(const char * filename); 
     
    1617#ifdef THIS_IS_CHDK_CORE 
    1718        // This section is for CHDK core 
    18  
    19         extern struct librawop_sym librawop; 
    20  
     19        extern struct librawop_sym* librawop; 
    2120#else 
    2221        // This section is for module 
    23  
    2422int raw_merge_start(int action); 
    2523void raw_merge_add_file(const char * filename); 
  • branches/reyalp-flt/include/camera.h

    r1515 r1516  
    223223 
    224224typedef struct { 
     225        int api_version;                        // version of this structure 
     226 
    225227    int bits_per_pixel; 
    226228    int black_level; 
     
    256258extern _cam_sensor camera_sensor; 
    257259 
     260// if this struct changed, please change gui_version.common_api  
    258261typedef struct  
    259262{ 
     
    267270typedef struct 
    268271{ 
     272        int api_version;                        // version of this structure 
     273 
    269274    struct 
    270275    { 
  • branches/reyalp-flt/include/gui.h

    r1513 r1516  
    7878extern void gui_menu_run_fltmodule(int arg); 
    7979 
     80//---------------------------- 
     81struct gui_common_api_ver { 
     82                unsigned int common_api;                // common gui version: gui_mode handling, mbox, this structure 
     83                unsigned int menu_api;          // cmenu structure version 
     84        }; 
     85 
     86// Defined in gui.c 
     87extern struct gui_common_api_ver gui_version; 
     88 
    8089#endif 
Note: See TracChangeset for help on using the changeset viewer.