Author Topic: Making a plugin for ML, problems  (Read 3738 times)

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Making a plugin for ML, problems
« on: July 02, 2012, 09:31:24 PM »
I'm trying to make a plugin for ML o see how it works.
I've started from testplug, and changed a little to this:
Code: [Select]
#define PLUGIN_CLIENT
#include "plugin.h"

extern const char* CARD_DRIVE;
extern int transparent_overlay_hidden;

EXTERN_FUNC(MODULE_FUNC_INIT, struct plugin_descriptor *, somefunc) {
    msleep(100);
    beep();
    FILE * f = FIO_Open(CARD_DRIVE "ML/DATA/overlay.dat", 0);
    if (f != (void*) -1)
    {
beep();
        FIO_CloseFile(f);
FIO_RemoveFile(CARD_DRIVE "ML/DATA/overlay.dat");
    transparent_overlay_hidden = !transparent_overlay_hidden;
redraw();
        beep();
    }
    return 0;
}

But i have errors when compiling:
Code: [Select]
scraxplug.c: In function 'somefunc':
scraxplug.c:10:36: error: expected ')' before string constant
scraxplug.c:10:36: error: too few arguments to function 'FIO_Open'
scraxplug.c:15:29: error: expected ')' before string constant
make[2]: *** [scraxplug.o] Error 1

some hint?
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

coutts

  • Developer
  • Senior
  • *****
  • Posts: 401
Re: Making a plugin for ML, problems
« Reply #1 on: July 03, 2012, 05:56:12 PM »
I'm trying to make a plugin for ML o see how it works.
I've started from testplug, and changed a little to this:
Code: [Select]
#define PLUGIN_CLIENT
#include "plugin.h"

extern const char* CARD_DRIVE;
extern int transparent_overlay_hidden;

EXTERN_FUNC(MODULE_FUNC_INIT, struct plugin_descriptor *, somefunc) {
    msleep(100);
    beep();
    FILE * f = FIO_Open(CARD_DRIVE "ML/DATA/overlay.dat", 0);
    if (f != (void*) -1)
    {
beep();
        FIO_CloseFile(f);
FIO_RemoveFile(CARD_DRIVE "ML/DATA/overlay.dat");
    transparent_overlay_hidden = !transparent_overlay_hidden;
redraw();
        beep();
    }
    return 0;
}

But i have errors when compiling:
Code: [Select]
scraxplug.c: In function 'somefunc':
scraxplug.c:10:36: error: expected ')' before string constant
scraxplug.c:10:36: error: too few arguments to function 'FIO_Open'
scraxplug.c:15:29: error: expected ')' before string constant
make[2]: *** [scraxplug.o] Error 1

some hint?
did you mean to say FIO_OpenFile ?

scrax

  • Contributor
  • Hero Member
  • *****
  • Posts: 1543
  • Code monkey
Re: Making a plugin for ML, problems
« Reply #2 on: July 03, 2012, 09:23:12 PM »
No, I think. Tried both  but nothing...

the code compile right if used with "don't click me":
Code: [Select]
extern int transparent_overlay_hidden;
void run_test()
{
    msleep(2000);
    //~ while(gui_menu_shown()) msleep(100);
    //~ msleep(2000);
    //~ menu_benchmark();
    //~ menu_save_all_items_dbg();
    beep();
    FILE* f = FIO_Open(CARD_DRIVE "ML/DATA/overlay.dat", 0);
    if (f != (void*) -1)
    {
beep();
        FIO_CloseFile(f);
FIO_RemoveFile(CARD_DRIVE "ML/DATA/overlay.dat");
    transparent_overlay_hidden = !transparent_overlay_hidden;
redraw();
        beep();
    }

}

Even without calling "extern const char* CARD_DRIVE;"
I suppose that I need to put something also for FIO_File but I've not yet figured what...
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-