Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - VadimTukaev

#1
newLISP newS / Re: Embed C or ASM in newLISP
June 14, 2014, 05:43:05 AM
Apparently you have not read the previous posts. It was about the framework "define-ext" - https://github.com/rowanthorpe/define-ext/blob/master/USAGE.txt">https://github.com/rowanthorpe/define-e ... /USAGE.txt">https://github.com/rowanthorpe/define-ext/blob/master/USAGE.txt
#2
newLISP newS / Re: Embed C or ASM in newLISP
June 14, 2014, 03:04:28 AM
It seems to be "killer-feature" to me. I have some C-code and I want to link it by high-level language.



Unfortunately, I can't understand, how to use it to embed obj files. I read USAGE.txt already! Example:


#define MAX_SIZ 100

static double per[MAX_SIZ];

double* c_percents(double* arr, int siz)
{
    if( siz > MAX_SIZ) siz = MAX_SIZ;
    double sum = 0.0;
    int i;
    for( i = 0; i < siz; ++i ) {
        sum += arr[i];
    }
    sum = 100.0 / sum;
    for( i = 0; i < siz; ++i ) {
        per[i] = arr[i] * sum;
    }
    return per;
}


I compiled it to object file c_percents.o. So, how to write newLisp code for utilizing that function? It must convert any of the lists (1 2 3 4), (300 600 900 1200) or (0.15 0.3 0.45 0.6) to (10 20 30 40). Plizzz! :)



P.S. Sorry for my ugly english, I'm russian.