Added a section on all of the wonderful Makefile variables used to locate
[oota-llvm.git] / runtime / libdummy / dummylib.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <time.h>
4 #include <stdarg.h>
5 #include <sys/time.h>
6 #include <sys/types.h>
7 #include <sys/stat.h>
8 #include <unistd.h>
9
10 #if 0
11 int stat(const char *file_name, struct stat *buf) { return 0; }
12 int fstat(int filedes, struct stat *buf) { return 0; }
13 int lstat(const char *file_name, struct stat *buf) { return 0; }
14
15 // Varargs function definitions
16 int ioctl(int d, int request, ...) {return 0; }
17 int printf(const char *X) {return 0; }
18 int sscanf(const char *X, const char *Y, ...) { return 0; }
19 int fprintf(FILE *stream, const char *format, ...) { return 0; }
20
21
22 int gettimeofday(struct timeval *tv, void *tz) { return 0; }
23 void *xmalloc(size_t X) { return malloc(X); }
24   
25 void srand(unsigned x) {}
26 double exp(double x) { return 0; }
27 double log(double x) { return 0; }
28 double sqrt(double x) { return 0; }
29 void exit(int x) {}
30 int puts(const char *x) { return 0; }
31 void __main() {}
32 int atoi(const char*x) { return 1; }
33 char *fgets(char*Ptr, int x, FILE*F) { return Ptr; }
34 char *gets(char *C) { return C; }
35 int fclose(FILE*F) { return 0; }
36 FILE *fopen(const char *n, const char*x) { return malloc(sizeof(FILE)); }
37 FILE *freopen(const char *path, const char *mode, FILE *stream) { return 0; }
38 int fflush(FILE *F) { return 0; }
39 size_t fwrite(const void* str, size_t N, size_t n, FILE *F) { return N; }
40 void *memset(void *P, int X, size_t N) { return P; }
41 void *memcpy(void *P, void *S, size_t N) { return P; }
42 void *memmove(void *P, void *S, size_t N) { return P; }
43 char *strcpy(char*Str1, const char *Str) { return Str1; }
44 char *strcat(char*Str1, const char *Str) { return Str1; }
45 size_t strlen(char *X) { return 0; }
46 #undef putchar
47 int putchar(int N) { return N; }
48 int putc(int c, FILE *stream) { return c; }
49 int fputc(int c, FILE *stream) { return c; }
50 int fgetc(FILE *S) { return 0; }
51 long ftell(FILE *F) { return 0; }
52 int getc(FILE *S) { return 0; }
53 size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream) { return 0; }
54 int fseek(FILE *stream, long offset, int whence) { return 0; }
55 int feof(FILE *stream) { return 0; }
56 int fputs(const char *s, char *stream) { return 0; }
57 int ferror(FILE *F) { return 0; }
58 FILE *fdopen(int fildes, const char *mode) { return 0;}
59 FILE *popen(const char *command, const char *type) { return 0; }
60 int pclose(FILE *stream) { return 0; }
61  
62 int ungetc(int c, FILE *stream) { return 0; }
63 int setvbuf(FILE *stream, char *buf, int mode , size_t size) { return 0; }
64 void rewind(FILE*F) { }
65 int fileno(FILE *stream) { return 1; }
66 char *ttyname(int desc) { return 0; }
67 long sysconf(int name) { return 0; }
68 char *tmpnam(char *s) { return s; }
69
70 void *calloc(size_t A, size_t B) { return malloc(A*B); }
71 void *realloc(void *ptr, size_t N) { return ptr; } 
72 const char *strerror(int N) { return 0; }
73 int unlink(const char *path) { return 0; }
74 void perror(const char *err) {}
75 char *strrchr(const char *S, int C) { return (char*)S; }
76 int memcmp(const char *A, const char *B, size_t N) { return 0; }
77 ssize_t read(int fildes, void *buf, size_t nbyte) { return nbyte; }
78 int close(int FD) { return 0; }
79 int rename(const char *oldpath, const char *newpath) { return 0; }
80 ssize_t write(int fd, const void *buf, size_t count) { return 0; }
81 pid_t getpid(void) { return 0; }
82 pid_t getppid(void) { return 0; }
83 void setbuf(FILE *stream, char *buf) {}
84 int isatty(int desc) { return 0; }
85 int vsprintf(char *str, const char *format, va_list ap) { return 0; }
86 char *getcwd(char *buf, size_t size) { return buf; }
87
88 void qsort(void *base, size_t nmemb, size_t size,
89            int(*compar)(const void *, const void *)) {
90   compar(base, base);
91 }
92
93
94
95 #include <sys/times.h>
96 clock_t times(struct tms *buf) { return 0; }
97
98
99 #include <setjmp.h>
100 int setjmp(jmp_buf env) { return 0; }
101 void longjmp(jmp_buf env, int val) {}
102 int kill(pid_t pid, int sig) { return 0; }
103 int system(const char *string) { return 0; }
104 char *getenv(const char *name) { return 0; }
105 typedef void (*sighandler_t)(int);
106
107 sighandler_t signal(int signum, sighandler_t handler) { return handler; }
108
109
110
111
112 char *strchr(const char *s, int c) { return (char*)s; }
113 int strcmp(const char *s1, const char *s2) { return 0; }
114 int strncmp(const char *s1, const char *s2, size_t n) { return 0; }
115 char *strncpy(char *s1, const char *s2, size_t n) { return s1; }
116 char *strpbrk(const char *s, const char *accept) { return (char*)s; }
117 char *strncat(char *dest, const char *src, size_t n) { return dest; }
118
119 double atof(const char *C) { return 0; }
120
121
122 long clock() { return 0; }
123 char *ctime(const time_t *timep) { return 0; }
124 time_t time(time_t *t) { return *t = 0; }
125
126 double sin(double x) { return x; }
127 double cos(double x) { return x; }
128 double tan(double x) { return x; }
129 double asin(double x) { return x; }
130 double acos(double x) { return x; }
131 double atan(double x) { return x; }
132 double cosh(double x) { return x; }
133 double sinh(double x) { return x; }
134 double ceil(double x) { return x; }
135 double floor(double x) { return x; }
136
137 double atan2(double x, double y) { return x; }
138 double fmod(double x, double y) { return x; }
139 double pow(double x, double y) { return x; }
140
141 int tolower(int x) { return x; }
142 int toupper(int x) { return x; }
143
144 #endif