/* Plan 9 from User Space include/u.h http://code.swtch.com/plan9port/src/tip/include/u.h Copyright 2001-2007 Russ Cox. All Rights Reserved. Portions Copyright (c) 2010 Corpus Callosum Corporation. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Microchip dsPIC33F includes */ #include #include #include #include #include #include #include #include /* for tolower */ /* * OS-specific crap */ #define _NEEDUCHAR 1 #define _NEEDUSHORT 1 #define _NEEDUINT 1 #define _NEEDULONG 1 /* Plan 9 support */ #define nil ((void*)0) typedef signed char schar; /* Missing types for dsPIC33F */ /* dsPIC33F requirements: 16bit as it is */ typedef int __attribute__((__mode__(QI))) int8_t; typedef int __attribute__((__mode__(HI))) int16_t; typedef int __attribute__((__mode__(SI))) int32_t; typedef long long __attribute__((__mode__(DI))) int64_t; typedef unsigned int __attribute__((__mode__(QI))) uint8_t; typedef unsigned int __attribute__((__mode__(HI))) uint16_t; typedef unsigned int __attribute__((__mode__(SI))) uint32_t; typedef unsigned long long __attribute__((__mode__(DI))) uint64_t; typedef float __attribute__((__mode__(SF))) double32_t; typedef long double __attribute__((__mode__(DF))) double64_t; typedef int intptr_t; typedef unsigned int uintptr_t; typedef uint64_t u64int; typedef int64_t s64int; typedef uint8_t u8int; typedef int8_t s8int; typedef uint16_t u16int; typedef int16_t s16int; typedef uintptr_t uintptr; typedef intptr_t intptr; typedef uint32_t u32int; typedef int32_t s32int; typedef double32_t s32double; typedef double64_t s64double; typedef s8int int8; typedef u8int uint8; typedef s16int int16; typedef u16int uint16; typedef s32int int32; typedef u32int uint32; typedef s64int int64; typedef u64int uint64; typedef s32double double32; typedef s64double double64; typedef uintptr_t usize; #ifdef _NEEDUCHAR typedef unsigned char uchar; #endif #ifdef _NEEDUSHORT typedef unsigned short ushort; #endif #ifdef _NEEDUINT typedef uint16_t uint; #endif #ifdef _NEEDULONG typedef uint32_t ulong; #endif typedef uint64_t uvlong; typedef int64_t vlong; typedef unsigned int size_t; /* FCR */ /* typedef union FPdbleword FPdbleword; #define FPINEX (1<<5) #define FPUNFL ((1<<4)|(1<<1)) #define FPOVFL (1<<3) #define FPZDIV (1<<2) #define FPINVAL (1<<0) #define FPRNR (0<<10) #define FPRZ (3<<10) #define FPRPINF (2<<10) #define FPRNINF (1<<10) #define FPRMASK (3<<10) #define FPPEXT (3<<8) #define FPPSGL (0<<8) #define FPPDBL (2<<8) #define FPPMASK (3<<8) */ /* FSR */ /* #define FPAINEX FPINEX #define FPAOVFL FPOVFL #define FPAUNFL FPUNFL #define FPAZDIV FPZDIV #define FPAINVAL FPINVAL union FPdbleword { double x; struct { // little endian ulong lo; ulong hi; }; }; */ /* stdarg */ // typedef char* va_list; /* #define va_start(list, start) list =\ (sizeof(start) < 4?\ (char*)((int*)&(start)+1):\ (char*)(&(start)+1)) #define va_end(list)\ USED(list) #define va_arg(list, mode)\ ((sizeof(mode) == 1)?\ ((list += 4), (mode*)list)[-1]:\ (sizeof(mode) == 2)?\ ((list += 4), (mode*)list)[-1]:\ ((list += sizeof(mode)), (mode*)list)[-1]) */