lib.h (3231B)
1 /* -*-comment-start: "//";comment-end:""-*- 2 * GNU Mes --- Maxwell Equations of Software 3 * Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> 4 * Copyright © 2023 Timothy Sample <samplet@ngyro.com> 5 * 6 * This file is part of GNU Mes. 7 * 8 * GNU Mes is free software; you can redistribute it and/or modify it 9 * under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 3 of the License, or (at 11 * your option) any later version. 12 * 13 * GNU Mes is distributed in the hope that it will be useful, but 14 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 22 #ifndef __MES_LIB_H 23 #define __MES_LIB_H 24 25 #include <mes/lib-mini.h> 26 #include <mes/lib-cc.h> 27 28 #define __FILEDES_MAX 4096 29 extern char *__brk; 30 31 char *cast_intp_to_charp (int const *i); 32 char *cast_long_to_charp (long i); 33 long cast_charp_to_long (char const *); 34 long cast_int_to_long (int i); 35 long cast_voidp_to_long (void const *); 36 37 int __mes_debug (); 38 void __ungetc_init (); 39 void __ungetc_clear (int filedes); 40 void __ungetc_set (int filedes, int c); 41 int __ungetc_p (int filedes); 42 long abtol (char const **p, int base); 43 char *itoa (int number); 44 char *ltoa (long number); 45 char *ltoab (long x, int base); 46 char *ntoab (long number, unsigned base, int signed_p); 47 char *utoa (unsigned number); 48 int eputc (int c); 49 int fdgetc (int fd); 50 char * fdgets (char *s, int count, int fd); 51 int fdputc (int c, int fd); 52 int fdputs (char const *s, int fd); 53 int fdungetc (int c, int fd); 54 char *_getcwd (char *buffer, size_t size); 55 int ioctl3 (int filedes, size_t command, long data); 56 int isnumber (int c, int base); 57 int mes_open (char const *file_name, int flags, int mask); 58 int _open2 (char const *file_name, int flags); 59 int _open3 (char const *file_name, int flags, int mask); 60 int oputc (int c); 61 int oputs (char const *s); 62 char *search_path (char const *file_name); 63 ssize_t _read (int fd, void *buffer, size_t size); 64 void assert_msg (int check, char *msg); 65 66 long __mesabi_imod (long a, long b); 67 long __mesabi_idiv (long a, long b); 68 void *__memcpy (void *dest, void const *src, size_t n); 69 void *__memmove (void *dest, void const *src, size_t n); 70 void *__memset (void *s, int c, size_t n); 71 72 #if !SYSTEM_LIBC 73 void __assert_fail (char const *s, char const *file, unsigned line, 74 char const *function); 75 ssize_t __buffered_read (int filedes, void *buffer, size_t size); 76 size_t __buffered_read_clear (int filedes); 77 long brk (void *addr); 78 #ifndef __raise 79 int __raise (int signal); 80 #endif 81 #endif // !SYSTEM_LIBC 82 83 #if !__M2__ 84 double abtod (char const **p, int base); 85 char *dtoab (double number, int base, int signed_p); 86 char *ultoa (unsigned long number); 87 unsigned long __mesabi_umod (unsigned long a, unsigned long b); 88 unsigned long __mesabi_udiv (unsigned long a, unsigned long b); 89 unsigned long __mesabi_uldiv (unsigned long a, unsigned long b, 90 unsigned long *remainder); 91 #endif 92 93 #endif //__MES_LIB_H