portable portable damnit! need help cleaning this code! its horrid!

SVN revision: 9452
This commit is contained in:
Carsten Haitzler 2004-03-25 02:07:28 +00:00
parent 0e711afd54
commit 6685ca7a70
11 changed files with 51 additions and 29 deletions

View File

@ -11,6 +11,7 @@ AC_ISC_POSIX
AM_INIT_AUTOMAKE(embryo, 0.0.1)
AM_CONFIG_HEADER(config.h)
AC_C_BIGENDIAN
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC

View File

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
INCLUDES = -DLINUX -I$(top_srcdir)/src/lib
INCLUDES = -DLINUX -I$(top_srcdir)/src/lib -I$(top_srcdir) -I$(top_builddir)
bin_PROGRAMS = embryo embryo_cc

View File

@ -22,7 +22,8 @@
*/
#if defined LINUX
#include <embryo_cc_sclinux.h>
#include "embryo_cc_osdefs.h"
#include "embryo_cc_sclinux.h"
#endif
#ifndef __AMX_H
@ -32,19 +33,12 @@
/* The ISO C99 defines the int16_t and int_32t types. If the compiler got
* here, these types are probably undefined.
*/
#if defined __LCC__ || defined LINUX
#include <stdint.h>
#else
typedef short int int16_t;
typedef unsigned short int uint16_t;
#if defined SN_TARGET_PS2
typedef int int32_t;
typedef unsigned int uint32_t;
#else
typedef long int int32_t;
typedef unsigned long int uint32_t;
#endif
#endif
# ifndef __uint32_t_defined
typedef short int int16_t;
typedef unsigned short int uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
# endif
#endif
#if defined __WIN32__ || defined _WIN32 || defined WIN32 || defined __MSDOS__

View File

@ -36,7 +36,7 @@
#endif
#if defined LINUX
#include <endian.h>
#include "config.h"
#endif
/* Linux NOW has these */
@ -48,12 +48,12 @@
#endif
/* educated guess, BYTE_ORDER is undefined, i386 is common => little endian */
#if !defined BYTE_ORDER
#if defined UCLINUX
#define BYTE_ORDER BIG_ENDIAN
#else
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#ifdef WORDS_BIGENDIAN
# undef BYTE_ORDER
# define BYTE_ORDER BIG_ENDIAN
#else
# undef BYTE_ORDER
# define BYTE_ORDER LITTLE_ENDIAN
#endif
/* _MAX_PATH is sometimes called differently and it may be in limits.h instead

View File

@ -37,10 +37,8 @@
#if defined LINUX
#include <unistd.h>
#include "embryo_cc_osdefs.h"
#include <embryo_cc_sclinux.h>
//
#include "config.h"
//
#endif
#if defined FORTIFY

View File

@ -26,6 +26,7 @@
#include <string.h>
#include <ctype.h>
#include <math.h>
#include "embryo_cc_osdefs.h"
#include "embryo_cc_sc.h"
#if defined LINUX
#include <embryo_cc_sclinux.h>

View File

@ -26,10 +26,11 @@
#include <string.h>
#include <ctype.h>
#if defined LINUX
#include <embryo_cc_sclinux.h>
# include "embryo_cc_osdefs.h"
# include <embryo_cc_sclinux.h>
#endif
#if defined FORTIFY
#include "fortify.h"
# include "fortify.h"
#endif
#include "embryo_cc_sc.h"

View File

@ -16,6 +16,27 @@
* So we stick to getchar at the moment... (one needs to key ctrl-d to terminate input if getch is called with a controlling
* terminal driven by a tty having -raw)
*/
#if defined LINUX
#include "config.h"
#endif
/* Linux NOW has these */
#if !defined BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif
#if !defined LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234
#endif
/* educated guess, BYTE_ORDER is undefined, i386 is common => little endian */
#ifdef WORDS_BIGENDIAN
# undef BYTE_ORDER
# define BYTE_ORDER BIG_ENDIAN
#else
# undef BYTE_ORDER
# define BYTE_ORDER LITTLE_ENDIAN
#endif
#define getch getchar
#define stricmp(a,b) strcasecmp(a,b)
#define strnicmp(a,b,c) strncasecmp(a,b,c)
@ -35,9 +56,13 @@
# include <stdlib.h>
#endif
#if defined __OpenBSD__
#ifndef __BYTE_ORDER
# define __BYTE_ORDER BYTE_ORDER
#endif
#ifndef __LITTLE_ENDIAN
# define __LITTLE_ENDIAN LITTLE_ENDIAN
#endif
#ifndef __BIG_ENDIAN
# define __BIG_ENDIAN BIG_ENDIAN
#endif

View File

@ -215,7 +215,6 @@ main(int argc,char *argv[])
{
for (i = args; i < argc; i++)
{
printf("%i\n", i);
if (argv[i][0] == 's')
embryo_parameter_string_push(ep, argv[i] + 1);
else if (argv[i][0] == 'i')

View File

@ -7,6 +7,8 @@ MAINTAINERCLEANFILES = Makefile.in
LDFLAGS =
INCLUDES = -I. \
-I$(top_srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include

View File

@ -2,6 +2,7 @@
#define _EMBRYO_PRIVATE_H
#include "Embryo.h"
#include "config.h"
#include <stdio.h>
#include <stdlib.h>