diff options
author | pixel <pixel> | 2002-12-05 06:03:04 +0000 |
---|---|---|
committer | pixel <pixel> | 2002-12-05 06:03:04 +0000 |
commit | e3e6c1d7688b350046fe3fe7c862f3b3a8c879c9 (patch) | |
tree | 6737d5899aba4bb8dcf11db86726c49d23c343b1 | |
parent | 2b47237b6fc07afb5c5a30b484283c69865a24b6 (diff) |
Bleh
-rw-r--r-- | configure.ac | 46 | ||||
-rw-r--r-- | include/General.h | 12 | ||||
-rw-r--r-- | include/Handle.h | 6 | ||||
-rw-r--r-- | include/Makefile.am | 2 | ||||
-rw-r--r-- | include/String.h | 7 | ||||
-rw-r--r-- | include/generic.h | 48 | ||||
-rw-r--r-- | lib/CopyJob.cc | 1 | ||||
-rw-r--r-- | lib/Exceptions.cc | 9 | ||||
-rw-r--r-- | lib/String.cc | 14 | ||||
-rw-r--r-- | m4/Makefile.in | 1 | ||||
-rw-r--r-- | src/Main.cc | 2 |
11 files changed, 64 insertions, 84 deletions
diff --git a/configure.ac b/configure.ac index eb96f64..c8940c4 100644 --- a/configure.ac +++ b/configure.ac @@ -2,14 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.56) - -AC_DEFINE(PACKAGE, [Baltisot], "Package name") -AC_DEFINE(VERSION, [0.1.0], "Version") - -AC_SUBST(PACKAGE, [Baltisot]) -AC_SUBST(VERSION, [0.1.0]) - -AC_INIT([Baltisot], [0.1.0], [pixel@nobis-crew.org]) +AC_INIT([Baltisot],[0.1.0],[pixel@nobis-crew.org]) +AM_INIT_AUTOMAKE(Balisot, 0.1.0) AC_CONFIG_SRCDIR(src/Main.cc) AM_CONFIG_HEADER(config.h) @@ -25,7 +19,6 @@ AC_PROG_MAKE_SET AC_PROG_RANLIB AC_PROG_YACC AM_PROG_LIBTOOL -AC_ARG_PROGRAM # Checks for libraries. AC_CHECK_LIB([c], [printf]) @@ -69,20 +62,26 @@ if test x$ac_cv_search_deflate != xno ; then OLDCPPFLAGS=$CPPFLAGS CPPFLAGS="-Werror" AC_CACHE_CHECK([for well defined gzwrite in zlib.h], ac_cv_wd_gzwrite, - AC_TRY_COMPILE( - [#include <zlib.h>], - [const char * buf = "Poide"; gzwrite(NULL, buf, 10);], + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <zlib.h>]], + [[const char * buf = "Poide"; gzwrite(NULL, buf, 10);]] + )], [AC_DEFINE([HAVE_WD_ZLIB], 1, [Have a well structured ZLIB]) - ac_cv_wd_gzwrite="yes"], - [ac_cv_wd_gzwrite="no"] - AC_WARNING([You have a broken zconf.h. You should] - [patch this using the zconf.h-patch file.] - [Enabling workaround]) - ) + ac_cv_wd_gzwrite="yes"],[ac_cv_wd_gzwrite="no" + ]) ) CPPFLAGS=$OLDCPPFLAGS -fi +else + AC_MSG_ERROR([no zlib found in the system.]) +fi +if test x$ac_cv_wd_gzwrite != xyes ; then + AC_MSG_WARN([You have a broken zconf.h.] + [You should patch this using] + [the zconf.h-patch file.] + [Enabling workaround.]) +fi AC_CHECK_FUNCS(gethostbyname) AC_CHECK_FUNCS(regcomp) @@ -98,11 +97,10 @@ else AC_MSG_RESULT($system) fi - -AC_DEFINE(USE_LONG_LONG, 1, [Use long long]) -AC_DEFINE(USE_DATE, 1, [Use the String's date extension]) -AC_DEFINE(DEBUG, 1, [Enable verbose debugging]) - +AC_ARG_ENABLE([debug], + [ --enable-debug enable verbose debugging], + AC_DEFINE(DEBUG, 1, [Enable verbose debugging])) + AC_CONFIG_FILES([Makefile doc/Makefile include/Makefile diff --git a/include/General.h b/include/General.h deleted file mode 100644 index 2b645c9..0000000 --- a/include/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/include/Handle.h b/include/Handle.h index 9744b7e..e545109 100644 --- a/include/Handle.h +++ b/include/Handle.h @@ -5,9 +5,7 @@ #include <sys/types.h> #include <time.h> -#ifdef HAVE_ZLIB #include <zlib.h> -#endif #include <unistd.h> #include <iostream> #include <String.h> @@ -34,9 +32,7 @@ class Handle : public Base { 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; @@ -46,10 +42,8 @@ class Handle : public Base { ssize_t uread(void *, size_t); int h; bool closed, nonblock; -#ifdef HAVE_ZLIB gzFile zfile; int z; -#endif }; Handle & operator<<(Handle &, const String &); diff --git a/include/Makefile.am b/include/Makefile.am index 5d895be..d50604f 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,5 +1,5 @@ #includedir = $(prefix)/include/@PACKAGE@ pkginclude_HEADERS = \ Exceptions.h Handle.h String.h Output.h Socket.h HttpServ.h Variables.h Menu.h \ -Action.h Message.h Form.h Confirm.h Table.h IRC.h Task.h Buffer.h General.h \ +Action.h Message.h Form.h Confirm.h Table.h IRC.h Task.h Buffer.h \ CopyJob.h ReadJob.h Regex.h TaskMan.h InPipe.h OutPipe.h Input.h Image.h Main.h diff --git a/include/String.h b/include/String.h index 72fc135..d8959b9 100644 --- a/include/String.h +++ b/include/String.h @@ -5,6 +5,7 @@ #include <iostream> #include <string.h> #include <Exceptions.h> +#include <generic.h> class String : public Base { public: @@ -16,10 +17,8 @@ class String : public Base { String(char); String(int); String(unsigned int); -#ifdef USE_LONG_LONG - String(long long); - String(unsigned long long); -#endif + String(int64); + String(uint64); String(double); ~String(); const char * set(const char *, ...); diff --git a/include/generic.h b/include/generic.h index 62a9942..a8f3be5 100644 --- a/include/generic.h +++ b/include/generic.h @@ -1,27 +1,5 @@ -/* - * 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 @@ -77,6 +55,16 @@ typedef Uint16 Word; typedef Uint32 DWord; #endif +#if defined __linux__ || defined __solaris__ || defined __CYGWIN32__ +typedef long long int64; +typedef unsigned long long uint64; +#elif defined _WIN32 +typedef _int64 int64; +typedef unsigned _int64 int64; +#else +#error Unsupported platform (need 64 bits ints definition) +#endif + #if defined __linux__ || defined __CYGWIN32__ #define PACKED __attribute__((packed)) #else @@ -87,6 +75,7 @@ extern char verbosity; char ** split(char * s, char t); #ifdef __cplusplus +#include <String.h> void printm(int level, String fmt, ...); #ifndef MAX @@ -114,6 +103,11 @@ inline T MIN(T a, T b) { #endif +#define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255) +#define BX_(x) ((x) - (((x)>>1)&0x77777777) \ + - (((x)>>2)&0x33333333) \ + - (((x)>>3)&0x11111111)) + #include <sys/types.h> #include <sys/stat.h> @@ -125,4 +119,14 @@ inline T MIN(T a, T b) { #error Unknow compiler/platform #endif +#if defined __linux__ || defined __solaris__ || defined __CYGWIN32__ +typedef long long int64; +typedef unsigned long long uint64; +#elif defined _WIN32 +typedef _int64 int64; +typedef unsigned _int64 int64; +#else +#error Unsupported platform (need 64 bits ints definition) +#endif + #endif diff --git a/lib/CopyJob.cc b/lib/CopyJob.cc index 3e6180d..329dd63 100644 --- a/lib/CopyJob.cc +++ b/lib/CopyJob.cc @@ -3,7 +3,6 @@ #endif #include "gettext.h" #include "CopyJob.h" -#include "General.h" CopyJob::CopyJob(Handle * as, Handle * ad, ssize_t asiz, bool ads, bool add) : s(as), d(ad), ds(ads), dd(add), siz(asiz), cursiz(0), r(0), w(0), tw(0) { s->SetNonBlock(); diff --git a/lib/Exceptions.cc b/lib/Exceptions.cc index c46dcfc..3be7c65 100644 --- a/lib/Exceptions.cc +++ b/lib/Exceptions.cc @@ -178,14 +178,23 @@ void * Base::calloc(size_t n, size_t s) { } void * Base::operator new(size_t s) { +#ifdef DEBUG + cerr << "Operator new(s) called. Allocating memory.\n"; +#endif return xmalloc(s); } void * Base::operator new(size_t s, void * p) { +#ifdef DEBUG + printm(M_BARE, "Operator new(s, p) called with p = %p and s = %i. Erasing memory.\n", p, s); +#endif return memset(p, 0, s); } void Base::operator delete(void * p) { +#ifdef DEBUG + printm(M_BARE, "Operator delete(p) called. Freeing memory.\n"); +#endif xfree(p); } diff --git a/lib/String.cc b/lib/String.cc index 062587d..510a84e 100644 --- a/lib/String.cc +++ b/lib/String.cc @@ -10,12 +10,10 @@ char ** gruikptr; -#ifdef USE_DATE extern "C" { double dateCalc(char *, char *); int isDateArgument(char *); } -#endif char String::t[BUFSIZ + 1]; @@ -86,8 +84,7 @@ String::String(unsigned int i) { siz = ::strlen(str); } -#ifdef USE_LONG_LONG -String::String(long long l) { +String::String(int64 l) { char t[40]; sprintf(t, "%lld", l); @@ -95,14 +92,13 @@ String::String(long long l) { siz = ::strlen(str); } -String::String(unsigned long long l) { +String::String(uint64 l) { char t[40]; sprintf(t, "%llu", l); str = Base::strdup(t); siz = ::strlen(str); } -#endif String::String(double d) { char t[30]; @@ -321,12 +317,10 @@ int String::strchrcnt(char c) const { return cnt; } -#ifdef USE_DATE String String::to_sqldate(void) const { /* DD/MM/YYYY ==> YYYYMMMDD */ return (is_date() ? extract(6, 9) + extract(3, 4) + extract(0, 1) : ""); } -#endif String String::to_sqltime(void) const { /* h:m ==> h * 60 + m */ @@ -334,12 +328,10 @@ String String::to_sqltime(void) const { return (is_time() ? String(extract(0, p - 1).to_int() * 60 + extract(p + 1).to_int()) : ""); } -#ifdef USE_DATE String String::from_sqldate(void) const { /* YYYYMMDD ==> DD/MM/YYYY */ return ((strlen() == 8) && is_number() ? extract(6, 7) + '/' + extract(4, 5) + '/' + extract(0, 3) : ""); } -#endif String String::from_sqltime(void) const { /* t ==> (t / 60):(t % 60) */ @@ -347,7 +339,6 @@ String String::from_sqltime(void) const { return (is_number() ? String((int) (t / 60)) + ':' + (t % 60) : ""); } -#ifdef USE_DATE bool String::is_date(void) const { /* 'DD/MM/YYYY' 0123456789 */ @@ -372,7 +363,6 @@ double String::datedif(const String & s) const { return -1; } -#endif bool String::is_number(void) const { for (size_t i = ((str[0] == '-') ? 1 : 0); i < siz; i++) { diff --git a/m4/Makefile.in b/m4/Makefile.in index ac2e992..310e1ed 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -87,6 +87,7 @@ LTLIB = @LTLIB@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ diff --git a/src/Main.cc b/src/Main.cc index 333328a..9f36b56 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -155,7 +155,6 @@ int startup() { std::list<String> testlist; testlist.push_front("poide"); -/* in = new InPipe(); in->Hook(); @@ -168,7 +167,6 @@ int startup() { std::cerr << "The stdout redirect has failed.\n"; exit(-1); } -*/ while ((c = getopt(argc, argv, "p:")) != EOF) { switch (c) { |