Re: Euphoria To C Question

new topic     » topic index » view thread      » older message » newer message

Bernie:

That's easy.
Infact, the first thing I did when the translator came
out was to write a Eu->C and C->Eu interfacing module.
Simply add interface.c to the compilation process and
include interface.h in the C source you want to use
interfacing.
You don't need even need a main() or winmain()
function anymore if all your Euphoria program
incorporates are routines, and no global statements.
Simply write C/C++ libraries in Euphoria using this
lib! And add C/C++ code manually to your Euphoria
routines that can use the arguments passed!

I'd be happy to give this lib to yall, but it'll cost
ya. Why? Because I'd like to enhance it further, and
to do that, I need the full translator version! So
Bernie,
 Rob, Junko, start sending away!! Untill then, use
these free routines to prove that I ain't lying;

/* Euphoria To C Interfacing Module   */
/* Version 1.0                        */


/* By Mike the Spike */

#define EUDIR "D:\EUPHORIA\include\Euphoria.h" /*
Change to your dir */

void init_interface()
{
        /* initialise the interfacing library */
    int _0, _1, _2, _3;
    int argc;
    char **argv;

    argc = 1;
    argv = make_arg_cv(szCmdLine, &argc);
    winInstance = hInstance;
    eu_startup(_00);
    init_literal();
    shift_args(argc, argv);
    _0 = _0s;
    _1 = NewS1(1);
    _2 = (int)((s1_ptr)_1)->first;
}

int get_sequence_int(int seq,int idx)
{
        /* Return integer at index 'idx' in sequence 'seq' */
        int ret1;

        ret1 = (int)SEQ_PTR(seq);
                return (int)*(idx+((s1_ptr)ret1)->first;
}

void set_sequence_atom(int seq, int idx, double atm)
{
}

void set_sequence_string(int seq,int idx, char * str)
{
}

void set_sequence_int(int seq,int idx,int val)
{
}

double get_sequence_atom(int seq,int idx)
{
}

char * get_sequence_string(int seq,int idx)
{
}

void get_sequence_int(int seq,int idx,int val)
{
}

char compare(int a,int b)
{
        /* Compare a and b */
        return binary_op_a(NOTEQ, a, b);
}




PS. Rob, the reason I once gave to write a translator
was so users would be able to write libraries, DLLs
and APIs in Euphoria. Why didn't you implement these
feature yet? They should have being in! Do I have to
do everything around here? :p Oh, and BTW, delaring
'int _0, _1, _2, _3' in EVERY Euphoria function
translated to C, if they use these vars or not, is not
good coding style! (Save 12 Bytes+increase calling
speed by letting them out when they are unsused)


__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu