/* A small C header, for testing the importer against something that does not * move. The raylib case needs raylib installed, needs the right version of it, * and needs an environment variable set, so it is the wrong thing to hang the * refusal catalogue on: it would skip everywhere and cover nothing. This * header has one function per decision Cimport makes, and the test asserts on * the reasons rather than on the count. * * Deliberately includes nothing. A header that pulls in stdio would make the * dump thirty times larger and would put libc's declarations in the way of * reading the test's. */ typedef struct Pair { float x; float y; } Pair; typedef struct Shade { unsigned char r, g, b, a; } Shade; typedef struct Undescribed { int a; int b; } Undescribed; /* A second typedef name for a record the package already describes under * another one. raylib does this: struct Texture is Texture2D and also * TextureCubemap. Both have to resolve to the one defstruct. */ typedef struct Pair Point; typedef enum Mood { MOOD_CALM = 0, MOOD_CROSS = 1 } Mood; typedef void (*Notify)(void *user, unsigned int n); /* --- accepted --- */ void set_seed(unsigned int seed); int add_ints(int a, int b); Pair make_pair(float x, float y); /* aggregate out, by out-pointer */ float pair_len(Pair p); /* aggregate in, by pointer */ Shade tint(Shade base, Shade over); int name_length(const char *text); /* const char * is a string in */ int count_at(const int *values, int n); /* T * is (Ptr T) */ Pair point_of(Point p); /* the second typedef name */ int mood_value(Mood m); /* a C enum is an int */ void take_nothing(void); /* --- refused, one per reason --- */ const char *name_of(int which); /* returns char * */ void fill_buffer(char *out, int cap); /* non-const char *: C writes it */ int printf_like(const char *fmt, ...); /* variadic */ void on_event(Notify cb); /* a callback */ long file_time(const char *path); /* long varies across our targets */ Undescribed make_undescribed(void); /* no defstruct for it */ /* Two names that kebab to one, so the collision is refused by name rather than * arriving at the checker as a duplicate declaration nobody wrote. */ int Spin2D(int n); int spin2d(int n);