From 23d055374059bc44b6f7288762d9e6a2e8f38a9c Mon Sep 17 00:00:00 2001 From: John Baumann Date: Wed, 9 Aug 2023 23:32:12 -0500 Subject: [PATCH] Merge files, replace typedefs w/ stddef.h, etc. --- include/errno.h | 59 --------------------------------- include/fcntl.h | 25 -------------- include/file.h | 33 ------------------- include/fs.h | 4 --- include/ioctl.h | 44 ------------------------- include/kernel.h | 9 ----- include/libapi.h | 2 -- include/libgs.h | 5 +-- include/libmcx.h | 14 -------- include/libpad.h | 11 ------- include/libsnd.h | 3 -- include/malloc.h | 8 +---- include/memory.h | 9 ----- include/qsort.h | 9 +---- include/stddef.h | 50 ---------------------------- include/stdio.h | 5 --- include/strings.h | 9 ----- include/sys/ioctl.h | 6 +--- include/sys/types.h | 5 --- include/types.h | 80 --------------------------------------------- 20 files changed, 4 insertions(+), 386 deletions(-) delete mode 100644 include/errno.h delete mode 100644 include/fcntl.h delete mode 100644 include/file.h delete mode 100644 include/ioctl.h delete mode 100644 include/stddef.h delete mode 100644 include/types.h diff --git a/include/errno.h b/include/errno.h deleted file mode 100644 index be0c751..0000000 --- a/include/errno.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Error codes - * $RCSfile: errno.h,v $ - * $Id: errno.h,v 1.3 1995/02/28 10:02:53 yoshi Exp $ - */ -/* - * $PSLibId: Run-time Library Release 4.7$ - */ - -#ifndef _ERRNO_H -#define _ERRNO_H - -/* Error codes */ - -#define EPERM 1 /* Not owner */ -#define ENOENT 2 /* No such file or directory */ -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted system call */ -#define EIO 5 /* I/O error */ -#define ENXIO 6 /* No such device or address */ -#define E2BIG 7 /* Arg list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file number */ -#define ECHILD 10 /* No children */ -#define EAGAIN 11 /* No more processes */ -#define ENOMEM 12 /* Not enough core */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ -#define ENOTBLK 15 /* Block device required */ -#define EBUSY 16 /* Mount device busy */ -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Cross-device link */ -#define ENODEV 19 /* No such device */ -#define ENOTDIR 20 /* Not a directory*/ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* File table overflow */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Not a typewriter */ -#define ETXTBSY 26 /* Text file busy */ -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Illegal seek */ -#define EROFS 30 /* Read-only file system */ -#define EFORMAT 31 /* Bad file format */ -#define EPIPE 32 /* Broken pipe */ - -/* math software */ -#define EDOM 33 /* Argument too large */ -#define ERANGE 34 /* Result too large */ - -/* non-blocking and interrupt i/o */ -#define EWOULDBLOCK 35 /* Operation would block */ -#define EINPROGRESS 36 /* Operation now in progress */ -#define EALREADY 37 /* Operation already in progress */ - -extern int errno; - -#endif /* _ERRNO_H */ diff --git a/include/fcntl.h b/include/fcntl.h deleted file mode 100644 index b963ce3..0000000 --- a/include/fcntl.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * File:fcntl.h - */ -/* - * $PSLibId: Run-time Library Release 4.7$ - */ - -#ifndef _SYS_FCNTL_H -#define _SYS_FCNTL_H - -/* flags */ -#define FREAD 0x0001 /* readable */ -#define FWRITE 0x0002 /* writable */ -#define FNBLOCK 0x0004 /* non-blocking reads */ -#define FRLOCK 0x0010 /* read locked (non-shared) */ -#define FWLOCK 0x0020 /* write locked (non-shared) */ -#define FAPPEND 0x0100 /* append on each write */ -#define FCREAT 0x0200 /* create if nonexistant */ -#define FTRUNC 0x0400 /* truncate to zero length */ -#define FSCAN 0x1000 /* scan type */ -#define FRCOM 0x2000 /* remote command entry */ -#define FNBUF 0x4000 /* no ring buf. and console interrupt */ -#define FASYNC 0x8000 /* asyncronous i/o */ - -#endif /* _SYS_FCNTL_H */ diff --git a/include/file.h b/include/file.h deleted file mode 100644 index 0db9e08..0000000 --- a/include/file.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * File:file.h -*/ -/* - * $PSLibId: Run-time Library Release 4.7$ - */ - -#ifndef _SYS_FILE_H -#define _SYS_FILE_H - -#include - -/* Flag for open() */ -#define O_RDONLY FREAD -#define O_WRONLY FWRITE -#define O_RDWR FREAD|FWRITE -#define O_CREAT FCREAT /* open with file create */ -#define O_NOBUF FNBUF /* no device buffer and console interrupt */ -#define O_NBLOCK FNBLOCK /* non blocking mode */ -#define O_NOWAIT FASYNC /* asyncronous i/o */ - -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif -#ifndef SEEK_CUR -#define SEEK_CUR 1 -#endif -#ifndef SEEK_END -#define SEEK_END 2 -#endif - -#endif /* _SYS_FILE_H */ - diff --git a/include/fs.h b/include/fs.h index ff7e953..b19a4bc 100644 --- a/include/fs.h +++ b/include/fs.h @@ -83,10 +83,6 @@ struct iob { }; #endif /* LANGUAGE_C */ -#ifndef NULL -#define NULL 0 -#endif - /* Request codes */ #define READ 1 #define WRITE 2 diff --git a/include/ioctl.h b/include/ioctl.h deleted file mode 100644 index bcec335..0000000 --- a/include/ioctl.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * File:ioctl.h - */ -/* - * $PSLibId: Run-time Library Release 4.7$ - */ - -#ifndef _SYS_IOCTL_H -#define _SYS_IOCTL_H - - -#ifndef NULL -#define NULL 0 -#endif - -#ifndef EOF -#define EOF (-1) /* EOF from getc() */ -#endif - -/* general */ -#define FIOCNBLOCK (('f'<<8)|1) /* set non-blocking io */ -#define FIOCSCAN (('f'<<8)|2) /* scan for input */ - -/* tty and sio */ -#define TIOCRAW (('t'<<8)|1) /* disable xon/xoff control */ -#define TIOCFLUSH (('t'<<8)|2) /* flush input buffer */ -#define TIOCREOPEN (('t'<<8)|3) /* reopen */ -#define TIOCBAUD (('t'<<8)|4) /* set baud rate */ -#define TIOCEXIT (('t'<<8)|5) /* console interrup */ -#define TIOCDTR (('t'<<8)|6) /* control DTR line */ -#define TIOCRTS (('t'<<8)|7) /* control RTS line */ -#define TIOCLEN (('t'<<8)|8) /* stop<<16 | char */ - /* stop 0:none 1:1 2:1.5 3:2bit */ - /* char 0:5 1:6 2:7 3:8bit */ -#define TIOCPARITY (('t'<<8)|9) /* parity 0:none 1:e 3:o */ -#define TIOSTATUS (('t'<<8)|10) /* return status */ -#define TIOERRRST (('t'<<8)|11) /* error reset */ -#define TIOEXIST (('t'<<8)|12) /* exist test with DTR/CTS */ -#define TIORLEN (('t'<<8)|13) /* receive buffer length */ - -/* disk */ -#define DIOFORMAT (('d'<<8)|1) /* format */ - -#endif /* _SYS_IOCTL_H */ diff --git a/include/kernel.h b/include/kernel.h index 1ed7aba..0b14a82 100644 --- a/include/kernel.h +++ b/include/kernel.h @@ -7,13 +7,8 @@ /* * $PSLibId: Run-time Library Release 4.7$ */ -#ifndef _R3000_H #include -#endif - -#ifndef _ASM_H #include -#endif /* don't change these macros and structures which is refereced in kernel code */ @@ -156,10 +151,6 @@ extern struct ToT SysToT[32]; extern long SysClearRCnt[]; -#ifndef NULL -#define NULL (0) -#endif - #if defined(_LANGUAGE_C)||defined(LANGUAGE_C) #define delete erase #endif /* LANGUAGE_C */ diff --git a/include/libapi.h b/include/libapi.h index 628cc3c..7264d72 100644 --- a/include/libapi.h +++ b/include/libapi.h @@ -10,9 +10,7 @@ * $PSLibId: Run-time Library Release 4.7$ */ -#ifndef _KERNEL_H #include "kernel.h" -#endif /* don't change these macros and structures which is referred in controler code */ diff --git a/include/libgs.h b/include/libgs.h index 6db4f8b..7dda74e 100644 --- a/include/libgs.h +++ b/include/libgs.h @@ -15,12 +15,9 @@ */ #include +#include #include -#ifndef NULL -#define NULL 0 -#endif - /*** packet peripheral pointer ***/ typedef unsigned char PACKET; diff --git a/include/libmcx.h b/include/libmcx.h index c70bf41..bbdd72b 100644 --- a/include/libmcx.h +++ b/include/libmcx.h @@ -12,20 +12,6 @@ /* don't change these macros and structures which is referred in mcx code */ -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef NULL -#define NULL 0 -#endif -#ifndef ERROR -#define ERROR (-1) -#endif - - #define McxFuncGetApl 1 #define McxFuncExecApl 2 #define McxFuncGetTime 3 diff --git a/include/libpad.h b/include/libpad.h index b26a243..3ee8926 100644 --- a/include/libpad.h +++ b/include/libpad.h @@ -12,17 +12,6 @@ /* don't change these macros and structures which is referred in controler code */ -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef NULL -#define NULL 0 -#endif - - #define PadStateDiscon 0 #define PadStateFindPad 1 #define PadStateFindCTP1 2 diff --git a/include/libsnd.h b/include/libsnd.h index 4afb5df..df20560 100644 --- a/include/libsnd.h +++ b/include/libsnd.h @@ -68,9 +68,6 @@ #define SND_ADDR 16 #define SND_PITCH 32 -#ifndef NULL -#define NULL 0 -#endif /* diff --git a/include/malloc.h b/include/malloc.h index 4cb73a7..6d600b8 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -7,13 +7,7 @@ #ifndef _MALLOC_H #define _MALLOC_H -#ifndef _SIZE_T -#define _SIZE_T -typedef unsigned int size_t; /* result type of the sizeof operator (ANSI) */ -#endif -#ifndef NULL -#define NULL 0 /* null pointer constant */ -#endif +#include #if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) extern "C" { diff --git a/include/memory.h b/include/memory.h index ff58946..e85a35a 100644 --- a/include/memory.h +++ b/include/memory.h @@ -9,15 +9,6 @@ #ifndef _MEMORY_H #define _MEMORY_H -#ifndef _SIZE_T -#define _SIZE_T -typedef unsigned int size_t; /* result type of the sizeof operator (ANSI) */ -#endif - -#ifndef NULL -#define NULL 0 /* null pointer constant */ -#endif - #if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) extern "C" { #endif diff --git a/include/qsort.h b/include/qsort.h index 58d4eab..fe9ce93 100644 --- a/include/qsort.h +++ b/include/qsort.h @@ -9,14 +9,7 @@ #ifndef _QSORT_H #define _QSORT_H -#ifndef _SIZE_T -#define _SIZE_T -typedef unsigned int size_t; /* result type of the sizeof operator (ANSI) */ -#endif - -#ifndef NULL -#define NULL 0 /* null pointer constant */ -#endif +#include #if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) extern "C" { diff --git a/include/stddef.h b/include/stddef.h deleted file mode 100644 index 61932d1..0000000 --- a/include/stddef.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * File:stddef.h - */ -/* - * $PSLibId: Run-time Library Release 4.7$ - */ - -#ifndef _STDDEF_H -#define _STDDEF_H - - -#ifndef _SIZE_T -#define _SIZE_T -typedef unsigned int size_t; /* result type of the sizeof operator (ANSI) */ -#endif - -#ifndef _WCHAR_T -#define _WCHAR_T -typedef unsigned long wchar_t; /* type of a wide character */ -#endif - -#ifndef _UCHAR_T -#define _UCHAR_T -typedef unsigned char u_char; -#endif - -#ifndef _USHORT_T -#define _USHORT_T -typedef unsigned short u_short; -#endif - -#ifndef _UINT_T -#define _UINT_T -typedef unsigned int u_int; -#endif - -#ifndef _ULONG_T -#define _ULONG_T -typedef unsigned long u_long; -#endif - -#ifndef WEOF -#define WEOF 0xffffffff -#endif - -#ifndef NULL -#define NULL 0 /* null pointer constant */ -#endif - -#endif /* _STDDEF_H */ diff --git a/include/stdio.h b/include/stdio.h index 41c0085..0f4f036 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -21,11 +21,6 @@ #define SEEK_END 2 #endif -#ifndef _SIZE_T -#define _SIZE_T -typedef unsigned int size_t; /* result type of the sizeof operator (ANSI) */ -#endif - /* under constraction now */ #if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) diff --git a/include/strings.h b/include/strings.h index 84da8bf..8e76946 100644 --- a/include/strings.h +++ b/include/strings.h @@ -11,15 +11,6 @@ #define LMAX 256 -#ifndef NULL -#define NULL 0 /* null pointer constant */ -#endif - -#ifndef _SIZE_T -#define _SIZE_T -typedef unsigned int size_t; /* result type of the sizeof operator (ANSI) */ -#endif - #include #if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h index c9ac62d..c2b6ed7 100644 --- a/include/sys/ioctl.h +++ b/include/sys/ioctl.h @@ -2,17 +2,13 @@ * File:ioctl.h */ /* - * $PSLibId: Run-time Library Release 4.6$ + * $PSLibId: Run-time Library Release 4.7$ */ #ifndef _SYS_IOCTL_H #define _SYS_IOCTL_H -#ifndef NULL -#define NULL 0 -#endif - #ifndef EOF #define EOF (-1) /* EOF from getc() */ #endif diff --git a/include/sys/types.h b/include/sys/types.h index c3eaca6..731a109 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -64,11 +64,6 @@ typedef long * qaddr_t; /* should be typedef quad * qaddr_t; */ typedef u_long ino_t; typedef long swblk_t; -#ifndef _SIZE_T -#define _SIZE_T -typedef unsigned int size_t; -#endif - typedef long time_t; typedef short dev_t; typedef long off_t; diff --git a/include/types.h b/include/types.h deleted file mode 100644 index 5fe5a83..0000000 --- a/include/types.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * File:types.h - */ -/* - * $PSLibId: Run-time Library Release 4.7$ - */ - -#ifndef _SYS_TYPES_H -#define _SYS_TYPES_H - -/* - * Basic system types and major/minor device constructing/busting macros. - */ - -/* major part of a device */ -#define major(x) ((int)(((unsigned)(x)>>8)&0377)) - -/* minor part of a device */ -#define minor(x) ((int)((x)&0377)) - -/* make a device number */ -#define makedev(x,y) ((dev_t)(((x)<<8) | (y))) - -#ifndef _UCHAR_T -#define _UCHAR_T -typedef unsigned char u_char; -#endif -#ifndef _USHORT_T -#define _USHORT_T -typedef unsigned short u_short; -#endif -#ifndef _UINT_T -#define _UINT_T -typedef unsigned int u_int; -#endif -#ifndef _ULONG_T -#define _ULONG_T -typedef unsigned long u_long; -#endif -#ifndef _SYSIII_USHORT -#define _SYSIII_USHORT -typedef unsigned short ushort; /* sys III compat */ -#endif -#ifndef __psx__ -#ifndef _SYSV_UINT -#define _SYSV_UINT -typedef unsigned int uint; /* sys V compat */ -#endif -#ifndef _SYSV_ULONG -#define _SYSV_ULONG -typedef unsigned long ulong; /* sys V compat */ -#endif -#endif /* ! __psx__ */ - -typedef struct _physadr { int r[1]; } *physadr; -typedef struct label_t { - int val[12]; -} label_t; - -typedef struct _quad { long val[2]; } quad; -typedef long daddr_t; -typedef char * caddr_t; -typedef long * qaddr_t; /* should be typedef quad * qaddr_t; */ -typedef u_long ino_t; -typedef long swblk_t; - -#ifndef _SIZE_T -#define _SIZE_T -typedef unsigned int size_t; -#endif - -typedef long time_t; -typedef short dev_t; -typedef long off_t; -typedef u_short uid_t; -typedef u_short gid_t; - -#define NBBY 8 /* number of bits in a byte */ - -#endif /* _SYS_TYPES_H */