mirror of
https://github.com/janet-lang/janet
synced 2024-11-17 22:24:49 +00:00
3f27d78ab5
Add support for integer return and floating point return variants, as well as arguments on the stack. Start flushing out struct arguments. Still needed: - structs (packed and unpacked) - complex numbers - long doubles - MASM alternative for windows (you can technically use sysv abi on windows) - more calling conventions.
38 lines
646 B
C
38 lines
646 B
C
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
|
|
int int_fn(int a, int b) {
|
|
return (a << 2) + b;
|
|
}
|
|
|
|
double my_fn(int64_t a, int64_t b, const char *x) {
|
|
return (double)(a + b) + 0.5 + strlen(x);
|
|
}
|
|
|
|
double double_fn(double x, double y, double z) {
|
|
return (x + y) * z * 3;
|
|
}
|
|
|
|
double double_many(double x, double y, double z, double w, double a, double b) {
|
|
return x + y + z + w + a + b;
|
|
}
|
|
|
|
double double_lots(
|
|
double a,
|
|
double b,
|
|
double c,
|
|
double d,
|
|
double e,
|
|
double f,
|
|
double g,
|
|
double h,
|
|
double i,
|
|
double j) {
|
|
return i + j;
|
|
}
|
|
|
|
double float_fn(float x, float y, float z) {
|
|
return (x + y) * z;
|
|
}
|