root/core/modules.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. dummy_void
  2. dummy_int
  3. module_load_rawop
  4. default_raw_merge_start
  5. default_raw_subtract
  6. module_restore_edge
  7. module_save_edge
  8. module_edgeovr_load
  9. default_edge_overlay
  10. default_load_edge_overlay
  11. default_md_init_motion_detector
  12. script_lang_id
  13. module_set_script_lang
  14. default_script_start
  15. default_script_start_file
  16. default_gui_osd_draw_zebra
  17. default_histogram_process
  18. default_gui_osd_draw_histo
  19. module_curves_load
  20. default_curve_init_mode
  21. default_curve_set_mode
  22. default_curve_set_file
  23. default_gui_grid_draw_osd
  24. default_grid_lines_load
  25. default_show_palette
  26. default_show_popup
  27. default_file_select
  28. default_create_badpixel_bin
  29. default_capture_data_for_exif
  30. default_load_bad_pixels_list_b
  31. default_convert_dng_to_chdk_raw
  32. default_load_dng_to_rawbuffer
  33. default_textbox_init
  34. default_hexbox_init
  35. default_read_file
  36. default_shot_histogram_set
  37. default_shot_histogram_get_range

   1 /*
   2  *   CHDK-FLAT Module System.  
   3  *
   4  *   (c)2011 Sergey Taranenko aka tsvstar
   5  *
   6  *   Specific "shortcuts", dynamic libraries binding
   7  */
   8 
   9 #include "camera_info.h"
  10 #include "console.h"
  11 #include "conf.h"
  12 #include "modules.h"
  13 #include "module_load.h"
  14 #include "shooting.h"
  15 #include "ctype.h"
  16 
  17 //------------------------------------------------
  18 // Notes on the module auto-load system
  19 //
  20 // Module functions are called through a pointer to a module interface structure.
  21 // For example, the Raw Merge module interface is defined as:
  22 //        typedef struct
  23 //        {
  24 //            base_interface_t    base;
  25 //
  26 //            int (*raw_merge_start)(int action);
  27 //            int (*raw_merge_add_file)(const char* filename);
  28 //            void (*raw_merge_end)(void);
  29 //            int (*raw_subtract)(const char *fromName, const char *fromDir, const char *subName, const char *subDir);
  30 //        } librawop_sym;
  31 //
  32 // Each of the functions can be called through the global 'librawop' pointer.
  33 // For example:
  34 //      librawop->raw_merge_start(...);
  35 //
  36 // However the functions can only be called if the pointer actually points to something valid
  37 //
  38 // Prior to the auto-load system, the core code had to do something like this:
  39 //      if (librawop == 0)
  40 //      {
  41 //          librawop = module_load("_rawop.flt");
  42 //          ... probably do some error checking here as well
  43 //      }
  44 //      librawop->raw_merge_start(...);
  45 //      ... other Raw Merge stuff
  46 //      module_unload(librawop);
  47 //      librawop = 0;
  48 //
  49 // With the module auto-load system the core code can just call:
  50 //      librawop->raw_merge_start(...);
  51 // and everything else is take care of automatically.
  52 //
  53 // The system works by initialising every global module pointer to a dummy instance of the
  54 // module interface. The dummy interface must implement the same set of functions; but the
  55 // functions themselves don't have to do anything in all cases.
  56 //
  57 // The dummy interface for Raw Merge is:
  58 //        librawop_sym default_librawop =
  59 //        {
  60 //            { 0,0,0,0,0 },
  61 //            default_raw_merge_start,
  62 //            dummy_int,                  //raw_merge_add_file
  63 //            dummy_void,                 //raw_merge_end,
  64 //            default_raw_subtract
  65 //        };
  66 //
  67 // Only the raw_merge_start and raw_subtract functions do anything interesting, raw_merge_add_file
  68 // and raw_merge_end do nothing if the module is not loaded.
  69 //
  70 // The implementation of default_raw_merge_start, and default_raw_subtract (see code below)
  71 // try to load the actual module, if this is successful, then they call the equivalent module function
  72 //
  73 // Once the module is loaded into memory, the global module pointer is updated to point to the
  74 // module code. Subsequent calls to the module functions call the real module code, not the dummy
  75 // interface.
  76 //
  77 // When the module is unloaded, the global pointer is reset back to the dummy interface so future
  78 // calls will reload the module.
  79 //
  80 // Load / unload is managed with the module_handler_t structure. This contains pointers to the global
  81 // module pointer, the dummy interface, version and module name.
  82 //------------------------------------------------
  83 
  84 //------------------------------------------------
  85 // Dummy functions for default module libraries
  86 // Used when function does not need to do anything
  87 // unless module is loaded
  88 
  89 static void             dummy_void()    {}
  90 static int              dummy_int()     { return 0; }
  91 // static char*            dummy_pchar()   { return (char*)0; }
  92 // static unsigned char*   dummy_puchar()  { return (unsigned char*)0; }
  93 
  94 /************* DYNAMIC LIBRARY RAWOPERATION ******/
  95 
  96 // Forward reference
  97 extern librawop_sym default_librawop;
  98 
  99 module_handler_t h_rawop =
 100 {
 101     (base_interface_t**)&librawop,
 102     &default_librawop.base,
 103     RAW_MERGE_VERSION,
 104     "_rawop.flt"
 105 };
 106 
 107 static int module_load_rawop()
 108 {
 109     return module_load(&h_rawop);
 110 }
 111 
 112 // Default (unloaded) function(s)
 113 static int default_raw_merge_start(int action)
 114 {
 115     // If load succeeded call module version of function
 116     if (module_load_rawop())
 117         return librawop->raw_merge_start(action);
 118 
 119     // Failure
 120     return 0;
 121 }
 122 static int default_raw_subtract(const char *fromName, const char *fromDir, const char *subName, const char *subDir)
 123 {
 124     // If load succeeded call module version of function
 125     if (module_load_rawop())
 126         return librawop->raw_subtract(fromName, fromDir, subName, subDir);
 127 
 128     // Failure
 129     return 0;
 130 }
 131 
 132 // Default library - module unloaded
 133 librawop_sym default_librawop =
 134 {
 135     { 0,0,0,0,0 },
 136     default_raw_merge_start,
 137     dummy_int,                  //raw_merge_add_file
 138     dummy_void,                 //raw_merge_end,
 139     default_raw_subtract
 140 };
 141 
 142 // Library pointer
 143 librawop_sym* librawop = &default_librawop;
 144 
 145 
 146 /************* DYNAMIC LIBRARY EDGE OVERLAY ******/
 147 
 148 // Storage and interface for edge overlay 'image' buffer.
 149 // This is so the previous overlay can survive if the module gets unloaded
 150 static void* saved_edgebuf = 0;
 151 static int saved_edgestate = 0;
 152 
 153 int module_restore_edge(void **buf) { *buf = saved_edgebuf; return saved_edgestate; }
 154 void module_save_edge(void* buf, int state)      { saved_edgebuf = buf; saved_edgestate = state; }
 155 
 156 #define MODULE_NAME_EDGEOVR "edgeovr.flt"
 157 
 158 // Forward reference
 159 extern libedgeovr_sym default_libedgeovr;
 160 
 161 module_handler_t h_edgeovr =
 162 {
 163     (base_interface_t**)&libedgeovr,
 164     &default_libedgeovr.base,
 165     EDGEOVERLAY_VERSION,
 166     MODULE_NAME_EDGEOVR
 167 };
 168 
 169 // Return: 0-fail, 1-ok
 170 static int module_edgeovr_load()
 171 {
 172     // This flag is because edgeovr called each tick
 173     //   If module loading failed, then do not try to load it until reboot
 174     //    (otherwise we will try to load module each tick)
 175     static int flag_load_fail = 0;
 176 
 177     if ( flag_load_fail==0 )
 178         if (!module_load(&h_edgeovr))
 179             flag_load_fail = 1;
 180 
 181     return flag_load_fail == 0;
 182 }
 183 
 184 // Default (unloaded) function(s)
 185 static void default_edge_overlay()
 186 {
 187     // If load succeeded call module version of function
 188     if (module_edgeovr_load())
 189         libedgeovr->edge_overlay();
 190 }
 191 static void default_load_edge_overlay(const char* fn)
 192 {
 193     // If load succeeded call module version of function
 194     if (module_edgeovr_load())
 195         libedgeovr->load_edge_overlay(fn);
 196 }
 197 
 198 // Default library - module unloaded
 199 libedgeovr_sym default_libedgeovr =
 200 {
 201     { 0,0,0,0,0 },
 202     default_edge_overlay,
 203     default_load_edge_overlay,
 204     dummy_void,                 //save_edge_overlay
 205 };
 206 
 207 // Library pointer
 208 libedgeovr_sym* libedgeovr = &default_libedgeovr;
 209 
 210 /************* DYNAMIC LIBRARY MOTION DETECT ******/
 211 
 212 #define MODULE_NAME_MDETECT "mdetect.flt"
 213 
 214 // Forward reference
 215 extern libmotiondetect_sym default_libmotiondetect;
 216 
 217 module_handler_t h_motiondetect =
 218 {
 219     (base_interface_t**)&libmotiondetect,
 220     &default_libmotiondetect.base,
 221     MOTION_DETECTOR_VERSION,
 222     MODULE_NAME_MDETECT
 223 };
 224 
 225 // Default (unloaded) function(s)
 226 static int default_md_init_motion_detector(
 227  int columns, int rows, int pixel_measure_mode, int detection_timeout, int measure_interval, int threshold, int draw_grid, 
 228  int clipping_region_mode, int clipping_region_column1, int clipping_region_row1, int clipping_region_column2, int clipping_region_row2,
 229  int parameters, int pixels_step, int msecs_before_trigger)
 230 {
 231     // If load succeeded call module version of function
 232     if (module_load(&h_motiondetect))
 233         return libmotiondetect->md_init_motion_detector(
 234                     columns, rows, pixel_measure_mode, detection_timeout, measure_interval, threshold, draw_grid, 
 235                     clipping_region_mode, clipping_region_column1, clipping_region_row1, clipping_region_column2, clipping_region_row2,
 236                     parameters, pixels_step, msecs_before_trigger);
 237 
 238     // Failure
 239     return 0;
 240 }
 241 
 242 // Default library - module unloaded
 243 libmotiondetect_sym default_libmotiondetect =
 244 {
 245     { 0,0,0,0,0 },
 246     dummy_void,                         //md_close_motion_detector
 247     default_md_init_motion_detector,
 248     dummy_int,                          //md_get_cell_diff
 249     dummy_void,                         //md_draw_grid
 250     dummy_int                           //md_get_cell_val
 251 };
 252 
 253 // Library pointer
 254 libmotiondetect_sym* libmotiondetect = &default_libmotiondetect;
 255 
 256 /************* DYNAMIC LIBRARY Script language ******/
 257 
 258 #define MODULE_NAME_UNK     "unknown"
 259 #define MODULE_NAME_LUA     "lua.flt"
 260 #define MODULE_NAME_UBASIC  "ubasic.flt"
 261 
 262 // Forward reference
 263 extern libscriptapi_sym default_libscriptapi;
 264 
 265 module_handler_t h_script =
 266 {
 267     (base_interface_t**)&libscriptapi,
 268     &default_libscriptapi.base,
 269     SCRIPT_API_VERSION,
 270     MODULE_NAME_UNK
 271 };
 272 
 273 // Which script language is being used
 274 #define SCRIPT_LANG_NONE    0
 275 #define SCRIPT_LANG_UBASIC  1
 276 #define SCRIPT_LANG_LUA     2
 277 
 278 static int current_lang_id = SCRIPT_LANG_NONE;
 279 
 280 static int script_lang_id(const char* script_file)
 281 {
 282     if ((script_file == 0) || (script_file[0] == 0))
 283         return SCRIPT_LANG_LUA;  // Default script is Lua
 284 
 285     char *ext = strrchr(script_file,'.');
 286 
 287     if (ext && (strlen(ext) == 4) && (toupper(ext[1]) == 'L') && (toupper(ext[2]) == 'U') && (toupper(ext[3]) == 'A'))
 288         return SCRIPT_LANG_LUA;
 289 
 290     return SCRIPT_LANG_UBASIC;
 291 }
 292 
 293 void module_set_script_lang(const char* script_file)
 294 {
 295     char* lang_names[] = { MODULE_NAME_UNK, MODULE_NAME_UBASIC, MODULE_NAME_LUA };
 296 
 297     int lang_id = script_lang_id(script_file);
 298 
 299     if (lang_id != current_lang_id)
 300     {
 301         module_unload(h_script.name);
 302         current_lang_id = lang_id;
 303         h_script.name = lang_names[lang_id];
 304     }
 305 }
 306 
 307 // Default (unloaded) function(s)
 308 static int default_script_start(char const* script, int is_ptp)
 309 {
 310     // If load succeeded call module version of function
 311     if (module_load(&h_script))
 312         return libscriptapi->script_start(script, is_ptp);
 313 
 314     // Failure
 315     return 0;
 316 }
 317 static int default_script_start_file(char const* filename)
 318 {
 319     // If load succeeded call module version of function
 320     if (module_load(&h_script))
 321         return libscriptapi->script_start_file(filename);
 322 
 323     // Failure
 324     return 0;
 325 }
 326 
 327 // Default library - module unloaded
 328 libscriptapi_sym default_libscriptapi =
 329 {
 330     { 0,0,0,0,0 },
 331     default_script_start,
 332     default_script_start_file,
 333     dummy_int,              //script_run
 334     dummy_void,             //script_reset
 335     dummy_void,             //set_variable
 336     dummy_void,             //set_as_ret
 337     dummy_int,               //run_restore
 338     dummy_void,             //shoot_hook
 339 };
 340 
 341 // Library pointer
 342 libscriptapi_sym* libscriptapi = &default_libscriptapi;
 343 
 344 /************* DYNAMIC LIBRARY ZEBRA ******/
 345 
 346 #define MODULE_NAME_ZEBRA "zebra.flt"
 347 
 348 // Forward reference
 349 extern libzebra_sym default_libzebra;
 350 
 351 module_handler_t h_zebra =
 352 {
 353     (base_interface_t**)&libzebra,
 354     &default_libzebra.base,
 355     ZEBRA_VERSION,
 356     MODULE_NAME_ZEBRA
 357 };
 358 
 359 // Default (unloaded) function(s)
 360 static int default_gui_osd_draw_zebra(int show)
 361 {
 362     // If load succeeded call module version of function
 363     if (module_load(&h_zebra))
 364         return libzebra->gui_osd_draw_zebra(show);
 365 
 366     // Failure
 367     return 0;
 368 }
 369 
 370 // Default library - module unloaded
 371 libzebra_sym default_libzebra =
 372 {
 373     { 0,0,0,0,0 },
 374     default_gui_osd_draw_zebra
 375 };
 376 
 377 // Library pointer
 378 libzebra_sym* libzebra = &default_libzebra;
 379 
 380 /************* DYNAMIC LIBRARY HISTOGRAM ******/
 381 
 382 #define MODULE_NAME_HISTO "histo.flt"
 383 
 384 // Forward reference
 385 extern libhisto_sym default_libhisto;
 386 
 387 module_handler_t h_histo =
 388 {
 389     (base_interface_t**)&libhisto,
 390     &default_libhisto.base,
 391     HISTO_VERSION,
 392     MODULE_NAME_HISTO
 393 };
 394 
 395 // Default (unloaded) function(s)
 396 static void default_histogram_process()
 397 {
 398     // If load succeeded call module version of function
 399     if (module_load(&h_histo))
 400         libhisto->histogram_process();
 401 }
 402 
 403 // Default (unloaded) function(s)
 404 static void default_gui_osd_draw_histo(int is_osd_edit)
 405 {
 406     if (is_osd_edit ||
 407         ((camera_info.state.mode_play || !camera_info.state.mode_video) &&
 408          (
 409           ((conf.show_histo==SHOW_HISTO_HALF) && camera_info.state.is_shutter_half_press) ||
 410           ((conf.show_histo==SHOW_HISTO_REC) && camera_info.state.mode_rec && (recreview_hold==0)) ||
 411           ((conf.show_histo==SHOW_HISTO_ALWAYS) && (recreview_hold==0))
 412          )
 413         )
 414        )
 415     {
 416         // If load succeeded call module version of function
 417         if (module_load(&h_histo))
 418             libhisto->gui_osd_draw_histo(is_osd_edit);
 419     }
 420 }
 421 
 422 // Default library - module unloaded
 423 libhisto_sym default_libhisto =
 424 {
 425     { 0,0,0,0,0 },
 426     default_histogram_process,
 427     default_gui_osd_draw_histo
 428 };
 429 
 430 // Library pointer
 431 libhisto_sym* libhisto = &default_libhisto;
 432 
 433 /************* DYNAMIC LIBRARY CURVES ******/
 434 
 435 #define MODULE_NAME_CURVES "curves.flt"
 436 
 437 // Forward reference
 438 extern libcurves_sym default_libcurves;
 439 
 440 module_handler_t h_curves =
 441 {
 442     (base_interface_t**)&libcurves,
 443     &default_libcurves.base,
 444     CURVES_VERSION,
 445     MODULE_NAME_CURVES
 446 };
 447 
 448 // Return: 0-fail, addr-ok
 449 static int module_curves_load()
 450 {
 451     if (camera_sensor.bits_per_pixel == 10)
 452         return module_load(&h_curves);
 453     return 0;
 454 }
 455 
 456 // Default (unloaded) function(s)
 457 static void default_curve_init_mode()
 458 {
 459     // If load succeeded call module version of function
 460     if (module_curves_load())
 461         libcurves->curve_init_mode();
 462 }
 463 static void default_curve_set_mode()
 464 {
 465     // If load succeeded call module version of function
 466     if (module_curves_load())
 467         libcurves->curve_set_mode();
 468 }
 469 static void default_curve_set_file()
 470 {
 471     // If load succeeded call module version of function
 472     if (module_curves_load())
 473         libcurves->curve_set_file();
 474 }
 475 
 476 // Default library - module unloaded
 477 libcurves_sym default_libcurves =
 478 {
 479     { 0,0,0,0,0 },
 480     default_curve_init_mode,
 481     dummy_void,                 //curve_apply
 482     default_curve_set_mode,
 483     default_curve_set_file
 484 };
 485 
 486 // Library pointer
 487 libcurves_sym* libcurves = &default_libcurves;
 488 
 489 /************* DYNAMIC LIBRARY GRIDS ******/
 490 
 491 #define MODULE_NAME_GRIDS "grids.flt"
 492 
 493 // Forward reference
 494 extern libgrids_sym default_libgrids;
 495 
 496 module_handler_t h_grids =
 497 {
 498     (base_interface_t**)&libgrids,
 499     &default_libgrids.base,
 500     GUI_GRID_VERSION,
 501     MODULE_NAME_GRIDS
 502 };
 503 
 504 // Default (unloaded) function(s)
 505 static void default_gui_grid_draw_osd(int force)
 506 {
 507     // If load succeeded call module version of function
 508     if (conf.show_grid_lines)
 509         if (module_load(&h_grids))
 510             libgrids->gui_grid_draw_osd(force);
 511 }
 512 static void default_grid_lines_load(const char *fn)
 513 {
 514     // If load succeeded call module version of function
 515     if (module_load(&h_grids))
 516         libgrids->grid_lines_load(fn);
 517 }
 518 
 519 // Default library - module unloaded
 520 libgrids_sym default_libgrids =
 521 {
 522     { 0,0,0,0,0 },
 523     default_gui_grid_draw_osd,
 524     default_grid_lines_load
 525 };
 526 
 527 // Library pointer
 528 libgrids_sym* libgrids = &default_libgrids;
 529 
 530 
 531 /************* MODULE PALETTE ******/
 532 
 533 #define MODULE_NAME_PALETTE "palette.flt"
 534 
 535 // Forward reference
 536 extern libpalette_sym default_libpalette;
 537 
 538 module_handler_t h_palette =
 539 {
 540     (base_interface_t**)&libpalette,
 541     &default_libpalette.base,
 542     GUI_PALETTE_VERSION,
 543     MODULE_NAME_PALETTE
 544 };
 545 
 546 // Default (unloaded) function
 547 static void default_show_palette(int mode, chdkColor st_color, void (*on_select)(chdkColor clr))
 548 {
 549     // If load succeeded call module version of function
 550     if (module_load(&h_palette))
 551         libpalette->show_palette(mode, st_color, on_select);
 552 }
 553 
 554 // Default library - module unloaded
 555 libpalette_sym default_libpalette =
 556 {
 557     { 0,0,0,0,0 },
 558     default_show_palette
 559 };
 560 
 561 // Library pointer
 562 libpalette_sym* libpalette = &default_libpalette;
 563 
 564 /************* MODULE MPOPUP ******/
 565 
 566 #define MODULE_NAME_MPOPUP "mpopup.flt"
 567 
 568 // Forward reference
 569 extern libmpopup_sym default_libmpopup;
 570 
 571 module_handler_t h_mpopup =
 572 {
 573     (base_interface_t**)&libmpopup,
 574     &default_libmpopup.base,
 575     GUI_MPOPUP_VERSION,
 576     MODULE_NAME_MPOPUP
 577 };
 578 
 579 // Default (unloaded) function
 580 static void default_show_popup(struct mpopup_item* popup_actions, const unsigned int flags, void (*on_select)(unsigned int actn))
 581 {
 582     // If load succeeded call module version of function
 583     if (module_load(&h_mpopup))
 584         libmpopup->show_popup(popup_actions, flags, on_select);
 585 }
 586 
 587 // Default library - module unloaded
 588 libmpopup_sym default_libmpopup =
 589 {
 590     { 0,0,0,0,0 },
 591     default_show_popup
 592 };
 593 
 594 // Library pointer
 595 libmpopup_sym* libmpopup = &default_libmpopup;
 596 
 597 /************* MODULE FSELECT ******/
 598 
 599 #define MODULE_NAME_FSELECT "fselect.flt"
 600 
 601 // Forward reference
 602 extern libfselect_sym default_libfselect;
 603 
 604 module_handler_t h_fselect =
 605 {
 606     (base_interface_t**)&libfselect,
 607     &default_libfselect.base,
 608     GUI_FSELECT_VERSION,
 609     MODULE_NAME_FSELECT
 610 };
 611 
 612 // Default (unloaded) function
 613 static void default_file_select(int title, const char* prev_dir, const char* default_dir, void (*on_select)(const char *fn))
 614 {
 615     // If load succeeded call module version of function
 616     if (module_load(&h_fselect))
 617         libfselect->file_select(title, prev_dir, default_dir, on_select);
 618 }
 619 
 620 // Default library - module unloaded
 621 libfselect_sym default_libfselect =
 622 {
 623     { 0,0,0,0,0 },
 624     default_file_select
 625 };
 626 
 627 // Library pointer
 628 libfselect_sym* libfselect = &default_libfselect;
 629 
 630 /************* MODULE DNG ******/
 631 
 632 #define MODULE_NAME_DNG "_dng.flt"
 633 
 634 // Forward reference
 635 extern libdng_sym default_libdng;
 636 
 637 module_handler_t h_dng =
 638 {
 639     (base_interface_t**)&libdng,
 640     &default_libdng.base,
 641     DNG_VERSION,
 642     MODULE_NAME_DNG
 643 };
 644 
 645 // Default (unloaded) function
 646 static void default_create_badpixel_bin()
 647 {
 648     // If load succeeded call module version of function
 649     if (module_load(&h_dng))
 650         libdng->create_badpixel_bin();
 651 }
 652 static void default_capture_data_for_exif()
 653 {
 654     // If load succeeded call module version of function
 655     if (module_load(&h_dng))
 656         libdng->capture_data_for_exif();
 657 }
 658 static void default_load_bad_pixels_list_b(char* filename)
 659 {
 660     // If load succeeded call module version of function
 661     if (module_load(&h_dng))
 662         libdng->load_bad_pixels_list_b(filename);
 663 }
 664 static int default_convert_dng_to_chdk_raw(char* fn)
 665 {
 666     // If load succeeded call module version of function
 667     if (module_load(&h_dng))
 668         return libdng->convert_dng_to_chdk_raw(fn);
 669 
 670     // Failure
 671     return 0;
 672 }
 673 static void default_load_dng_to_rawbuffer(char *fn, char *rawadr)
 674 {
 675     // If load succeeded call module version of function
 676     if (module_load(&h_dng))
 677         libdng->load_dng_to_rawbuffer(fn, rawadr);
 678 }
 679 
 680 // Default library - module unloaded
 681 libdng_sym default_libdng =
 682 {
 683     { 0,0,0,0,0 },
 684     default_create_badpixel_bin,
 685     dummy_int,                          //raw_init_badpixel_bin
 686     default_capture_data_for_exif,
 687     default_load_bad_pixels_list_b,
 688     dummy_int,                          //badpixel_list_loaded_b
 689     default_convert_dng_to_chdk_raw,
 690     dummy_int,                          //write_dng
 691     default_load_dng_to_rawbuffer,
 692     dummy_void,                         //create_dng_header_for_ptp
 693     dummy_void                          //free_dng_header_for_ptp
 694 };
 695 
 696 // Library pointer
 697 libdng_sym* libdng = &default_libdng;
 698 
 699 /************* MODULE TBOX ******/
 700 
 701 #define MODULE_NAME_TBOX "_tbox.flt"
 702 
 703 // Forward reference
 704 extern libtextbox_sym default_libtextbox;
 705 
 706 module_handler_t h_textbox =
 707 {
 708     (base_interface_t**)&libtextbox,
 709     &default_libtextbox.base,
 710     GUI_TBOX_VERSION,
 711     MODULE_NAME_TBOX
 712 };
 713 
 714 // Default (unloaded) function
 715 static int default_textbox_init(int title, int msg, const char* defaultstr, unsigned int maxsize, void (*on_select)(const char* newstr), char *input_buffer)
 716 {
 717     // If load succeeded call module version of function
 718     if (module_load(&h_textbox))
 719         return libtextbox->textbox_init(title,msg,defaultstr,maxsize,on_select,input_buffer);
 720 
 721     // Failure
 722     return 0;
 723 }
 724 
 725 // Default library - module unloaded
 726 libtextbox_sym default_libtextbox =
 727 {
 728     { 0,0,0,0,0 },
 729     default_textbox_init,
 730 };
 731 
 732 // Library pointer
 733 libtextbox_sym* libtextbox = &default_libtextbox;
 734 
 735 /************* MODULE HEXBOX ******/
 736 
 737 #define MODULE_NAME_HEXBOX "_hexbox.flt"
 738 
 739 // Forward reference
 740 extern libhexbox_sym default_libhexbox;
 741 
 742 module_handler_t h_hexbox =
 743 {
 744     (base_interface_t**)&libhexbox,
 745     &default_libhexbox.base,
 746     GUI_HEXBOX_VERSION,
 747     MODULE_NAME_HEXBOX
 748 };
 749 
 750 // Default (unloaded) function
 751 static int default_hexbox_init(int *num, char *title, int flags)
 752 {
 753     // If load succeeded call module version of function
 754     if (module_load(&h_hexbox))
 755         return libhexbox->hexbox_init(num, title, flags);
 756 
 757     // Failure
 758     return 0;
 759 }
 760 
 761 // Default library - module unloaded
 762 libhexbox_sym default_libhexbox =
 763 {
 764     { 0,0,0,0,0 },
 765     default_hexbox_init,
 766 };
 767 
 768 // Library pointer
 769 libhexbox_sym* libhexbox = &default_libhexbox;
 770 
 771 /************* MODULE TXTREAD ******/
 772 
 773 #define MODULE_NAME_TXTREAD "txtread.flt"
 774 
 775 // Forward reference
 776 extern libtxtread_sym default_libtxtread;
 777 
 778 module_handler_t h_txtread =
 779 {
 780     (base_interface_t**)&libtxtread,
 781     &default_libtxtread.base,
 782     GUI_READ_VERSION,
 783     MODULE_NAME_TXTREAD
 784 };
 785 
 786 // Default (unloaded) function
 787 static int default_read_file(const char *fn)
 788 {
 789     // If load succeeded call module version of function
 790     if (module_load(&h_txtread))
 791         return libtxtread->read_file(fn);
 792 
 793     // Failure
 794     return 0;
 795 }
 796 
 797 // Default library - module unloaded
 798 libtxtread_sym default_libtxtread =
 799 {
 800     { 0,0,0,0,0 },
 801     default_read_file,
 802 };
 803 
 804 // Library pointer
 805 libtxtread_sym* libtxtread = &default_libtxtread;
 806 
 807 /************* MODULE Shot Histogram ******/
 808 
 809 #define MODULE_NAME_SHOTHIST "shothist.flt"
 810 
 811 // Forward reference
 812 extern libshothisto_sym default_libshothisto;
 813 
 814 module_handler_t h_shothisto =
 815 {
 816     (base_interface_t**)&libshothisto,
 817     &default_libshothisto.base,
 818     SHOT_HISTO_VERSION,
 819     MODULE_NAME_SHOTHIST
 820 };
 821 
 822 static int default_shot_histogram_set(int enable)
 823 {
 824     // If enabling shot histogram, then load module, otherwise nothing to do
 825     if (enable)
 826         if (module_load(&h_shothisto))
 827             return libshothisto->shot_histogram_set(enable);
 828     return 1;
 829 }
 830 static int default_shot_histogram_get_range()
 831 {
 832     return -1;  // Module not loaded
 833 }
 834 
 835 // Default library - module unloaded
 836 libshothisto_sym default_libshothisto=
 837 {
 838     { 0,0,0,0,0 },
 839     default_shot_histogram_set,
 840     default_shot_histogram_get_range,
 841     dummy_void,                         //build_shot_histogram,
 842     dummy_void,                         //write_to_file
 843 };
 844 
 845 // Library pointer
 846 libshothisto_sym* libshothisto = &default_libshothisto;

/* [<][>][^][v][top][bottom][index][help] */