2 visor - lightweight system-independent embeddable text editor framework
3 Copyright (C) 2019 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>.
21 /* XXX let's pretend we don't have a libc to test our own code
22 #ifdef __STDC_HOSTED__
35 int atoi(const char *str);
36 long atol(const char *str);
37 long strtol(const char *str, char **endp, int base);
39 void *memset(void *s, int c, unsigned long n);
40 void *memcpy(void *dest, const void *src, unsigned long n);
41 void *memmove(void *dest, const void *src, unsigned long n);
42 unsigned long strlen(const char *s);
43 char *strchr(const char *s, int c);
44 int strcmp(const char *s1, const char *s2);
45 char *strcpy(char *dest, const char *src);
48 typedef __builtin_va_list va_list;
49 #define va_start(v,l) __builtin_va_start(v,l)
50 #define va_end(v) __builtin_va_end(v)
51 #define va_arg(v,l) __builtin_va_arg(v,l)
52 #else /* !def __GNUC__ */
53 #error "stdargs implementation for this compiler missing (libvisor/src/vilibc.h)"
56 int sprintf(char *buf, const char *fmt, ...);
57 int vsprintf(char *buf, const char *fmt, va_list ap);
58 int snprintf(char *buf, unsigned long sz, const char *fmt, ...);
59 int vsnprintf(char *buf, unsigned long sz, const char *fmt, va_list ap);
63 #define isascii(c) ((c) < 128)
74 #endif /* !HAVE_LIBC */
77 void vi_error(struct visor *vi, const char *fmt, ...);
79 #endif /* VISOR_LIBC_H_ */