diff options
author | pixel <pixel> | 2003-04-13 12:44:14 +0000 |
---|---|---|
committer | pixel <pixel> | 2003-04-13 12:44:14 +0000 |
commit | 7fc9c6dfbef57331c8b5eae0943f3fe95f2e63e1 (patch) | |
tree | f25e693f7842364b0416593cf6a77d383812ce91 /includes | |
parent | ec2c97793151512f5dca3290dbd9f24a09b7ac6f (diff) |
Removing Baltisot from there
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Buffer.h | 37 | ||||
-rw-r--r-- | includes/Color.h | 10 | ||||
-rw-r--r-- | includes/Exceptions.h | 157 | ||||
-rw-r--r-- | includes/General.h | 12 | ||||
-rw-r--r-- | includes/Handle.h | 63 | ||||
-rw-r--r-- | includes/Image.h | 57 | ||||
-rw-r--r-- | includes/Input.h | 42 | ||||
-rw-r--r-- | includes/Main.h | 24 | ||||
-rw-r--r-- | includes/Output.h | 51 | ||||
-rw-r--r-- | includes/String.h | 74 | ||||
-rw-r--r-- | includes/engine.h | 16 | ||||
-rw-r--r-- | includes/generic.h | 128 | ||||
-rw-r--r-- | includes/glbase.h | 24 | ||||
-rw-r--r-- | includes/glfont.h | 25 | ||||
-rw-r--r-- | includes/gltexture.h | 26 |
15 files changed, 0 insertions, 746 deletions
diff --git a/includes/Buffer.h b/includes/Buffer.h deleted file mode 100644 index dc4d768..0000000 --- a/includes/Buffer.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __BUFFER_H__ -#define __BUFFER_H__ -#ifdef __cplusplus - -#include <zlib.h> -#include <Exceptions.h> -#include <Handle.h> - -#ifndef realloc_threshold -#define realloc_threshold 256 -#endif - -class Buffer : public Handle { - public: - Buffer(); - Buffer(const Buffer &); - virtual ~Buffer(); - virtual ssize_t write(const void *buf, size_t count) throw(GeneralException); - virtual ssize_t read(void *buf, size_t count) throw (GeneralException); - virtual bool CanRead() const; - virtual bool CanWrite() const; - virtual String GetName() const; - virtual Buffer operator=(const Buffer &); - virtual bool CanWatch() const; - virtual ssize_t GetSize() const; - char operator[](size_t) const; - char & operator[](size_t); - - private: - char * buffer, zero; - size_t realsiz, bufsiz, ptr; -}; - -#else -#error This only works with a C++ compiler -#endif -#endif diff --git a/includes/Color.h b/includes/Color.h deleted file mode 100644 index 293c55c..0000000 --- a/includes/Color.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __COLOR_H__ -#define __COLOR_H__ - -struct Color { - Color(unsigned char aR, unsigned char aG, unsigned char aB, unsigned char aA = 255) : - R(aR), G(aG), B(aB), A(aA) { } - unsigned char R, G, B, A; -}; - -#endif diff --git a/includes/Exceptions.h b/includes/Exceptions.h deleted file mode 100644 index 74ad938..0000000 --- a/includes/Exceptions.h +++ /dev/null @@ -1,157 +0,0 @@ -#ifndef __EXCEPTIONS_H__ -#define __EXCEPTIONS_H__ -#ifdef __cplusplus - -#include <stdio.h> -#include <unistd.h> -#include <stddef.h> -#include <string.h> -#include <stdlib.h> - -#define INLINE __inline__ - -class Base { - public: - static char * strdup(const char * s); - static void * malloc(ssize_t s); - static void * realloc(void * p, size_t s); - static void * calloc(size_t n, size_t s); - void * operator new(size_t s); - void * operator new(size_t s, void * p); - void operator delete(void * p); - static void free(void *& p); - static void free(char *& p); - static void free(unsigned char *& p); - static int pipe(int * p, int flag = 0); - static pid_t fork(); - static void exit(int); -}; - -class String; - -class GeneralException : public Base { - public: - GeneralException(String); - GeneralException(const GeneralException &); - ~GeneralException(); - const char * GetMsg() const; - - protected: - GeneralException(); - char * msg; - static char t[BUFSIZ]; -}; - -char * xstrdup(const char *); -void * xmalloc(size_t) throw (GeneralException); -void xfree(void *&); -void xfree(char *&); -void xfree(unsigned char *&); -void * xrealloc(void *, size_t); -int xpipe(int *, int = 0) throw (GeneralException); -pid_t xfork() throw (GeneralException); -void xexit(int) throw (GeneralException); - -INLINE char * Base::strdup(const char * s) { - return xstrdup(s); -} - -INLINE void * Base::malloc(ssize_t s) { - return xmalloc(s); -} - -INLINE void * Base::realloc(void * p, size_t s) { - return xrealloc(p, s); -} - -INLINE void * Base::calloc(size_t n, size_t s) { - return xmalloc(n * s); -} - -INLINE void * Base::operator new(size_t s) { - return xmalloc(s); -} - -INLINE void * Base::operator new(size_t s, void * p) { - return memset(p, 0, s); -} - -INLINE void Base::operator delete(void * p) { - xfree(p); -} - -INLINE void Base::free(void *& p) { - xfree(p); -} - -INLINE void Base::free(char *& p) { - xfree(p); -} - -INLINE void Base::free(unsigned char *& p) { - xfree(p); -} - -INLINE int Base::pipe(int * p, int flag) { - return xpipe(p, flag); -} - -INLINE pid_t Base::fork() { - return xfork(); -} - -INLINE void Base::exit(int status) { - xexit(status); -} - -class MemoryException : public GeneralException { - public: - MemoryException(ssize_t); -}; - -class TaskNotFound : public GeneralException { - public: - TaskNotFound(); -}; - -enum op_t { - IO_WRITE = 1, - IO_READ -}; - -class IOGeneral : public GeneralException { - public: - IOGeneral(String); - protected: - IOGeneral(); -}; - -class IOException : public IOGeneral { - public: - IOException(String, op_t, ssize_t); -}; - -class IOAgain : public IOGeneral { - public: - IOAgain(); -}; - -class TaskSwitch : public GeneralException { - public: - TaskSwitch(); -}; - -class Exit : public GeneralException { - public: - Exit(int); - int GetCode(); - private: - int code; -}; - -#include <String.h> - -#else -#error This only works with a C++ compiler -#endif -#endif diff --git a/includes/General.h b/includes/General.h deleted file mode 100644 index 2b645c9..0000000 --- a/includes/General.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __GENERAL_H__ -#define __GENERAL_H__ - -#define MAX(__a,__b) ((__a)<(__b)?(__b):(__a)) -#define MIN(__a,__b) ((__a)>(__b)?(__b):(__a)) - -#define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255) -#define BX_(x) ((x) - (((x)>>1)&0x77777777) \ - - (((x)>>2)&0x33333333) \ - - (((x)>>3)&0x11111111)) - -#endif diff --git a/includes/Handle.h b/includes/Handle.h deleted file mode 100644 index b7eed41..0000000 --- a/includes/Handle.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef __HANDLE_H__ -#define __HANDLE_H__ -#ifdef __cplusplus - -#ifdef HAVE_ZLIB -#include <zlib.h> -#endif -#include <unistd.h> -#include <iostream> -#include <String.h> -#include <Exceptions.h> - -#include <sys/types.h> -#include <time.h> - -class Handle : public Base { - public: - Handle(const Handle &); - virtual ~Handle(); - virtual ssize_t read(void *buf, size_t count) throw (GeneralException); - virtual ssize_t write(const void *buf, size_t count) throw (GeneralException); - bool IsClosed(void) const; - bool IsNonBlock(void) const; - void SetNonBlock(void); - virtual bool CanRead() const; - virtual bool CanWrite() const; - virtual bool CanSeek() const; - virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException); - virtual off_t tell() const; - virtual String GetName() const; - virtual ssize_t GetSize() const; - virtual time_t GetModif() const; - void close() throw (GeneralException); - int GetHandle(); - virtual bool CanWatch() const; - virtual void Dup(const Handle &); -#ifdef HAVE_ZLIB - virtual void SetZ(int = 9) throw (GeneralException); -#endif - protected: - Handle(int h); - int GetHandle() const; - off_t itell; - private: - ssize_t uwrite(const void *, size_t) throw (GeneralException); - ssize_t uread(void *, size_t); - int h; - bool closed, nonblock; -#ifdef HAVE_ZLIB - gzFile zfile; - int z; -#endif -}; - -Handle & operator<<(Handle &, const String &); -Handle & operator>>(Handle &, String &); - -void copy(Handle *, Handle *, ssize_t = -1); - -#else -#error This only works with a C++ compiler -#endif -#endif diff --git a/includes/Image.h b/includes/Image.h deleted file mode 100644 index 87a8ddd..0000000 --- a/includes/Image.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef __IMAGE_H__ -#define __IMAGE_H__ -#ifdef __cplusplus - -#include <Buffer.h> -#include <generic.h> -#include <Color.h> - -enum { - FORMAT_TGA_BASIC -}; - -class Image : public Buffer { - public: - Image(unsigned int, unsigned int); - virtual ~Image(); - Color GetPixel(unsigned int, unsigned int) const; - void SetPixel(unsigned int, unsigned int, Color); - bool Prepare(unsigned int = FORMAT_TGA_BASIC); - void Fill(Color = Color(0, 0, 0)); - virtual String GetName() const; - virtual bool CanWrite() const; - - private: - typedef unsigned char Byte; - typedef unsigned short int Word; - typedef unsigned long int DWord; - struct TGAHeader { - Byte IDLength; - Byte ColorMapType; - Byte ImageType; - Word CM_FirstEntry; - Word CM_Length; - Byte CM_EntrySize; - Word IS_XOrigin; - Word IS_YOrigin; - Word IS_Width; - Word IS_Height; - Byte IS_Depth; - Byte IS_Descriptor; - } PACKED; - - struct TGAFooter { - DWord ExtOffset; - DWord DevOffset; - char Sig[18]; - } PACKED; - - unsigned int x, y; - bool r; - Color * img; -}; - -#else -#error This only works with a C++ compiler -#endif -#endif diff --git a/includes/Input.h b/includes/Input.h deleted file mode 100644 index cb1428f..0000000 --- a/includes/Input.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef __INPUT_H__ -#define __INPUT_H__ -#ifdef __cplusplus - -#include <sys/types.h> -#include <time.h> -#include <String.h> -#include <Handle.h> - -class Input : public Handle { - public: - Input(const String & = "") throw (GeneralException); - Input(const Input &); - virtual ~Input() {} - virtual bool CanWrite() const; - virtual bool CanRead() const; - virtual bool CanSeek() const; - virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException); - virtual String GetName() const; - virtual ssize_t GetSize() const; - virtual time_t GetModif() const; - - protected: - String n; - off_t size; - time_t date_modif; -}; - -class Stdin_t : public Input { - public: - Stdin_t(); - virtual ~Stdin_t() {} - virtual bool CanSeek() const; - virtual String GetName() const; -}; - -extern Stdin_t Stdin; - -#else -#error This only works with a C++ compiler -#endif -#endif diff --git a/includes/Main.h b/includes/Main.h deleted file mode 100644 index 4a81b3e..0000000 --- a/includes/Main.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __MAIN_H__ -#define __MAIN_H__ - -#include "Exceptions.h" - -class Main : public Base { - public: - Main(); - virtual ~Main(); - virtual int startup() throw (GeneralException) = 0; - protected: - void set_args(int, char **, char **); - int argc; - char ** argv; - char ** enve; - bool setted; - - friend int main(int, char **, char **); -}; - -#define CODE_BEGINS class Appli : public Main { -#define CODE_ENDS } * Application = new Appli(); - -#endif diff --git a/includes/Output.h b/includes/Output.h deleted file mode 100644 index eb7b8a6..0000000 --- a/includes/Output.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef __OUTPUT_H__ -#define __OUTPUT_H__ -#ifdef __cplusplus - -#include <sys/types.h> -#include <time.h> -#include <String.h> -#include <Handle.h> - -class Output : public Handle { - public: - Output(String = "", int create = 1, int trunc = 1) throw (GeneralException); - Output(const Output &); - virtual ~Output() {} - virtual bool CanWrite() const; - virtual bool CanRead() const; - virtual bool CanSeek() const; - virtual off_t seek(off_t, int = SEEK_SET) throw (GeneralException); - virtual String GetName() const; - - protected: - String n; - off_t size; - time_t date_modif; -}; - -class Stdout_t : public Output { - public: - Stdout_t(); - virtual ~Stdout_t() {} - virtual bool CanSeek() const; - virtual String GetName() const; -}; - -class Stderr_t : public Handle { - public: - Stderr_t(); - virtual ~Stderr_t() {} - virtual bool CanWrite() const; - virtual bool CanRead() const; - virtual bool CanSeek() const; - virtual String GetName() const; -}; - -extern Stdout_t Stdout; -extern Stderr_t Stderr; - -#else -#error This only works with a C++ compiler -#endif -#endif diff --git a/includes/String.h b/includes/String.h deleted file mode 100644 index 7e2f848..0000000 --- a/includes/String.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef __STRING_H__ -#define __STRING_H__ -#ifdef __cplusplus - -#include <iostream> -#include <string.h> -#include <Exceptions.h> - -class String : public Base { - public: - String(const String &); - String(const char * = ""); -#if 0 - String(const char * = "", ...); -#endif - String(char); - String(int); - String(unsigned int); -#ifdef USE_LONGLONG - String(long long); - String(unsigned long long); -#endif - String(double); - ~String(); - const char * set(const char *, ...); - const char * set(const String &, ...); - const char * to_charp(size_t = 0, ssize_t = -1) const; - String extract(size_t = 0, ssize_t = -1) const; - char * strdup(size_t = 0, ssize_t = -1) const; - int to_int() const; - double to_double() const; - String to_sqldate() const; - String to_sqltime() const; - String from_sqldate() const; - String from_sqltime() const; - double datedif(const String &) const; - bool is_date() const; - bool is_number() const; - bool is_float() const; - bool is_time() const; - size_t strlen() const; - ssize_t strchr(char, size_t = 0) const; - ssize_t strrchr(char) const; - ssize_t strstr(const String &) const; - int strchrcnt(char) const; - String & operator=(const String &); - String operator+(const String &) const; - String & operator+=(const String &); - bool operator!=(const String &) const; - bool operator==(const String &) const; - bool operator<=(const String &) const; - bool operator>=(const String &) const; - bool operator<(const String &) const; - bool operator>(const String &) const; - char operator[](size_t i) const; - String & toupper(); - String & tolower(); - - private: - String(int hs, const char *); - static char t[]; - char * str; - size_t siz; -}; - -std::ostream & operator<<(std::ostream &, const String &); -std::istream & operator>>(std::istream &, String &); - -String operator+(const char *, const String &); - -#else -#error This only works with a C++ compiler -#endif -#endif diff --git a/includes/engine.h b/includes/engine.h deleted file mode 100644 index bf53bab..0000000 --- a/includes/engine.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __ENGINE_H__ -#define __ENGINE_H__ - -#include "Exceptions.h" - -namespace mogltk { - class engine : public Base { - public: - static int setup() throw(GeneralException); - static int GetInited(); - private: - static int inited; - }; -}; - -#endif diff --git a/includes/generic.h b/includes/generic.h deleted file mode 100644 index 62a9942..0000000 --- a/includes/generic.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * PSX-Tools Bundle Pack - * Copyright (C) 2002 Nicolas "Pixel" Noble - * - * This program 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __GENERIC_H__ -#define __GENERIC_H__ -#ifdef __cplusplus -#include "String.h" -#endif - -#define M_BARE -1 -#define M_ERROR 0 -#define M_STATUS 1 -#define M_WARNING 2 -#define M_INFO 3 - -#ifndef bcopy -#define bcopy(x,y,z) memcpy((y),(x),(z)) -#endif - -#ifndef MAX -#define MIN(a,b) ((a)<(b)?(a):(b)) -#endif - -#ifndef MAX -#define MAX(a,b) ((a)<(b)?(b):(a) -#endif - -#ifndef SDL_VERSIONNUM -typedef unsigned long int Uint32; -#endif - -#ifndef int32 -typedef signed long int int32; -#endif - -#ifndef Uint16 -typedef unsigned short int Uint16; -#endif - -#ifndef int16 -typedef signed short int int16; -#endif - -#ifndef Uint8 -typedef unsigned char Uint8; -#endif - -#ifndef int8 -typedef signed char int8; -#endif - -#ifndef Byte -typedef Uint8 Byte; -#endif - -#ifndef Word -typedef Uint16 Word; -#endif - -#ifndef DWord -typedef Uint32 DWord; -#endif - -#if defined __linux__ || defined __CYGWIN32__ -#define PACKED __attribute__((packed)) -#else -#define PACKED -#endif - -extern char verbosity; -char ** split(char * s, char t); - -#ifdef __cplusplus -void printm(int level, String fmt, ...); - -#ifndef MAX -template<class T> -inline T MAX(T a, T b) { - return a < b ? b : a; -} -#endif - -#ifndef MIN -template<class T> -inline T MIN(T a, T b) { - return a > b ? b : a; -} -#endif - -#else -#ifndef MAX -#define MAX(__a,__b) ((__a)<(__b)?(__b):(__a)) -#endif - -#ifndef MIN -#define MIN(__a,__b) ((__a)>(__b)?(__b):(__a)) -#endif - -#endif - -#include <sys/types.h> -#include <sys/stat.h> - -#if defined __linux__ || defined __CYGWIN32__ -#define MKDIR(name) mkdir(name, 0777) -#elif defined __WIN32__ -#define MKDIR mkdir -#else -#error Unknow compiler/platform -#endif - -#endif diff --git a/includes/glbase.h b/includes/glbase.h deleted file mode 100644 index f8f0ae6..0000000 --- a/includes/glbase.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __GLBASE_H__ -#define __GLBASE_H__ - -#include <SDL.h> -#include "Exceptions.h" - -namespace mogltk { - class glbase : public Base { - public: - static int setup(int w = 640, int h = 480, int flags = 0) throw(GeneralException); - static int GetWidth(void); - static int GetHeight(void); - static int GetInited(void); - static void Enter2DMode(void); - static void Leave2DMode(void); - static void Flip(void); - static bool is2D(void); - private: - static int width, height, inited, twoD; - static SDL_Surface * surface; - }; -}; - -#endif diff --git a/includes/glfont.h b/includes/glfont.h deleted file mode 100644 index 831da5e..0000000 --- a/includes/glfont.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __GLFONT_H__ -#define __GLFONT_H__ - -#include <SDL.h> -#include "String.h" -#include "gltexture.h" -#include "Color.h" - -namespace mogltk { - class font : public Base { - public: - font(const String & = "font.bin"); - virtual ~font(); - void drawentry(Uint16, Color = Color(255, 255, 255), int = -1, int = -1); - - private: - Uint8 * sizes; - Uint16 nbentries, nbcT, nbT; - Uint8 flags, maxX, maxY, nbcU, nbcV; - texture ** fonttex; - Uint16 * corresp; - }; -}; - -#endif diff --git a/includes/gltexture.h b/includes/gltexture.h deleted file mode 100644 index a094694..0000000 --- a/includes/gltexture.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __GLTEXTURE_H__ -#define __GLTEXTURE_H__ - -#include <GL/gl.h> -#include <SDL.h> -#include "Exceptions.h" - -namespace mogltk { - class texture : public Base { - public: - texture(int = 256, int = 256, bool = false) throw (GeneralException); - virtual ~texture(); - SDL_Surface * GetSurface() throw (GeneralException); - void Generate() throw (GeneralException); - void Bind(bool = true) throw (GeneralException); - GLuint GetWidth(); - GLuint GetHeight(); - static void Unbind(void); - private: - GLuint width, height, tex; - SDL_Surface * surface; - bool planar; - }; -}; - -#endif |