root/core/modules.c

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

DEFINITIONS

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

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