/* cpjit.C -- c portable jit in time compiler Copyright (C) 2005 Marc Lehmann This file is part of libcpjit. libcpjit is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with gvpe; if not, write to the Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "config.h" #include "cpjit.h" #include #include #define STR_(str) #str #define STR(str) STR_(str) namespace cpjit { const char typestr::str[] = "unsigned " STR(TYPE_INT8); const char typestr::str[] = "unsigned " STR(TYPE_INT16); const char typestr::str[] = "unsigned " STR(TYPE_INT32); const char typestr::str[] = "unsigned " STR(TYPE_INT64); const char typestr::str[] = " signed " STR(TYPE_INT8); const char typestr::str[] = " signed " STR(TYPE_INT16); const char typestr::str[] = " signed " STR(TYPE_INT32); const char typestr::str[] = " signed " STR(TYPE_INT64); const char typestr::str[] = "float"; const char typestr::str[] = "double"; const char typestr::str[] = "unsigned " STR(TYPE_INT8) " *"; const char typestr::str[] = "unsigned " STR(TYPE_INT16) " *"; const char typestr::str[] = "unsigned " STR(TYPE_INT32) " *"; const char typestr::str[] = "unsigned " STR(TYPE_INT64) " *"; const char typestr::str[] = " signed " STR(TYPE_INT8) " *"; const char typestr::str[] = " signed " STR(TYPE_INT16) " *"; const char typestr::str[] = " signed " STR(TYPE_INT32) " *"; const char typestr::str[] = " signed " STR(TYPE_INT64) " *"; const char typestr::str[] = "float" " *"; const char typestr::str[] = "double" " *"; fun::fun (env &e, const idstr &id) : e(e), id(id) { } funbuild::funbuild (env &e, const idstr &id, const char *rettype, ...) : e(e), id(id) { *this << rettype << " NAMExxxx ("; va_list ap; va_start (ap, rettype); int args = 0; while ((rettype = va_arg (ap, const char *))) { if (args++) *this << ", "; *this << rettype << " a" << args; } va_end (ap); *this << ")\n{\n"; } void funbuild::finish () { *this << "\n}\n"; } }