wrappers.h (3121B)
1 // $Id$ --*- c++ -*-- 2 3 // Copyright (C) 2003,2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> 4 // 5 // This program is free software; you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation; version 2 of the License. 8 // 9 // This program is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with this program; if not, write to the Free Software 16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 18 19 #ifndef H_UTIL_VSERVER_SRC_WRAPPERS_H 20 #define H_UTIL_VSERVER_SRC_WRAPPERS_H 21 22 #define WRAPPER_DECL UNUSED ALWAYSINLINE 23 #define H_ENSC_IN_WRAPPERS_H 1 24 25 #include "wrappers_handler.hc" 26 27 #define ENSC_DOQUOTE_COND(PTR, VAL, LEN, DO_QUOTE) \ 28 if (DO_QUOTE) *PTR++ = '"'; \ 29 memcpy(PTR, VAL, LEN); PTR += LEN; \ 30 if (DO_QUOTE) *PTR++ = '"' \ 31 32 #define ENSC_DETAIL1(RES,FUNC,VAL,DO_QUOTE) \ 33 size_t l_ = strlen(VAL); \ 34 char RES[l_ + sizeof(FUNC "(\"\")")]; \ 35 char * ptr_ = RES; \ 36 memcpy(ptr_, FUNC "(", sizeof(FUNC)); ptr_ += sizeof(FUNC); \ 37 ENSC_DOQUOTE_COND(ptr_, VAL, l_, DO_QUOTE); \ 38 *ptr_++ = ')'; \ 39 *ptr_ = '\0'; 40 41 #define ENSC_DETAIL2(RES,FUNC, VAL0,VAL1, DO_QUOTE0,DO_QUOTE1) \ 42 size_t l0_ = strlen(VAL0); \ 43 size_t l1_ = strlen(VAL1); \ 44 char RES[l0_ + l1_ + sizeof(FUNC "('','')")]; \ 45 char * ptr_ = RES; \ 46 memcpy(ptr_, FUNC "(", sizeof(FUNC)); ptr_ += sizeof(FUNC); \ 47 ENSC_DOQUOTE_COND(ptr_, VAL0, l0_, DO_QUOTE0); \ 48 *ptr_++ = ','; \ 49 ENSC_DOQUOTE_COND(ptr_, VAL1, l1_, DO_QUOTE1); \ 50 *ptr_++ = ')'; \ 51 *ptr_ = '\0'; 52 53 54 #ifdef ENSC_WRAPPERS_UNISTD 55 # include "wrappers-unistd.hc" 56 #endif 57 58 #ifdef ENSC_WRAPPERS_FCNTL 59 # include "wrappers-fcntl.hc" 60 #endif 61 62 #ifdef ENSC_WRAPPERS_MOUNT 63 # include "wrappers-mount.hc" 64 #endif 65 66 #ifdef ENSC_WRAPPERS_RESOURCE 67 # include "wrappers-resource.hc" 68 #endif 69 70 #ifdef ENSC_WRAPPERS_IOCTL 71 # include "wrappers-ioctl.hc" 72 #endif 73 74 #ifdef ENSC_WRAPPERS_WAIT 75 # include "wrappers-wait.hc" 76 #endif 77 78 #ifdef ENSC_WRAPPERS_VSERVER 79 # include "wrappers-vserver.hc" 80 #endif 81 82 #ifdef ENSC_WRAPPERS_IO 83 # include "wrappers-io.hc" 84 #endif 85 86 #ifdef ENSC_WRAPPERS_IOSOCK 87 # include "wrappers-iosock.hc" 88 #endif 89 90 #ifdef ENSC_WRAPPERS_DIRENT 91 # include "wrappers-dirent.hc" 92 #endif 93 94 #ifdef ENSC_WRAPPERS_CLONE 95 # include "wrappers-clone.hc" 96 #endif 97 98 #ifdef ENSC_WRAPPERS_STDLIB 99 # include "wrappers-stdlib.hc" 100 #endif 101 102 #ifdef ENSC_WRAPPERS_STRING 103 # include "wrappers-string.hc" 104 #endif 105 106 #ifdef ENSC_WRAPPERS_SOCKET 107 # include "wrappers-socket.hc" 108 #endif 109 110 #ifdef ENSC_WRAPPERS_STAT 111 # include "wrappers-stat.hc" 112 #endif 113 114 #ifdef ENSC_WRAPPERS_TERMIOS 115 # include "wrappers-termios.hc" 116 #endif 117 118 #undef ENSC_DETAIL2 119 #undef ENSC_DETAIL1 120 #undef ENSC_DOQUOTE_COND 121 #undef H_ENSC_IN_WRAPPERS_H 122 #undef WRAPPER_DECL 123 124 #endif // H_UTIL_VSERVER_SRC_WRAPPERS_H