ftp.nice.ch/Attic/openStep/developer/bundles/GDBbundle.1.0.s.tgz#/GDBbundle-1.0.s/debug/gdb/gdb/tests/rectTest.c

This is rectTest.c in view mode; [Download] [Up]

typedef struct _Foo4 {
    int a;
} Foo4;

typedef struct _Foo8 {
    int a;
    int b;
} Foo8;

typedef struct _Foo16 {
    int a;
    int b;
    int c;
    int d;
} Foo16;

typedef struct _Foo32 {
    int a;
    int b;
    int c;
    int d;
    int e;
    int f;
    int g;
    int h;
} Foo32;

static Foo4 getFoo4() {
    Foo4 foo4 = {1};
    return foo4;
}

static Foo8 getFoo8() {
    Foo8 foo8 = {1, 2};
    return foo8;
}

static Foo16 getFoo16() {
    Foo16 foo16 = {1, 2, 3, 4};
    return foo16;
}

static Foo32 getFoo32() {
    Foo32 foo32 = {1, 2, 3, 4, 5, 6, 7, 8};
    return foo32;
}

static void passFoo4(Foo4 foo4) {
    printf("a: %d\n", foo4.a);
}

static void passFoo8(Foo8 foo8) {
    printf("a: %d b: %d\n", foo8.a, foo8.b);
}

static void passFoo16(Foo16 foo16) {
    printf("a: %d b: %d c: %d d: %d\n", foo16.a, foo16.b, foo16.c, foo16.d);
}

static void passFoo32(Foo32 foo32) {
    printf("a: %d b: %d c: %d d: %d e: %d f: %d g: %d h: %d\n", foo32.a, foo32.b, foo32.c, foo32.d, foo32.e, foo32.f, foo32.g, foo32.h);
}

static float getFloat(float a) {
    return a;
}

static double getDouble(double a) {
    return a;
}

static void printFloat(float f) {
    printf("f is %f\n", f);
}

static void printDouble(double f) {
    printf("f is %lf\n", f);
}

static void passFloats(float a, float b, float c) {
    printf("a: %f, b: %f, c: %f\n", a, b, c);
}

static void passDoubles(double a, double b, double c) {
    printf("a: %lf, b: %lf, c: %lf\n", a, b, c);
}

static float floatA = 1.1, floatB = 2.2, floatC = 3.3;
static float doubleA = 11.11, doubleB = 22.22, doubleC = 33.33;

static void passThem() {
    passFloats(floatA, floatB, floatC);
    passDoubles(doubleA, doubleB, doubleC);
}

static float
getOneFloat() {
    return 99.42;
}

static void passStructs() {
    Foo4 foo4 = getFoo4();
    Foo8 foo8 = getFoo8();
    Foo16 foo16 = getFoo16();
    Foo32 foo32 = getFoo32();
    passFoo4(foo4);
    passFoo8(foo8);
    passFoo16(foo16);
    passFoo32(foo32);
}

void main() {
    getFloat(1.5);
    getFloat(-1.5);
    getFloat(100.75);
    getDouble(1.99);
    passStructs();
}
    

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.