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__
36 int atoi(const char *str);
37 long atol(const char *str);
38 long strtol(const char *str, char **endp, int base);
40 void *memset(void *s, int c, unsigned long n);
41 void *memcpy(void *dest, const void *src, unsigned long n);
42 void *memmove(void *dest, const void *src, unsigned long n);
43 unsigned long strlen(const char *s);
44 char *strchr(const char *s, int c);
45 int strcmp(const char *s1, const char *s2);
46 char *strcpy(char *dest, const char *src);
49 typedef __builtin_va_list va_list;
50 #define va_start(v,l) __builtin_va_start(v,l)
51 #define va_end(v) __builtin_va_end(v)
52 #define va_arg(v,l) __builtin_va_arg(v,l)
53 #else /* !def __GNUC__ */
54 #error "stdargs implementation for this compiler missing (libvisor/src/vilibc.h)"
57 int sprintf(char *buf, const char *fmt, ...);
58 int vsprintf(char *buf, const char *fmt, va_list ap);
59 int snprintf(char *buf, unsigned long sz, const char *fmt, ...);
60 int vsnprintf(char *buf, unsigned long sz, const char *fmt, va_list ap);
64 #define isascii(c) ((c) < 128)
77 #endif /* !HAVE_LIBC */
80 void vi_error(struct visor *vi, const char *fmt, ...);
82 #endif /* VISOR_LIBC_H_ */