
9 changed files with 236 additions and 0 deletions
@ -0,0 +1,10 @@ |
|||
.PHONY: all clean |
|||
|
|||
all: |
|||
$(MAKE) -C synth_shed |
|||
$(MAKE) -C test_data |
|||
|
|||
clean: |
|||
$(MAKE) -C synth_shed clean |
|||
$(MAKE) -C test_data clean |
|||
|
@ -0,0 +1,25 @@ |
|||
TARGET=test_lib |
|||
|
|||
SRCS+=$(wildcard *.c) |
|||
CFLAGS+=-std=c99 -g |
|||
INCLUDES+= |
|||
LIB_DIRS+= |
|||
LIBS+= |
|||
LDFLAGS+= |
|||
|
|||
|
|||
CXXFLAGS+=$(INCLUDES) |
|||
LDFLAGS+=$(LIB_DIRS+) |
|||
LDFLAGS+=$(LIBS) |
|||
OBJS+=$(SRCS:.c=.o) |
|||
|
|||
.PHONY: all, clean |
|||
|
|||
all: $(TARGET) |
|||
|
|||
$(TARGET) : $(OBJS) |
|||
$(CC) $(LDFLAGS) -o $@ $^ |
|||
|
|||
clean: |
|||
rm -f $(TARGET) |
|||
rm -f $(OBJS) |
@ -0,0 +1,18 @@ |
|||
#ifndef ENUMS_H |
|||
#define ENUMS_H |
|||
|
|||
// typedeffed enum
|
|||
typedef enum _keys { |
|||
PIANO, |
|||
RHODES, |
|||
HAMMOND |
|||
} numbers; |
|||
|
|||
// untypedeffed enum
|
|||
enum _drums { |
|||
KICK, |
|||
SNARE, |
|||
TOM |
|||
}; |
|||
|
|||
#endif //ENUMS_H
|
@ -0,0 +1,70 @@ |
|||
#ifndef FUNCTIONS_H |
|||
#define FUNCTIONS_H |
|||
|
|||
#include "typedefs.h" |
|||
#include "structs.h" |
|||
#include "enums.h" |
|||
|
|||
// ret: void
|
|||
// arg: void
|
|||
void nada(); |
|||
|
|||
// ret: void
|
|||
// arg: primitive
|
|||
void func1(int a); |
|||
|
|||
// ret: primitive
|
|||
// arg: primitive
|
|||
int func2(int a); |
|||
|
|||
// ret: aliased primitive
|
|||
// arg: aliased primitive
|
|||
C func3(B a); |
|||
|
|||
// ret: primitive_struct
|
|||
// arg: primitive
|
|||
primitive_struct func4(int x); |
|||
|
|||
// ret: primitive
|
|||
// arg: primitive_struct
|
|||
int func5(primitive_struct a); |
|||
|
|||
// ret: primitive_struct
|
|||
// arg: primitive_struct
|
|||
primitive_struct func6(primitive_struct a); |
|||
|
|||
// ret: complex_struct1
|
|||
// arg: primitive
|
|||
complex_struct1 func7(int a); |
|||
|
|||
// ret: int
|
|||
// arg: complex_struct1
|
|||
int func8(complex_struct1 a); |
|||
|
|||
// ret: struct _complex_struct2
|
|||
// arg: int
|
|||
struct _complex_struct2 func9(int a); |
|||
|
|||
// ret: int
|
|||
// arg: struct _complex_struct2
|
|||
int func10(struct _complex_struct2 a); |
|||
|
|||
// nested structs
|
|||
// ret: int
|
|||
// arg: host_struct
|
|||
int func11(host_struct a); |
|||
|
|||
// nested structs
|
|||
// ret: int
|
|||
// arg: host_struct
|
|||
host_struct func12(int a); |
|||
|
|||
|
|||
//void ret , incomplete type arg
|
|||
// ret: void
|
|||
// arg: struct _incomplete_struct
|
|||
void func99(struct _incomplete_struct a); |
|||
|
|||
|
|||
|
|||
#endif //FUNCTIONS_H
|
@ -0,0 +1,8 @@ |
|||
#include "test_lib.h" |
|||
#include <stdio.h> |
|||
|
|||
|
|||
int main() { |
|||
return 0; |
|||
} |
|||
|
@ -0,0 +1,58 @@ |
|||
#ifndef STRUCTS_H |
|||
#define STRUCTS_H |
|||
|
|||
// incomplete type
|
|||
// type: _incomplete_struct
|
|||
struct _incomplete_struct; |
|||
|
|||
// an empty struct
|
|||
// type: _empty_struct
|
|||
struct _empty_struct { |
|||
}; |
|||
|
|||
// a struct withouth typdef
|
|||
// type: struct _untypedeffed_struct
|
|||
struct _untypedeffed_struct { |
|||
int x; |
|||
int y; |
|||
}; |
|||
|
|||
// a struct containing primititve fields only
|
|||
// type: primitive_struct
|
|||
typedef struct _primitive_struct { |
|||
int x; |
|||
float y; |
|||
const char* str; |
|||
char one; |
|||
} primitive_struct; |
|||
|
|||
// a struct that has one typeref
|
|||
// type: complex_struct1
|
|||
typedef struct _complex_struct1 { |
|||
int x; |
|||
primitive_struct p; |
|||
} complex_struct1; |
|||
|
|||
// struct containing typeref to complex_struct1 struct
|
|||
// type: _complex_struct2
|
|||
struct _complex_struct2 { |
|||
primitive_struct *p; |
|||
complex_struct1 *c; |
|||
}; |
|||
|
|||
// nested structs, semantic parent is global
|
|||
// type: host2
|
|||
typedef struct _host_struct { |
|||
int x; |
|||
int y; |
|||
// type: _nested_struct
|
|||
struct _nested_struct { |
|||
int x; |
|||
int y; |
|||
} nested1; |
|||
} host_struct; |
|||
|
|||
typedef struct _nested_struct nested_struct; |
|||
|
|||
#endif //STRUCTS_H
|
|||
|
@ -0,0 +1,2 @@ |
|||
#include "test_lib.h" |
|||
|
@ -0,0 +1,9 @@ |
|||
#ifndef MAIN_INCLUDE_H |
|||
#define MAIN_INCLUDE_H |
|||
|
|||
#include "typedefs.h" |
|||
#include "enums.h" |
|||
#include "structs.h" |
|||
#include "functions.h" |
|||
|
|||
#endif //MAIN_INCLUDE_H
|
@ -0,0 +1,36 @@ |
|||
#ifndef TYPEDEFS_H |
|||
#define TYPEDEFS_H |
|||
|
|||
// recursive typdefs resolving to primitive_struct data type
|
|||
// Type A,B,C are int
|
|||
typedef int A; |
|||
typedef A B; |
|||
typedef B C; |
|||
|
|||
|
|||
// recursive typdefs resolving to struct
|
|||
// AS,BS,CS : aliased_struct
|
|||
typedef struct _aliased_struct { |
|||
int x; |
|||
} aliased_struct; |
|||
typedef aliased_struct AS; |
|||
typedef AS BS; |
|||
typedef BS CS; |
|||
|
|||
|
|||
// recursive typdefs resolving to an enum
|
|||
// AE,BE,CE : aliased_enum
|
|||
typedef enum _aliased_enum { |
|||
ONE, |
|||
TWO |
|||
} aliased_enum; |
|||
typedef aliased_enum AE; |
|||
typedef AE BE; |
|||
typedef BE CE; |
|||
|
|||
// typedef of incomplete type
|
|||
typedef struct _incomplete_struct incomplete; |
|||
|
|||
|
|||
#endif //TYPEDEFS_H
|
|||
|
Loading…
Reference in new issue