mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d27cfef46b |
@@ -1,19 +1,11 @@
|
||||
#
|
||||
# $Id: GNUmakefile.68k,v 1.106 2008-04-16 07:38:10 obarthel Exp $
|
||||
# $Id: GNUmakefile.68k,v 1.101 2007-01-06 10:09:48 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
|
||||
############################################
|
||||
# find out the HOST operating system
|
||||
# on which this makefile is run (default to AmigaOS)
|
||||
HOST ?= $(shell uname)
|
||||
ifeq ($(HOST),)
|
||||
HOST = AmigaOS
|
||||
endif
|
||||
|
||||
CC = gcc
|
||||
AR = ar -q
|
||||
RANLIB = ranlib
|
||||
@@ -22,16 +14,6 @@ DELETE = delete all quiet
|
||||
MAKEDIR = makedir
|
||||
MAKE = $(MAKE_COMMAND) -f GNUmakefile.68k
|
||||
|
||||
# override certain things for non-native builds
|
||||
ifneq ($(HOST), AmigaOS)
|
||||
CC = m68k-amigaos-gcc
|
||||
AR = m68k-amigaos-ar -q
|
||||
RANLIB = m68k-amigaos-ranlib
|
||||
COPY = cp
|
||||
DELETE = rm -rf
|
||||
MAKEDIR = mkdir -p
|
||||
endif
|
||||
|
||||
##############################################################################
|
||||
|
||||
ifeq (,$(TYPE))
|
||||
@@ -68,11 +50,11 @@ $(LIBUNIX_OBJS)/%.o : %.c
|
||||
|
||||
$(LIBM_OBJS)/%.o : %.c
|
||||
@echo "Compiling $< [$(TYPE):m]"
|
||||
@$(CC) -o $(LIBM_OBJS)/$*.o -c $(CFLAGS) -msoft-float -DIEEE_FLOATING_POINT_SUPPORT $<
|
||||
@$(CC) -o $(LIBM_OBJS)/$*.o -c $(CFLAGS) -DIEEE_FLOATING_POINT_SUPPORT $<
|
||||
|
||||
$(LIBM881_OBJS)/%.o : %.c
|
||||
@echo "Compiling $< [$(TYPE):m881]"
|
||||
@$(CC) -o $(LIBM881_OBJS)/$*.o -c $(CFLAGS) -m68881 -DM68881_FLOATING_POINT_SUPPORT $<
|
||||
@$(CC) -o $(LIBM881_OBJS)/$*.o -c $(CFLAGS) -DM68881_FLOATING_POINT_SUPPORT -m68881 $<
|
||||
|
||||
$(LIBNET_OBJS)/%.o : %.c
|
||||
@echo "Compiling $< [$(TYPE):net]"
|
||||
@@ -127,14 +109,13 @@ INCLUDES = -Iinclude -I. -Inetinclude
|
||||
#OPTIONS = -fno-builtin -fno-common -DNDEBUG -D__THREAD_SAFE
|
||||
#OPTIONS = -fno-builtin -fno-common -D__MEM_DEBUG
|
||||
#OPTIONS = -fno-builtin -fno-common -DDEBUG -D__MEM_DEBUG -DNO_INLINE_STDARG
|
||||
#OPTIMIZE = -O3 -fomit-frame-pointer -funroll-loops -finline-functions
|
||||
OPTIMIZE = -O -fomit-frame-pointer -fstrength-reduce -finline-functions
|
||||
OPTIMIZE = -O -fomit-frame-pointer -fstrength-reduce -finline-functions
|
||||
#OPTIMIZE = -O2 -fomit-frame-pointer
|
||||
#DEBUG = -g
|
||||
|
||||
CFLAGS = \
|
||||
$(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) \
|
||||
$(CODE_FLAGS) $(INCLUDES) $(CODE_TYPE)
|
||||
$(CODE_FLAGS) $(CODE_TYPE) $(INCLUDES)
|
||||
|
||||
##############################################################################
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.os4,v 1.116 2008-11-06 14:44:07 obarthel Exp $
|
||||
# $Id: GNUmakefile.os4,v 1.111 2007-01-06 10:09:48 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@@ -26,15 +26,10 @@ NET_INCLUDE := netinclude
|
||||
CC := ppc-amigaos-gcc
|
||||
AR := ppc-amigaos-ar -q
|
||||
RANLIB := ppc-amigaos-ranlib
|
||||
COPY := cp -p
|
||||
COPY := cp -a
|
||||
DELETE := rm -rf
|
||||
MAKEDIR := mkdir -p
|
||||
LOG_COMMAND := 2>&1 | tee -a compiler.log
|
||||
# You may need to request a specific compiler version in order to
|
||||
# build the baserel versions of the library. At this time of
|
||||
# writing (2008-11-06) GCC 4.0.4 and below support the -mbaserel
|
||||
# feature, but more recent versions, including GCC 4.2.4, do not.
|
||||
#COMPILER_VERSION := -V4.0.2
|
||||
|
||||
# The following are for the native OS4 compiler; note that the
|
||||
# LOG_COMMAND should not be enabled unless you have a shell
|
||||
@@ -47,7 +42,6 @@ LOG_COMMAND := 2>&1 | tee -a compiler.log
|
||||
#COPY := copy
|
||||
#DELETE := delete all quiet force
|
||||
#MAKEDIR := makedir all force
|
||||
#COMPILER_VERSION := -V4.0.2
|
||||
#LOG_COMMAND := *>< | tee >>compiler.log
|
||||
|
||||
##############################################################################
|
||||
@@ -59,14 +53,14 @@ WARNINGS := \
|
||||
# -Wconversion -Wshadow
|
||||
|
||||
INCLUDES := -Iinclude -I. -I$(SDK_INCLUDE)
|
||||
OPTIONS := -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-common -std=gnu99 -mcrt=clib2
|
||||
OPTIONS := -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-common -std=gnu99
|
||||
OPTIMIZE := -DNDEBUG -O3
|
||||
|
||||
#DEBUG := -ggdb
|
||||
#MEMDEBUG := -D__USE_MEM_TREES -D__MEM_DEBUG
|
||||
|
||||
CFLAGS := $(COMPILER_VERSION) $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(MEMDEBUG) $(OPTIONS) $(INCLUDES)
|
||||
AFLAGS := $(COMPILER_VERSION) -Wa,-mregnames
|
||||
CFLAGS := $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(MEMDEBUG) $(OPTIONS) $(INCLUDES)
|
||||
AFLAGS := -Wa,-mregnames
|
||||
|
||||
LARGEDATA := -msdata=data
|
||||
SOFTFLOAT := -msdata=data -msoft-float
|
||||
@@ -218,19 +212,19 @@ lib.threadsafe/baserel/%.o : %.c
|
||||
##############################################################################
|
||||
|
||||
define COMPILE
|
||||
-$(MAKEDIR) $(@D)
|
||||
$(MAKEDIR) $(@D)
|
||||
echo "Compiling $< [$(@D)]"
|
||||
$(CC) $(CFLAGS) -o $@ -c $< $(LOG_COMMAND)
|
||||
$(CC) -o $@ -c $(CFLAGS) $< $(LOG_COMMAND)
|
||||
endef
|
||||
|
||||
define ASSEMBLE
|
||||
-$(MAKEDIR) $(@D)
|
||||
$(MAKEDIR) $(@D)
|
||||
echo "Assembling $< [$(@D)]"
|
||||
$(CC) $(AFLAGS) -o $@ -c $< $(LOG_COMMAND)
|
||||
$(CC) -o $@ -c $(AFLAGS) $< $(LOG_COMMAND)
|
||||
endef
|
||||
|
||||
define MAKELIB
|
||||
-$(MAKEDIR) $@
|
||||
$(MAKEDIR) $@
|
||||
$(DELETE) $@
|
||||
echo "Making $@"
|
||||
$(AR) $@ $^ $(LOG_COMMAND)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 205
|
||||
#define DATE "21.8.2010"
|
||||
#define VERS "amiga.lib 1.205"
|
||||
#define VSTRING "amiga.lib 1.205 (21.8.2010)\r\n"
|
||||
#define VERSTAG "\0$VER: amiga.lib 1.205 (21.8.2010)"
|
||||
#define REVISION 202
|
||||
#define DATE "16.1.2007"
|
||||
#define VERS "amiga.lib 1.202"
|
||||
#define VSTRING "amiga.lib 1.202 (16.1.2007)\r\n"
|
||||
#define VERSTAG "\0$VER: amiga.lib 1.202 (16.1.2007)"
|
||||
|
||||
@@ -1 +1 @@
|
||||
205
|
||||
202
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: amiga_argarrayinit.c,v 1.7 2008-09-30 14:09:00 obarthel Exp $
|
||||
* $Id: amiga_argarrayinit.c,v 1.6 2006-09-22 09:02:51 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -52,14 +52,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __amigaos4__
|
||||
#define MEMORY_TYPE MEMF_PRIVATE
|
||||
#else
|
||||
#define MEMORY_TYPE MEMF_ANY
|
||||
#endif /* __amigaos4__ */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
const unsigned char ** CXLIB_argarray;
|
||||
|
||||
struct DiskObject * CXLIB_disko;
|
||||
@@ -78,7 +70,7 @@ ArgArrayInit(LONG argc, CONST_STRPTR * argv)
|
||||
if(argc == 1)
|
||||
goto out; /* skip command name */
|
||||
|
||||
CXLIB_argarray = (const unsigned char **)AllocVec(sizeof(char *) * argc,MEMORY_TYPE|MEMF_CLEAR);
|
||||
CXLIB_argarray = (const unsigned char **)AllocVec(sizeof(char *) * argc,MEMF_ANY|MEMF_CLEAR);
|
||||
if(CXLIB_argarray == NULL)
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: amiga_rexxvars.c,v 1.19 2008-04-18 10:11:59 obarthel Exp $
|
||||
* $Id: amiga_rexxvars.c,v 1.10 2006-09-25 18:19:44 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -53,12 +53,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* This is used by the stub function prototypes. The ARexx header files
|
||||
do not define it, though. */
|
||||
struct Environment;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define __NOLIBBASE__
|
||||
#include <proto/rexxsyslib.h>
|
||||
|
||||
@@ -76,7 +70,7 @@ static struct RexxSysIFace * IRexxSys;
|
||||
|
||||
BOOL CheckRexxMsg(struct RexxMsg *message);
|
||||
LONG GetRexxVar(struct RexxMsg *message,STRPTR variable_name,STRPTR *buffer_pointer);
|
||||
LONG SetRexxVar(struct RexxMsg *message,STRPTR variable_name,STRPTR value,LONG length);
|
||||
LONG SetRexxVar(struct RexxMsg *message,STRPTR variable_name,STRPTR value,ULONG length);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@@ -148,7 +142,7 @@ CheckRexxMsg(struct RexxMsg *message)
|
||||
if(message->rm_TaskBlock == NULL)
|
||||
goto out;
|
||||
|
||||
if(NOT IsRexxMsg(message))
|
||||
if(NOT IsRexxMsg((struct Message *)message))
|
||||
goto out;
|
||||
|
||||
result = TRUE;
|
||||
@@ -160,583 +154,56 @@ CheckRexxMsg(struct RexxMsg *message)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__amigaos4__)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <exec/emulation.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
STATIC VOID
|
||||
_FreeSpace(struct Environment * env,APTR mem,LONG size)
|
||||
/* The following function works in about like the original, except that it's
|
||||
not reentrant, does not fill in a pointer to the variable itself and
|
||||
requires rexxsyslib.library V45. */
|
||||
LONG
|
||||
GetRexxVar(struct RexxMsg *message,STRPTR variable_name,STRPTR *buffer_pointer)
|
||||
{
|
||||
STATIC CONST UWORD code[] = { 0x4EAE,0xFF88,0x4E75 }; /* jsr -120(a6) ; rts */
|
||||
|
||||
EmulateTags(code,
|
||||
ET_RegisterA0,env,
|
||||
ET_RegisterA1,mem,
|
||||
ET_RegisterD0,size,
|
||||
ET_RegisterA6,RexxSysBase,
|
||||
TAG_END);
|
||||
}
|
||||
|
||||
STATIC APTR
|
||||
_GetSpace(struct Environment * env,LONG size)
|
||||
{
|
||||
STATIC CONST UWORD code[] = { 0x4EAE,0xFF8E,0x4E75 }; /* jsr -114(a6) ; rts */
|
||||
APTR result;
|
||||
|
||||
result = (APTR)EmulateTags(code,
|
||||
ET_RegisterA0,env,
|
||||
ET_RegisterD0,size,
|
||||
ET_RegisterA6,RexxSysBase,
|
||||
TAG_END);
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
STATIC LONG
|
||||
_IsSymbol(STRPTR name,LONG * symbol_length_ptr)
|
||||
{
|
||||
STATIC CONST UWORD code[] = { 0x4EAE,0xFF9A,0x2481,0x4E75 }; /* jsr -102(a6) ; move.l d1,(a2) ; rts */
|
||||
static TEXT buffer[256];
|
||||
LONG result;
|
||||
|
||||
result = (LONG)EmulateTags(code,
|
||||
ET_RegisterA0,name,
|
||||
ET_RegisterA2,symbol_length_ptr,
|
||||
ET_RegisterA6,RexxSysBase,
|
||||
TAG_END);
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
STATIC VOID
|
||||
_CurrentEnv(struct RexxTask *task,struct Environment ** environment_ptr)
|
||||
{
|
||||
STATIC CONST UWORD code[] = { 0x4EAE,0xFF94,0x2488,0x4E75 }; /* jsr -108(a6) ; move.l a0,(a2) ; rts */
|
||||
|
||||
EmulateTags(code,
|
||||
ET_RegisterA0,task,
|
||||
ET_RegisterA2,environment_ptr,
|
||||
ET_RegisterA6,RexxSysBase,
|
||||
TAG_END);
|
||||
}
|
||||
|
||||
STATIC struct Node *
|
||||
_FetchValue(struct Environment * env,struct NexxStr * stem,struct NexxStr * compound,struct Node *symbol_table_node,LONG * is_literal_ptr,struct NexxStr ** value_ptr)
|
||||
{
|
||||
STATIC CONST UWORD code[] = { 0x4EAE,0xFFB8,0x2488,0x2681,0x4E75 }; /* jsr -72(a6) ; move.l a0,(a2) ; move.l d1,(a3) ; rts */
|
||||
struct Node * result;
|
||||
|
||||
result = (struct Node *)EmulateTags(code,
|
||||
ET_RegisterA0,env,
|
||||
ET_RegisterA1,stem,
|
||||
ET_RegisterD0,compound,
|
||||
ET_RegisterD1,symbol_table_node,
|
||||
ET_RegisterA2,is_literal_ptr,
|
||||
ET_RegisterA3,value_ptr,
|
||||
ET_RegisterA6,RexxSysBase,
|
||||
TAG_END);
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
STATIC struct Node *
|
||||
_EnterSymbol(struct Environment * env,struct NexxStr * stem,struct NexxStr * compound)
|
||||
{
|
||||
STATIC CONST UWORD code[] = { 0x4EAE,0xFFBE,0x4E75 }; /* jsr -66(a6) ; rts */
|
||||
struct Node * result;
|
||||
|
||||
result = (struct Node *)EmulateTags(code,
|
||||
ET_RegisterA0,env,
|
||||
ET_RegisterA1,stem,
|
||||
ET_RegisterD0,compound,
|
||||
ET_RegisterA6,RexxSysBase,
|
||||
TAG_END);
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
STATIC VOID
|
||||
_SetValue(struct Environment * env,struct NexxStr * value,struct Node * symbol_table_node)
|
||||
{
|
||||
STATIC CONST UWORD code[] = { 0x4EAE,0xFFAC,0x4E75 }; /* jsr -84(a6) ; rts */
|
||||
struct Node * result;
|
||||
|
||||
result = (struct Node *)EmulateTags(code,
|
||||
ET_RegisterA0,env,
|
||||
ET_RegisterA1,value,
|
||||
ET_RegisterD0,symbol_table_node,
|
||||
ET_RegisterA6,RexxSysBase,
|
||||
TAG_END);
|
||||
}
|
||||
|
||||
STATIC ULONG
|
||||
_StrcpyN(STRPTR destination,STRPTR source,LONG length)
|
||||
{
|
||||
STATIC CONST UWORD code[] = { 0x4EAE,0xFEF2,0x4E75 }; /* jsr -270(a6) ; rts */
|
||||
ULONG result;
|
||||
|
||||
result = (ULONG)EmulateTags(code,
|
||||
ET_RegisterA0,destination,
|
||||
ET_RegisterA1,source,
|
||||
ET_RegisterD0,length,
|
||||
ET_RegisterA6,RexxSysBase,
|
||||
TAG_END);
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#elif defined(__GNUC__) && !defined(__amigaos4__)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* A selection of lovingly hand-crafted 68k stub functions which call
|
||||
into rexxsyslib.library LVOs that still used to be documented back
|
||||
in 1987. */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(SMALL_DATA)
|
||||
#define A4(x) "a4@(" #x ":W)"
|
||||
#elif defined(SMALL_DATA32)
|
||||
#define A4(x) "a4@(" #x ":L)"
|
||||
#else
|
||||
#define A4(x) #x
|
||||
#endif /* SMALL_DATA */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* struct Environment * a0,APTR block a1,LONG d0 */
|
||||
asm("
|
||||
|
||||
.text
|
||||
.even
|
||||
|
||||
.globl __FreeSpace
|
||||
|
||||
__FreeSpace:
|
||||
|
||||
moveal sp@(4),a0
|
||||
moveal sp@(8),a1
|
||||
movel sp@(12),d0
|
||||
|
||||
movel a6,sp@-
|
||||
moveal "A4(_RexxSysBase)",a6
|
||||
jsr a6@(-120)
|
||||
moveal sp@+,a6
|
||||
|
||||
rts
|
||||
|
||||
");
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* struct Environment * a0,LONG d0 : APTR d0 */
|
||||
asm("
|
||||
|
||||
.text
|
||||
.even
|
||||
|
||||
.globl __GetSpace
|
||||
|
||||
__GetSpace:
|
||||
|
||||
moveal sp@(4),a0
|
||||
movel sp@(8),d0
|
||||
|
||||
movel a6,sp@-
|
||||
moveal "A4(_RexxSysBase)",a6
|
||||
jsr a6@(-114)
|
||||
moveal sp@+,a6
|
||||
|
||||
rts
|
||||
|
||||
");
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* STRPTR a0 : LONG d0, LONG d1 */
|
||||
asm("
|
||||
|
||||
.text
|
||||
.even
|
||||
|
||||
.globl __IsSymbol
|
||||
|
||||
__IsSymbol:
|
||||
|
||||
moveal sp@(4),a0
|
||||
|
||||
movel a6,sp@-
|
||||
moveal "A4(_RexxSysBase)",a6
|
||||
jsr a6@(-102)
|
||||
moveal sp@+,a6
|
||||
|
||||
moveal sp@(8),a1
|
||||
movel d1,a1@
|
||||
|
||||
rts
|
||||
|
||||
");
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* struct RexxTask * a0 : struct Environment * a0 */
|
||||
asm("
|
||||
|
||||
.text
|
||||
.even
|
||||
|
||||
.globl __CurrentEnv
|
||||
|
||||
__CurrentEnv:
|
||||
|
||||
moveal sp@(4),a0
|
||||
|
||||
movel a6,sp@-
|
||||
moveal "A4(_RexxSysBase)",a6
|
||||
jsr a6@(-108)
|
||||
moveal sp@+,a6
|
||||
|
||||
moveal sp@(8),a1
|
||||
movel a0,a1@
|
||||
|
||||
rts
|
||||
|
||||
");
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* struct Environment * a0,struct NexxStr * a1,struct NexxStr * d0,struct Node * d1 : struct NexxStr * a0, LONG d1 */
|
||||
asm("
|
||||
|
||||
.text
|
||||
.even
|
||||
|
||||
.globl __FetchValue
|
||||
|
||||
__FetchValue:
|
||||
|
||||
moveal sp@(4),a0
|
||||
moveal sp@(8),a1
|
||||
movel sp@(12),d0
|
||||
movel sp@(16),d1
|
||||
|
||||
movel a6,sp@-
|
||||
moveal "A4(_RexxSysBase)",a6
|
||||
jsr a6@(-72)
|
||||
moveal sp@+,a6
|
||||
|
||||
moveal sp@(20),a1
|
||||
movel a0,a1@
|
||||
moveal sp@(24),a1
|
||||
movel d1,a1@
|
||||
|
||||
rts
|
||||
|
||||
");
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* struct Environment a0, struct NexxStr *a1, struct NexxStr * d0 : struct Node * d0 */
|
||||
asm("
|
||||
|
||||
.text
|
||||
.even
|
||||
|
||||
.globl __EnterSymbol
|
||||
|
||||
__EnterSymbol:
|
||||
|
||||
moveal sp@(4),a0
|
||||
moveal sp@(8),a1
|
||||
movel sp@(12),d0
|
||||
|
||||
movel a6,sp@-
|
||||
moveal "A4(_RexxSysBase)",a6
|
||||
jsr a6@(-66)
|
||||
moveal sp@+,a6
|
||||
|
||||
rts
|
||||
|
||||
");
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* struct Environment *a0, struct NexxStr *a1, struct Node * d0 */
|
||||
asm("
|
||||
|
||||
.text
|
||||
.even
|
||||
|
||||
.globl __SetValue
|
||||
|
||||
__SetValue:
|
||||
|
||||
moveal sp@(4),a0
|
||||
moveal sp@(8),a1
|
||||
movel sp@(12),d0
|
||||
|
||||
movel a6,sp@-
|
||||
moveal "A4(_RexxSysBase)",a6
|
||||
jsr a6@(-84)
|
||||
moveal sp@+,a6
|
||||
|
||||
rts
|
||||
|
||||
");
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* STRPTR a0,STRPTR a1,LONG d0 : ULONG d0 */
|
||||
asm("
|
||||
|
||||
.text
|
||||
.even
|
||||
|
||||
.globl __StrcpyN
|
||||
|
||||
__StrcpyN:
|
||||
|
||||
moveal sp@(4),a0
|
||||
moveal sp@(8),a1
|
||||
movel sp@(12),d0
|
||||
|
||||
movel a6,sp@-
|
||||
moveal "A4(_RexxSysBase)",a6
|
||||
jsr a6@(-270)
|
||||
moveal sp@+,a6
|
||||
|
||||
rts
|
||||
|
||||
");
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Function prototypes for the 68k stubs. */
|
||||
extern VOID _FreeSpace(struct Environment * env,APTR mem,LONG size);
|
||||
extern APTR _GetSpace(struct Environment * env,LONG size);
|
||||
extern LONG _IsSymbol(STRPTR name,LONG * symbol_length_ptr);
|
||||
extern VOID _CurrentEnv(struct RexxTask *task,struct Environment ** environment_ptr);
|
||||
extern struct Node * _FetchValue(struct Environment * env,struct NexxStr * stem,struct NexxStr * compound,struct Node *symbol_table_node,LONG * is_literal_ptr,struct NexxStr ** value_ptr);
|
||||
extern struct Node * _EnterSymbol(struct Environment * env,struct NexxStr * stem,struct NexxStr * compound);
|
||||
extern VOID _SetValue(struct Environment * env,struct NexxStr * value,struct Node * symbol_table_node);
|
||||
extern ULONG _StrcpyN(STRPTR destination,STRPTR source,LONG length);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __GNUC__ && !__amigaos4__ */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Releases a string structure, if it's not owned at the time. */
|
||||
STATIC VOID
|
||||
FreeString(struct Environment * environment,struct NexxStr * ns)
|
||||
{
|
||||
/* Not currently owned? */
|
||||
if(!(ns->ns_Flags & NSF_KEEP))
|
||||
_FreeSpace(environment,ns,sizeof(*ns) + ns->ns_Length + 1);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Allocates and initializes a string structure. */
|
||||
STATIC struct NexxStr *
|
||||
MakeString(struct Environment * environment,STRPTR value,LONG length)
|
||||
{
|
||||
struct NexxStr * result = NULL;
|
||||
struct NexxStr * ns;
|
||||
|
||||
/* Allocate memory for the NexxStr and the NUL-terminated string itself. */
|
||||
ns = _GetSpace(environment,sizeof(*ns) + length + 1);
|
||||
if(ns == NULL)
|
||||
goto out;
|
||||
|
||||
/* Fill in the NexxStr structure, copy the string and remember the hash value for it. */
|
||||
ns->ns_Ivalue = 0;
|
||||
ns->ns_Length = length;
|
||||
ns->ns_Flags = NSF_STRING;
|
||||
ns->ns_Hash = _StrcpyN((STRPTR)ns->ns_Buff,value,length);
|
||||
|
||||
/* Copying the string did not NUL-terminate it. */
|
||||
ns->ns_Buff[length] = '\0';
|
||||
|
||||
result = ns;
|
||||
|
||||
out:
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Classifies a symbol and returns the stem and compound parts. */
|
||||
STATIC LONG
|
||||
TypeString(STRPTR variable_name,struct Environment * environment,struct NexxStr ** compound_ptr,struct NexxStr ** stem_ptr)
|
||||
{
|
||||
struct NexxStr * compound;
|
||||
struct NexxStr * stem = NULL;
|
||||
LONG error = ERR10_003; /* no memory available */
|
||||
LONG stem_length;
|
||||
LONG symbol_length;
|
||||
STRPTR dot;
|
||||
|
||||
(*compound_ptr) = NULL;
|
||||
(*stem_ptr) = NULL;
|
||||
|
||||
/* The 'compound' part is the entire variable name, including all dots and
|
||||
what's in between them. */
|
||||
compound = MakeString(environment,variable_name,strlen(variable_name));
|
||||
if(compound == NULL)
|
||||
goto out;
|
||||
|
||||
/* Find the first dot in the variable name. Everything in front of it
|
||||
and including the dot constitutes the 'stem' part. If there is no dot
|
||||
in the name, then the 'compound' and 'stem' parts are identical. */
|
||||
dot = memchr(compound->ns_Buff,'.',compound->ns_Length);
|
||||
if(dot != NULL)
|
||||
stem_length = ((char *)dot - (char *)compound->ns_Buff) + 1;
|
||||
else
|
||||
stem_length = compound->ns_Length;
|
||||
|
||||
/* Make a copy of the 'stem' part. */
|
||||
stem = MakeString(environment,variable_name,stem_length);
|
||||
if(stem == NULL)
|
||||
goto out;
|
||||
|
||||
/* Figure out if this is a symbol after all. */
|
||||
_IsSymbol((STRPTR)stem->ns_Buff,&symbol_length);
|
||||
|
||||
/* The entire name must match the stem part. */
|
||||
if(symbol_length != stem->ns_Length)
|
||||
/* The following uses a function which was added to rexxsyslib.library V45.
|
||||
We therefore have a minimum library version requirement. */
|
||||
if(RexxSysBase == NULL || RexxSysBase->lib_Version < 45 || NOT IsRexxMsg((struct Message *)message))
|
||||
{
|
||||
error = ERR10_040; /* invalid variable name */
|
||||
result = ERR10_010; /* invalid message packet */
|
||||
goto out;
|
||||
}
|
||||
|
||||
(*compound_ptr) = compound;
|
||||
(*stem_ptr) = stem;
|
||||
/* The 256 character limit isn't good. This should be done differently. */
|
||||
result = GetRexxVarFromMsg(variable_name,buffer,message);
|
||||
if(result != 0)
|
||||
goto out;
|
||||
|
||||
error = 0;
|
||||
(*buffer_pointer) = buffer;
|
||||
|
||||
out:
|
||||
out:
|
||||
|
||||
if(error != 0)
|
||||
{
|
||||
if(compound != NULL)
|
||||
FreeString(environment,compound);
|
||||
|
||||
if(stem != NULL)
|
||||
FreeString(environment,stem);
|
||||
}
|
||||
|
||||
return(error);
|
||||
return(result);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Retrieves the value of a variable from the current storage environment. */
|
||||
/* The following function works in about like the original, except that it
|
||||
ignores the length parameter (the value needs to be a NUL-terminated string)
|
||||
and requires rexxsyslib.library V45. */
|
||||
LONG
|
||||
GetRexxVar(struct RexxMsg *context,STRPTR variable_name,STRPTR * return_value)
|
||||
SetRexxVar(struct RexxMsg *message,STRPTR variable_name,STRPTR value,ULONG length)
|
||||
{
|
||||
struct Environment * environment;
|
||||
struct NexxStr * ns;
|
||||
struct NexxStr * compound_string;
|
||||
struct NexxStr * stem_string;
|
||||
LONG is_literal;
|
||||
LONG error;
|
||||
LONG result;
|
||||
|
||||
(*return_value) = NULL;
|
||||
|
||||
if(!CheckRexxMsg(context))
|
||||
/* The following uses a function which was added to rexxsyslib.library V45.
|
||||
We therefore have a minimum library version requirement. */
|
||||
if(RexxSysBase == NULL || RexxSysBase->lib_Version < 45 || NOT IsRexxMsg((struct Message *)message))
|
||||
{
|
||||
error = ERR10_010; /* invalid message packet */
|
||||
result = ERR10_010; /* invalid message packet */
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Find the current storage environment. */
|
||||
_CurrentEnv(context->rm_TaskBlock,&environment);
|
||||
result = SetRexxVarFromMsg(variable_name,value,message);
|
||||
|
||||
/* Create the stem and component parts. */
|
||||
error = TypeString(variable_name,environment,&compound_string,&stem_string);
|
||||
if(error != 0)
|
||||
goto out;
|
||||
out:
|
||||
|
||||
/* Look up the value. NOTE: _FetchValue() will free the two 'struct NexxStr *' provided. */
|
||||
_FetchValue(environment,stem_string,compound_string,NULL,&is_literal,&ns);
|
||||
|
||||
/* If this is not a literal, return a pointer to the string. */
|
||||
if(!is_literal)
|
||||
(*return_value) = (STRPTR)ns->ns_Buff;
|
||||
|
||||
error = 0;
|
||||
|
||||
out:
|
||||
|
||||
return(error);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Assigns a value to a variable in the current storage environment. */
|
||||
LONG
|
||||
SetRexxVar(struct RexxMsg *context,STRPTR variable_name,STRPTR value,LONG length)
|
||||
{
|
||||
struct Environment * environment;
|
||||
struct NexxStr * compound_string;
|
||||
struct NexxStr * stem_string;
|
||||
struct Node * symbol_table_node;
|
||||
struct NexxStr *value_string;
|
||||
LONG error;
|
||||
|
||||
/* Make sure the value string is not too long */
|
||||
if(length > 65535)
|
||||
{
|
||||
error = ERR10_009; /* symbol or string too long */
|
||||
goto out;
|
||||
}
|
||||
|
||||
if(!CheckRexxMsg(context))
|
||||
{
|
||||
error = ERR10_010; /* invalid message packet */
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Find the current storage environment. */
|
||||
_CurrentEnv(context->rm_TaskBlock,&environment);
|
||||
|
||||
/* Create the stem and compound parts */
|
||||
error = TypeString(variable_name,environment,&compound_string,&stem_string);
|
||||
if(error != 0)
|
||||
goto out;
|
||||
|
||||
/* Locate or create the symbol node. NOTE: _EnterSymbol() will put the two 'struct NexxStr *' into
|
||||
the symbol table. It is not nececessary to free them. */
|
||||
symbol_table_node = _EnterSymbol(environment,stem_string,compound_string);
|
||||
if(symbol_table_node == NULL)
|
||||
{
|
||||
error = ERR10_003; /* no memory available */
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Create the value string. */
|
||||
value_string = MakeString(environment,value,length);
|
||||
if(value_string == NULL)
|
||||
{
|
||||
error = ERR10_003; /* no memory available */
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Install the value string. */
|
||||
_SetValue(environment,value_string,symbol_table_node);
|
||||
|
||||
error = 0;
|
||||
|
||||
out:
|
||||
|
||||
return(error);
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ rm -rf $dir_name
|
||||
# Create the directory, copy all the libraries, header files
|
||||
# and release note files inside.
|
||||
mkdir $dir_name
|
||||
cp -pR lib $dir_name
|
||||
cp -pR lib.threadsafe $dir_name
|
||||
cp -pR include $dir_name
|
||||
cp -a lib $dir_name
|
||||
cp -a lib.threadsafe $dir_name
|
||||
cp -a include $dir_name
|
||||
cp changes $dir_name
|
||||
|
||||
# Delete the CVS data from the include directory
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 205
|
||||
#define DATE "21.8.2010"
|
||||
#define VERS "c.lib 1.205"
|
||||
#define VSTRING "c.lib 1.205 (21.8.2010)\r\n"
|
||||
#define VERSTAG "\0$VER: c.lib 1.205 (21.8.2010)"
|
||||
#define REVISION 202
|
||||
#define DATE "16.1.2007"
|
||||
#define VERS "c.lib 1.202"
|
||||
#define VSTRING "c.lib 1.202 (16.1.2007)\r\n"
|
||||
#define VERSTAG "\0$VER: c.lib 1.202 (16.1.2007)"
|
||||
|
||||
@@ -1 +1 @@
|
||||
205
|
||||
202
|
||||
|
||||
@@ -1,86 +1,3 @@
|
||||
c.lib 1.205 (21.8.2010)
|
||||
|
||||
- Added dlclose(), dlerror(), dlopen() and dlsym() functions, which are
|
||||
available only under OS4. There is a variant of dlopen() in libunix.a
|
||||
which will perform a path name conversion. Note that these functions
|
||||
will not work in the thread-safe variant of the library because it
|
||||
would be unwise to tinker with the currently running program's binary.
|
||||
|
||||
- Added support for ELF shared objects and libraries. This is implemented through
|
||||
constructor/destructor functions, which means that you can use this
|
||||
functionality even in Amiga Exec style shared libraries, with the proper
|
||||
library initialization code to invoke the constructor/destructor functions
|
||||
for you.
|
||||
|
||||
- Updated uname() to recognize AmigaOS 4.1.
|
||||
|
||||
- The translation from Unix to Amiga path names did not properly process
|
||||
multiple occurences of "/./" in the path name. Thanks go to Steven Solie
|
||||
for finding the issue.
|
||||
|
||||
- The detection of "/./" and "/../" patterns in Unix path names to be
|
||||
translated into Amiga path names did not test if it was overrunning
|
||||
the end of the string.
|
||||
|
||||
- If strcmp(), strncmp() and memcmp() detect a pair of different
|
||||
characters, then the function result must be calculated as if the
|
||||
characters were of type "unsigned char". This is a requirement
|
||||
according to the ISO 'C' (1994) standard. Thanks go to Georg Steger
|
||||
for finding the issue.
|
||||
|
||||
- The definitions for INT_MIN, INT_MAX and UINT_MAX in <limits.h> no
|
||||
longer use long integer types, as prompted by Steven Solie.
|
||||
|
||||
|
||||
c.lib 1.204 (11.11.2008)
|
||||
|
||||
- The memory allocated by malloc() and friends is now of type MEMF_PRIVATE
|
||||
under OS4 and beyond. The AmigaOS 2.x/3.x compatible code will still
|
||||
use MEMF_ANY in the same situation, though. Other uses of MEMF_ANY have
|
||||
been replaced as well where MEMF_PRIVATE would have made better sense.
|
||||
|
||||
- I/O buffers allocated are now aligned according to the CPU cache line size,
|
||||
if the operating system can supply such detailed information.
|
||||
|
||||
- unsetenv() now returns a status value.
|
||||
|
||||
- Corrected the function prototype for wcspbrk().
|
||||
|
||||
- Added function prototypes for mbrtowc_l(), wcscoll_l(), wcscspn() and wcsrchr().
|
||||
|
||||
|
||||
c.lib 1.203 (28.4.2008)
|
||||
|
||||
- Added 68k stubs to amiga_rexxvars.c for the OS4 build to use. The new code now
|
||||
works just about exactly like the amiga.lib RVI code used to do, which means
|
||||
that there is no artificial length limit for the number of characters a string
|
||||
retrieved may have, and the code is largely reentrant.
|
||||
|
||||
- To work around a bug in the Roadshow TCP/IP stack (since fixed), the waitselect()
|
||||
function now substitutes a 10 microsecond timeout for a zero length timeout.
|
||||
|
||||
- isatty() no longer crashes if passed a socket rather than a file.
|
||||
|
||||
- Rewrote the GetRexxVar()/SetRexxVar() functions (mostly) in 'C', using available
|
||||
code as a reference. The 68k stubs currently only work for the 68k version of
|
||||
the library, and a solution for the OS4 build still needs to be found. The code
|
||||
is currently untested, but it should be complete.
|
||||
|
||||
- The printf() family now ignores argument specifications, as in "%2$d %1$d",
|
||||
which are used for localization on some platforms. This is a non-standard
|
||||
feature and the way clib2 treats it for now is just intended to avoid
|
||||
trouble while performing the conversion.
|
||||
|
||||
- [tboeckel]: when compiling amiga_rexxvars.c for m68k/OS3 the GetRexxVarFromMsg()
|
||||
and SetRexxVarFromMsg() can no longer cause linkage errors if the header files
|
||||
predate the SDK for OS 3.5.
|
||||
|
||||
- [jlangner]: the log() and log10() functions always returned -inf() even if the
|
||||
arguments was within the valid range for a log() function. Using DBL_EPSILON as
|
||||
the threshold was not correct as EPSILON is 2.2204460492503131E-16 whereas
|
||||
values like 1E-200 are still valid double values for a log().
|
||||
|
||||
|
||||
c.lib 1.202 (16.1.2007)
|
||||
|
||||
- Added llrint() function contributed by Henning Nielsen Lund. Thank you
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: crtbegin.c,v 1.13 2010-08-21 11:37:03 obarthel Exp $
|
||||
* $Id: crtbegin.c,v 1.11 2006-09-22 09:02:51 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -35,14 +35,9 @@ void _fini(void);
|
||||
void
|
||||
_init(void)
|
||||
{
|
||||
extern void shared_obj_init(void);
|
||||
int num_ctors,i;
|
||||
int j;
|
||||
|
||||
/* The shared objects need to be set up before any local
|
||||
constructors are invoked. */
|
||||
shared_obj_init();
|
||||
|
||||
for(i = 1, num_ctors = 0 ; __CTOR_LIST__[i] != NULL ; i++)
|
||||
num_ctors++;
|
||||
|
||||
@@ -55,7 +50,6 @@ _init(void)
|
||||
void
|
||||
_fini(void)
|
||||
{
|
||||
extern void shared_obj_exit(void);
|
||||
int num_dtors,i;
|
||||
static int j;
|
||||
|
||||
@@ -64,10 +58,6 @@ _fini(void)
|
||||
|
||||
while(j++ < num_dtors)
|
||||
__DTOR_LIST__[j]();
|
||||
|
||||
/* The shared objects need to be cleaned up after all local
|
||||
destructors have been invoked. */
|
||||
shared_obj_exit();
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 205
|
||||
#define DATE "21.8.2010"
|
||||
#define VERS "debug.lib 1.205"
|
||||
#define VSTRING "debug.lib 1.205 (21.8.2010)\r\n"
|
||||
#define VERSTAG "\0$VER: debug.lib 1.205 (21.8.2010)"
|
||||
#define REVISION 202
|
||||
#define DATE "16.1.2007"
|
||||
#define VERS "debug.lib 1.202"
|
||||
#define VSTRING "debug.lib 1.202 (16.1.2007)\r\n"
|
||||
#define VERSTAG "\0$VER: debug.lib 1.202 (16.1.2007)"
|
||||
|
||||
@@ -1 +1 @@
|
||||
205
|
||||
202
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* $Id: dlfcn.h,v 1.2 2010-08-21 11:37:03 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2010 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Documentation and source code for this library, and the most recent library
|
||||
* build are available from <http://sourceforge.net/projects/clib2>.
|
||||
*
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _DLFCN_H
|
||||
#define _DLFCN_H
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The following is not part of the ISO 'C' (1994) standard. */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The shared object API is available only on AmigaOS 4.0. */
|
||||
#if defined(__amigaos4__)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* We only support a subset of the flags available on Unix systems. */
|
||||
#define RTLD_LAZY 1
|
||||
#define RTLD_NOW 2
|
||||
#define RTLD_LOCAL 4
|
||||
#define RTLD_GLOBAL 8
|
||||
#define RTLD_DEFAULT ((void *)0)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern int dlclose(void * __handle);
|
||||
extern const char * dlerror(void);
|
||||
extern void * dlopen(const char * __path_name,int __mode);
|
||||
extern void * dlsym(void * __handle,const char * __symbol_name);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __amigaos4__ */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* _DLFCN_H */
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: limits.h,v 1.12 2010-08-20 15:33:36 obarthel Exp $
|
||||
* $Id: limits.h,v 1.11 2006-01-08 12:06:14 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -78,9 +78,9 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define INT_MIN (-2147483647 - 1)
|
||||
#define INT_MAX 2147483647
|
||||
#define UINT_MAX 4294967295U
|
||||
#define INT_MIN (-2147483647L - 1)
|
||||
#define INT_MAX 2147483647L
|
||||
#define UINT_MAX 4294967295UL
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define SSIZE_MAX LONG_MAX
|
||||
#define SSIZE_MAX 2147483647L
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib.h,v 1.19 2008-04-30 14:34:03 obarthel Exp $
|
||||
* $Id: stdlib.h,v 1.18 2006-11-13 09:51:53 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -195,7 +195,7 @@ extern int rand_r(unsigned int * seed);
|
||||
|
||||
extern int setenv(const char *name, const char *value, int overwrite);
|
||||
extern int putenv(const char *string);
|
||||
extern int unsetenv(const char *name);
|
||||
extern void unsetenv(const char *name);
|
||||
extern char * mktemp(char * name_template);
|
||||
extern int mkstemp(char *name_template);
|
||||
extern char * mkdtemp(char *name_template);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: wchar.h,v 1.8 2008-04-30 14:34:03 obarthel Exp $
|
||||
* $Id: wchar.h,v 1.7 2006-01-08 12:06:14 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -97,7 +97,7 @@ extern wchar_t * wcsncpy(wchar_t *dest, const wchar_t *src, size_t n);
|
||||
extern size_t wcslen(const wchar_t *s);
|
||||
extern wchar_t * wcschr(const wchar_t *s, wchar_t c);
|
||||
extern size_t wcsspn(const wchar_t *s, const wchar_t *set);
|
||||
extern wchar_t *wcspbrk(const wchar_t *s, const wchar_t *set);
|
||||
extern wchar_t wcspbrk(const wchar_t *s, const wchar_t *set);
|
||||
extern wchar_t *wcstok(wchar_t *str, const wchar_t *set);
|
||||
extern wchar_t *wcsstr(const wchar_t *src, const wchar_t *sub);
|
||||
|
||||
@@ -179,11 +179,6 @@ extern size_t wcsftime(wchar_t *s, size_t maxsize, const wchar_t *format, const
|
||||
extern long long wcstoll(const wchar_t *str, wchar_t **ptr, int base);
|
||||
extern unsigned long long wcstoull(const wchar_t *str, wchar_t **ptr, int base);
|
||||
|
||||
extern size_t mbrtowc_l(wchar_t *restrict pwc, const char *restrict s, size_t n, mbstate_t *restrict ps, locale_t loc);
|
||||
extern int wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t loc);
|
||||
extern size_t wcscspn(const wchar_t *ws1, const wchar_t *ws2);
|
||||
extern wchar_t * wcsrchr(const wchar_t *ws, wchar_t wc);
|
||||
|
||||
#endif /* __STDC_VERSION__ && __STDC_VERSION__ >= 199901L */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: wctype.h,v 1.8 2008-04-30 14:41:28 obarthel Exp $
|
||||
* $Id: wctype.h,v 1.7 2006-01-08 12:06:14 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -68,7 +68,7 @@ extern int iswdigit(wint_t c);
|
||||
extern int iswxdigit(wint_t c);
|
||||
|
||||
extern int iswgraph(wint_t c);
|
||||
extern int iswpunct(wint_t c);
|
||||
extern int iswpunc(wint_t c);
|
||||
extern int iswprint(wint_t c);
|
||||
|
||||
extern int iswlower(wint_t c);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: libc.gmk,v 1.8 2010-08-21 11:37:03 obarthel Exp $
|
||||
# $Id: libc.gmk,v 1.4 2006-11-16 14:39:23 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@@ -205,10 +205,6 @@ C_LIB := \
|
||||
stdlib_div.o \
|
||||
stdlib_divsi3.o \
|
||||
stdlib_divsi4.o \
|
||||
stdlib_dlclose.o \
|
||||
stdlib_dlerror.o \
|
||||
stdlib_dlopen.o \
|
||||
stdlib_dlsym.o \
|
||||
stdlib_dosbase.o \
|
||||
stdlib_exit.o \
|
||||
stdlib_free.o \
|
||||
@@ -252,7 +248,6 @@ C_LIB := \
|
||||
stdlib_setjmp.o \
|
||||
stdlib_set_errno.o \
|
||||
stdlib_set_process_window.o \
|
||||
stdlib_shared_objs.o \
|
||||
stdlib_shell_escape.o \
|
||||
stdlib_showerror.o \
|
||||
stdlib_srand.o \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: libunix.gmk,v 1.4 2010-08-21 10:59:34 obarthel Exp $
|
||||
# $Id: libunix.gmk,v 1.3 2006-11-13 09:25:28 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@@ -57,7 +57,6 @@ UNIX_LIB := \
|
||||
stdlib_alloca_cleanup.o \
|
||||
stdlib_alloca_trap.o \
|
||||
stdlib_arg.o \
|
||||
stdlib_dlopen.o \
|
||||
stdlib_expand_wildcard.o \
|
||||
stdlib_expand_wildcard_check.o \
|
||||
stdlib_getmemstats.o \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 205
|
||||
#define DATE "21.8.2010"
|
||||
#define VERS "m.lib 1.205"
|
||||
#define VSTRING "m.lib 1.205 (21.8.2010)\r\n"
|
||||
#define VERSTAG "\0$VER: m.lib 1.205 (21.8.2010)"
|
||||
#define REVISION 202
|
||||
#define DATE "16.1.2007"
|
||||
#define VERS "m.lib 1.202"
|
||||
#define VSTRING "m.lib 1.202 (16.1.2007)\r\n"
|
||||
#define VERSTAG "\0$VER: m.lib 1.202 (16.1.2007)"
|
||||
|
||||
@@ -1 +1 @@
|
||||
205
|
||||
202
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 205
|
||||
#define DATE "21.8.2010"
|
||||
#define VERS "m881.lib 1.205"
|
||||
#define VSTRING "m881.lib 1.205 (21.8.2010)\r\n"
|
||||
#define VERSTAG "\0$VER: m881.lib 1.205 (21.8.2010)"
|
||||
#define REVISION 202
|
||||
#define DATE "16.1.2007"
|
||||
#define VERS "m881.lib 1.202"
|
||||
#define VSTRING "m881.lib 1.202 (16.1.2007)\r\n"
|
||||
#define VERSTAG "\0$VER: m881.lib 1.202 (16.1.2007)"
|
||||
|
||||
@@ -1 +1 @@
|
||||
205
|
||||
202
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: math_log.c,v 1.10 2007-11-08 11:23:53 damato Exp $
|
||||
* $Id: math_log.c,v 1.9 2006-01-08 12:04:23 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -244,7 +244,7 @@ log(double x)
|
||||
{
|
||||
double result;
|
||||
|
||||
if(x > 0)
|
||||
if(x > DBL_EPSILON)
|
||||
{
|
||||
result = __log(x);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: math_log10.c,v 1.9 2007-11-08 11:23:53 damato Exp $
|
||||
* $Id: math_log10.c,v 1.8 2006-01-08 12:04:23 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -186,7 +186,7 @@ log10(double x)
|
||||
{
|
||||
double result;
|
||||
|
||||
if(x > 0)
|
||||
if(x > DBL_EPSILON)
|
||||
{
|
||||
result = __log10(x);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: mount_convertinfo.c,v 1.7 2008-04-16 07:38:10 obarthel Exp $
|
||||
* $Id: mount_convertinfo.c,v 1.6 2006-01-08 12:04:24 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -42,20 +42,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef ID_BUSY_DISK
|
||||
#define ID_BUSY_DISK (0x42555359L) /* 'BUSY' */
|
||||
#endif /* ID_LONGNAME_DOS_DISK */
|
||||
|
||||
#ifndef ID_LONGNAME_DOS_DISK
|
||||
#define ID_LONGNAME_DOS_DISK (0x444F5306L) /* 'DOS\6' */
|
||||
#endif /* ID_LONGNAME_DOS_DISK */
|
||||
|
||||
#ifndef ID_LONGNAME_FFS_DISK
|
||||
#define ID_LONGNAME_FFS_DISK (0x444F5307L) /* 'DOS\7' */
|
||||
#endif /* ID_LONGNAME_FFS_DISK */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void
|
||||
__convert_info_to_statfs(struct InfoData * id,struct statfs * f)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 205
|
||||
#define DATE "21.8.2010"
|
||||
#define VERS "net.lib 1.205"
|
||||
#define VSTRING "net.lib 1.205 (21.8.2010)\r\n"
|
||||
#define VERSTAG "\0$VER: net.lib 1.205 (21.8.2010)"
|
||||
#define REVISION 202
|
||||
#define DATE "16.1.2007"
|
||||
#define VERS "net.lib 1.202"
|
||||
#define VSTRING "net.lib 1.202 (16.1.2007)\r\n"
|
||||
#define VERSTAG "\0$VER: net.lib 1.202 (16.1.2007)"
|
||||
|
||||
@@ -1 +1 @@
|
||||
205
|
||||
202
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: socket_wait_select.c,v 1.4 2008-04-16 07:53:40 obarthel Exp $
|
||||
* $Id: socket_wait_select.c,v 1.3 2006-04-10 15:08:10 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -44,22 +44,8 @@
|
||||
int
|
||||
waitselect(int num_fds,fd_set *read_fds,fd_set *write_fds,fd_set *except_fds,struct timeval *timeout,unsigned long * signal_mask)
|
||||
{
|
||||
struct timeval other_timeout;
|
||||
int result;
|
||||
|
||||
/* This is a workaround for a bug in the Roadshow TCP/IP stack which has been
|
||||
fixed long ago: if a signal is received, as given in the 'signal_mask'
|
||||
parameter, the WaitSelect() function may not detect it if the timeout
|
||||
is zero. */
|
||||
if(signal_mask != NULL && timeout != NULL && timeout->tv_secs == 0 && timeout->tv_micro == 0)
|
||||
{
|
||||
/* Substitute a ten microsecond timeout. */
|
||||
other_timeout.tv_secs = 0;
|
||||
other_timeout.tv_micro = 10000;
|
||||
|
||||
timeout = &other_timeout;
|
||||
}
|
||||
|
||||
result = __select(num_fds,read_fds,write_fds,except_fds,timeout,signal_mask);
|
||||
|
||||
return(result);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_file_init.c,v 1.13 2008-09-04 12:07:58 obarthel Exp $
|
||||
* $Id: stdio_file_init.c,v 1.12 2006-11-16 14:39:23 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -76,11 +76,6 @@ struct WBStartup * NOCOMMON __WBenchMsg;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* CPU cache line size; used to align I/O buffers for best performance. */
|
||||
ULONG __cache_line_size = 32;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
FILE_DESTRUCTOR(workbench_exit)
|
||||
{
|
||||
ENTER();
|
||||
@@ -220,24 +215,6 @@ FILE_CONSTRUCTOR(stdio_file_init)
|
||||
|
||||
ENTER();
|
||||
|
||||
/* Figure out the proper address alignment for the memory we are
|
||||
going to use for disk I/O. The default is 32 bytes, which should
|
||||
be OK for most cases. If possible, ask the operating system for
|
||||
its preferred alignment size. */
|
||||
#if defined(__amigaos4__)
|
||||
{
|
||||
if(SysBase->lib_Version >= 50)
|
||||
{
|
||||
uint32 physical_alignment = 0;
|
||||
|
||||
GetCPUInfoTags(GCIT_CacheLineSize,&physical_alignment,TAG_DONE);
|
||||
|
||||
if(__cache_line_size < physical_alignment)
|
||||
__cache_line_size = physical_alignment;
|
||||
}
|
||||
}
|
||||
#endif /* __amigaos4__ */
|
||||
|
||||
/* If we were invoked from Workbench, set up the standard I/O streams. */
|
||||
if(__WBenchMsg != NULL)
|
||||
{
|
||||
@@ -278,7 +255,7 @@ FILE_CONSTRUCTOR(stdio_file_init)
|
||||
PROFILE_ON();
|
||||
|
||||
/* Allocate a little more memory than necessary. */
|
||||
buffer = malloc(BUFSIZ + (__cache_line_size - 1));
|
||||
buffer = malloc(BUFSIZ + (CACHE_LINE_SIZE-1));
|
||||
if(buffer == NULL)
|
||||
goto out;
|
||||
|
||||
@@ -323,7 +300,7 @@ FILE_CONSTRUCTOR(stdio_file_init)
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
/* Align the buffer start address to a cache line boundary. */
|
||||
aligned_buffer = (char *)((ULONG)(buffer + (__cache_line_size-1)) & ~(__cache_line_size-1));
|
||||
aligned_buffer = (char *)((ULONG)(buffer + (CACHE_LINE_SIZE-1)) & ~(CACHE_LINE_SIZE-1));
|
||||
|
||||
__initialize_fd(__fd[i],__fd_hook_entry,default_file,fd_flags,fd_lock);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_grow_file.c,v 1.8 2008-09-04 12:07:58 obarthel Exp $
|
||||
* $Id: stdio_grow_file.c,v 1.7 2006-11-16 14:39:23 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -90,7 +90,7 @@ __grow_file_size(struct fd * fd,int num_bytes)
|
||||
/* Allocate a little more memory than required to allow for
|
||||
* the buffer to be aligned to a cache line boundary.
|
||||
*/
|
||||
buffer = malloc((size_t)buffer_size + (__cache_line_size-1));
|
||||
buffer = malloc((size_t)buffer_size + (CACHE_LINE_SIZE-1));
|
||||
if(buffer == NULL)
|
||||
{
|
||||
SHOWMSG("not enough memory for write buffer");
|
||||
@@ -100,7 +100,7 @@ __grow_file_size(struct fd * fd,int num_bytes)
|
||||
}
|
||||
|
||||
/* Align the buffer to a cache line boundary. */
|
||||
aligned_buffer = (unsigned char *)(((ULONG)(buffer + (__cache_line_size-1))) & ~(__cache_line_size-1));
|
||||
aligned_buffer = (unsigned char *)(((ULONG)(buffer + (CACHE_LINE_SIZE-1))) & ~(CACHE_LINE_SIZE-1));
|
||||
|
||||
memset(aligned_buffer,0,(size_t)buffer_size);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_headers.h,v 1.31 2008-09-04 12:07:58 obarthel Exp $
|
||||
* $Id: stdio_headers.h,v 1.30 2006-11-16 14:39:23 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -156,6 +156,18 @@ struct iob;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* CPU cache line size; used for alignment purposes with some data structures.
|
||||
This should be determined dynamically rather than preset here. For the
|
||||
68040/68060 the cache line size is 16 bytes, for the PowerPC G4 it's
|
||||
32 bytes and 128 bytes (gross!) for the PowerPC G5. */
|
||||
#if defined(__PPC__)
|
||||
#define CACHE_LINE_SIZE 32UL
|
||||
#else
|
||||
#define CACHE_LINE_SIZE 16UL
|
||||
#endif /* __PPC__ */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The directory entry type a socket is identified with (in a FileInfoBlock). */
|
||||
#define ST_SOCKET (31082002)
|
||||
|
||||
@@ -387,11 +399,6 @@ extern BOOL NOCOMMON __no_standard_io;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* CPU cache line size; used to align I/O buffers for best performance. */
|
||||
extern ULONG __cache_line_size;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/*extern int __iob_write_buffer_is_full(struct iob * file);*/
|
||||
|
||||
#define __iob_write_buffer_is_full(file) \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_openiob.c,v 1.15 2008-09-04 12:07:58 obarthel Exp $
|
||||
* $Id: stdio_openiob.c,v 1.14 2006-01-08 12:04:24 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -133,7 +133,7 @@ __open_iob(const char *filename, const char *mode, int file_descriptor, int slot
|
||||
SHOWMSG("allocating file buffer");
|
||||
|
||||
/* Allocate a little more memory than necessary. */
|
||||
buffer = malloc(BUFSIZ + (__cache_line_size-1));
|
||||
buffer = malloc(BUFSIZ + (CACHE_LINE_SIZE-1));
|
||||
if(buffer == NULL)
|
||||
{
|
||||
SHOWMSG("that didn't work");
|
||||
@@ -143,7 +143,7 @@ __open_iob(const char *filename, const char *mode, int file_descriptor, int slot
|
||||
}
|
||||
|
||||
/* Align the buffer start address to a cache line boundary. */
|
||||
aligned_buffer = (char *)((ULONG)(buffer + (__cache_line_size-1)) & ~(__cache_line_size-1));
|
||||
aligned_buffer = (char *)((ULONG)(buffer + (CACHE_LINE_SIZE-1)) & ~(CACHE_LINE_SIZE-1));
|
||||
|
||||
if(file_descriptor < 0)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_popen.c,v 1.10 2008-05-07 09:33:55 obarthel Exp $
|
||||
* $Id: stdio_popen.c,v 1.9 2006-01-08 12:04:24 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -154,9 +154,7 @@ popen(const char *command, const char *type)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* The current PIPE: device only supports unidirectional connections. Worse: even if
|
||||
a PIPE: device with bidirectional connection support were available, we would
|
||||
be unable to detect this property. */
|
||||
/* The current PIPE: device only supports unidirectional connections. */
|
||||
if((type[1] == '+') || (type[1] != '\0' && type[2] == '+'))
|
||||
{
|
||||
D(("unsupported access mode '%s'",type));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_setvbuf.c,v 1.11 2008-09-04 12:07:58 obarthel Exp $
|
||||
* $Id: stdio_setvbuf.c,v 1.10 2006-09-22 09:02:51 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -123,7 +123,7 @@ setvbuf(FILE *stream,char *buf,int bufmode,size_t size)
|
||||
if(size > 0 && buf == NULL)
|
||||
{
|
||||
/* Allocate a little more memory than necessary. */
|
||||
new_buffer = malloc(size + (__cache_line_size-1));
|
||||
new_buffer = malloc(size + (CACHE_LINE_SIZE-1));
|
||||
if(new_buffer == NULL)
|
||||
{
|
||||
__set_errno(ENOBUFS);
|
||||
@@ -170,7 +170,7 @@ setvbuf(FILE *stream,char *buf,int bufmode,size_t size)
|
||||
file->iob_CustomBuffer = new_buffer;
|
||||
|
||||
/* Align the buffer start address to a cache line boundary. */
|
||||
new_buffer = (char *)((ULONG)(new_buffer + (__cache_line_size-1)) & ~(__cache_line_size-1));
|
||||
new_buffer = (char *)((ULONG)(new_buffer + (CACHE_LINE_SIZE-1)) & ~(CACHE_LINE_SIZE-1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_vfprintf.c,v 1.26 2008-03-10 15:28:11 obarthel Exp $
|
||||
* $Id: stdio_vfprintf.c,v 1.25 2006-11-13 09:32:28 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -143,12 +143,8 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
||||
int output_len;
|
||||
const char *prefix;
|
||||
char prefix_buffer[8];
|
||||
int argument_digits;
|
||||
int argument_number;
|
||||
int argument_index;
|
||||
int result = EOF;
|
||||
int len = 0;
|
||||
int i;
|
||||
int c;
|
||||
|
||||
#if defined(FLOATING_POINT_SUPPORT)
|
||||
@@ -207,36 +203,6 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If a string of digits, terminated by a '$' character appears here,
|
||||
it indicates which argument should be accessed. We evaluate this
|
||||
data but for now will ignore it altogether. */
|
||||
argument_index = argument_number = argument_digits = 0;
|
||||
|
||||
for(i = 0 ; format[i] != '\0' ; i++)
|
||||
{
|
||||
if(format[i] == '$')
|
||||
{
|
||||
if(argument_digits > 0)
|
||||
{
|
||||
argument_index = argument_number;
|
||||
|
||||
format = &format[i+1];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else if ('0' <= format[i] && format[i] <= '9')
|
||||
{
|
||||
argument_number = (10 * argument_number) + (format[i] - '0');
|
||||
|
||||
argument_digits++;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
format_flags = 0;
|
||||
fill_character = ' ';
|
||||
|
||||
@@ -806,6 +772,7 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
||||
int max_digits = -1;
|
||||
int exponent = 0;
|
||||
int digit;
|
||||
int i;
|
||||
|
||||
/* This takes care of the sign. */
|
||||
if(v < 0.0)
|
||||
@@ -1385,6 +1352,8 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
output_len = precision;
|
||||
|
||||
for(i = 0 ; i < precision ; i++)
|
||||
@@ -1563,6 +1532,8 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
||||
|
||||
if(FLAG_IS_SET(format_flags,FORMATF_LeftJustified))
|
||||
{
|
||||
int i;
|
||||
|
||||
if(prefix != NULL)
|
||||
{
|
||||
for(i = 0 ; prefix[i] != '\0' ; i++)
|
||||
@@ -1619,6 +1590,8 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
/* If we have to add the prefix later, make sure that
|
||||
we don't add too many fill characters in front of
|
||||
it now. */
|
||||
@@ -1671,6 +1644,7 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(i = 0 ; i < output_len ; i++)
|
||||
{
|
||||
if(__putc(output_buffer[i],stream,buffer_mode) == EOF)
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* $Id: stdlib_dlclose.c,v 1.2 2010-08-21 11:37:03 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2010 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _STDLIB_HEADERS_H
|
||||
#include "stdlib_headers.h"
|
||||
#endif /* _STDLIB_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The shared object API is available only on AmigaOS 4.0. */
|
||||
#if defined(__amigaos4__)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <libraries/elf.h>
|
||||
#include <proto/elf.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern struct ElfIFace * __IElf;
|
||||
extern Elf32_Handle __dl_elf_handle;
|
||||
extern Elf32_Error __elf_error_code;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int dlclose(void * handle)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
if(__dl_elf_handle != NULL)
|
||||
{
|
||||
struct ElfIFace * IElf = __IElf;
|
||||
Elf32_Error error;
|
||||
|
||||
error = DLClose(__dl_elf_handle,handle);
|
||||
if(error != ELF32_NO_ERROR)
|
||||
{
|
||||
__elf_error_code = error;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
result = 0;
|
||||
|
||||
out:
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __amigaos4__ */
|
||||
@@ -1,132 +0,0 @@
|
||||
/*
|
||||
* $Id: stdlib_dlerror.c,v 1.2 2010-08-21 11:37:03 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2010 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _STDLIB_HEADERS_H
|
||||
#include "stdlib_headers.h"
|
||||
#endif /* _STDLIB_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The shared object API is available only on AmigaOS 4.0. */
|
||||
#if defined(__amigaos4__)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <libraries/elf.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern Elf32_Error __elf_error_code;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
const char * dlerror(void)
|
||||
{
|
||||
const char * result;
|
||||
|
||||
switch(__elf_error_code)
|
||||
{
|
||||
case ELF32_NO_ERROR:
|
||||
|
||||
result = NULL;
|
||||
break;
|
||||
|
||||
case ELF32_OUT_OF_MEMORY:
|
||||
|
||||
result = "out of memory";
|
||||
break;
|
||||
|
||||
case ELF32_INVALID_HANDLE:
|
||||
|
||||
result = "invalid handle";
|
||||
break;
|
||||
|
||||
case ELF32_NO_MORE_RELOCS:
|
||||
|
||||
result = "no more relocs";
|
||||
break;
|
||||
|
||||
case ELF32_SECTION_NOT_LOADED:
|
||||
|
||||
result = "section not loaded";
|
||||
break;
|
||||
|
||||
case ELF32_UNKNOWN_RELOC:
|
||||
|
||||
result = "unknown reloc";
|
||||
break;
|
||||
|
||||
case ELF32_READ_ERROR:
|
||||
|
||||
result = "read error";
|
||||
break;
|
||||
|
||||
case ELF32_INVALID_SDA_BASE:
|
||||
|
||||
result = "invalid SDA base";
|
||||
break;
|
||||
|
||||
case ELF32_SYMBOL_NOT_FOUND:
|
||||
|
||||
result = "symbol not found";
|
||||
break;
|
||||
|
||||
case ELF32_INVALID_NAME:
|
||||
|
||||
result = "invalid name";
|
||||
break;
|
||||
|
||||
case ELF32_REQUIRED_OBJECT_MISSING:
|
||||
|
||||
result = "required object missing";
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
result = "unknown error";
|
||||
break;
|
||||
}
|
||||
|
||||
/* Calling dlerror() will clear the error code. */
|
||||
__elf_error_code = ELF32_NO_ERROR;
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __amigaos4__ */
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
* $Id: stdlib_dlopen.c,v 1.2 2010-08-21 11:37:03 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2010 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _STDLIB_HEADERS_H
|
||||
#include "stdlib_headers.h"
|
||||
#endif /* _STDLIB_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The shared object API is available only on AmigaOS 4.0. */
|
||||
#if defined(__amigaos4__)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <libraries/elf.h>
|
||||
#include <proto/elf.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern struct ElfIFace * __IElf;
|
||||
extern Elf32_Handle __dl_elf_handle;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void * dlopen(const char * path_name,int mode)
|
||||
{
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
struct name_translation_info path_name_nti;
|
||||
#endif /* UNIX_PATH_SEMANTICS */
|
||||
|
||||
void * result = NULL;
|
||||
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
{
|
||||
if(__unix_path_semantics)
|
||||
{
|
||||
if(path_name[0] == '\0')
|
||||
{
|
||||
SHOWMSG("no name given");
|
||||
|
||||
__set_errno(ENOENT);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0)
|
||||
goto out;
|
||||
|
||||
if(path_name_nti.is_root)
|
||||
{
|
||||
__set_errno(EACCES);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* UNIX_PATH_SEMANTICS */
|
||||
|
||||
if(__dl_elf_handle != NULL)
|
||||
{
|
||||
struct ElfIFace * IElf = __IElf;
|
||||
uint32 flags = 0;
|
||||
|
||||
if(mode & RTLD_LOCAL)
|
||||
flags = ELF32_RTLD_LOCAL;
|
||||
|
||||
if(mode & RTLD_GLOBAL)
|
||||
flags = ELF32_RTLD_GLOBAL;
|
||||
|
||||
result = DLOpen(__dl_elf_handle,path_name,flags);
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __amigaos4__ */
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* $Id: stdlib_dlsym.c,v 1.2 2010-08-21 11:37:03 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2010 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _STDLIB_HEADERS_H
|
||||
#include "stdlib_headers.h"
|
||||
#endif /* _STDLIB_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The shared object API is available only on AmigaOS 4.0. */
|
||||
#if defined(__amigaos4__)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <libraries/elf.h>
|
||||
#include <proto/elf.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern struct ElfIFace * __IElf;
|
||||
extern Elf32_Handle __dl_elf_handle;
|
||||
extern Elf32_Error __elf_error_code;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void * dlsym(void * handle,const char * symbol_name)
|
||||
{
|
||||
void * result = NULL;
|
||||
|
||||
if(__dl_elf_handle != NULL)
|
||||
{
|
||||
struct ElfIFace * IElf = __IElf;
|
||||
APTR symbol_data = NULL;
|
||||
Elf32_Error error;
|
||||
|
||||
error = DLSym(__dl_elf_handle,handle,symbol_name,&symbol_data);
|
||||
if(error != ELF32_NO_ERROR)
|
||||
{
|
||||
__elf_error_code = error;
|
||||
goto out;
|
||||
}
|
||||
|
||||
result = symbol_data;
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __amigaos4__ */
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_main.c,v 1.34 2008-09-30 14:09:00 obarthel Exp $
|
||||
* $Id: stdlib_main.c,v 1.33 2006-09-25 14:51:15 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -61,16 +61,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* On OS4 memory of type MEMF_ANY may not be paged out. Where this is desirable
|
||||
MEMF_PRIVATE should be used instead. */
|
||||
#ifdef __amigaos4__
|
||||
#define MEMORY_TYPE MEMF_PRIVATE
|
||||
#else
|
||||
#define MEMORY_TYPE MEMF_ANY
|
||||
#endif /* __amigaos4__ */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern int main(int arg_c,char ** arg_v);
|
||||
|
||||
/****************************************************************************/
|
||||
@@ -117,7 +107,7 @@ call_main(void)
|
||||
struct Process * this_process = (struct Process *)FindTask(NULL);
|
||||
UBYTE * arg_str = GetArgStr();
|
||||
size_t arg_str_len = strlen(arg_str);
|
||||
UBYTE * arg_str_copy = AllocVec(arg_str_len+1,MEMF_PRIVATE);
|
||||
UBYTE * arg_str_copy = AllocVec(arg_str_len+1,MEMF_ANY);
|
||||
UBYTE current_dir_name[256];
|
||||
|
||||
if(arg_str_copy != NULL && NameFromLock(this_process->pr_CurrentDir,current_dir_name,sizeof(current_dir_name)))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_malloc.c,v 1.20 2008-09-30 14:09:00 obarthel Exp $
|
||||
* $Id: stdlib_malloc.c,v 1.19 2006-01-08 12:04:25 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -143,21 +143,9 @@ __allocate_memory(size_t size,BOOL never_free,const char * UNUSED unused_file,in
|
||||
#endif /* __MEM_DEBUG */
|
||||
|
||||
if(__memory_pool != NULL)
|
||||
{
|
||||
mn = AllocPooled(__memory_pool,allocation_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(__amigaos4__)
|
||||
{
|
||||
mn = AllocMem(allocation_size,MEMF_PRIVATE);
|
||||
}
|
||||
#else
|
||||
{
|
||||
mn = AllocMem(allocation_size,MEMF_ANY);
|
||||
}
|
||||
#endif /* __amigaos4__ */
|
||||
}
|
||||
mn = AllocMem(allocation_size,MEMF_ANY);
|
||||
|
||||
if(mn == NULL)
|
||||
{
|
||||
@@ -413,7 +401,7 @@ STDLIB_CONSTRUCTOR(stdlib_memory_init)
|
||||
|
||||
#if defined(__amigaos4__)
|
||||
{
|
||||
__memory_pool = CreatePool(MEMF_PRIVATE,(ULONG)__default_pool_size,(ULONG)__default_puddle_size);
|
||||
__memory_pool = CreatePool(MEMF_ANY,(ULONG)__default_pool_size,(ULONG)__default_puddle_size);
|
||||
}
|
||||
#else
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_program_name.c,v 1.3 2008-09-30 14:09:00 obarthel Exp $
|
||||
* $Id: stdlib_program_name.c,v 1.2 2006-01-08 12:04:26 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -49,14 +49,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __amigaos4__
|
||||
#define MEMORY_TYPE MEMF_PRIVATE
|
||||
#else
|
||||
#define MEMORY_TYPE MEMF_ANY
|
||||
#endif /* __amigaos4__ */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static BOOL free_program_name;
|
||||
|
||||
/****************************************************************************/
|
||||
@@ -91,7 +83,7 @@ STDLIB_CONSTRUCTOR(stdlib_program_name_init)
|
||||
const size_t program_name_size = 256;
|
||||
|
||||
/* Make a copy of the current command name string. */
|
||||
__program_name = AllocVec((ULONG)program_name_size,MEMORY_TYPE);
|
||||
__program_name = AllocVec((ULONG)program_name_size,MEMF_ANY);
|
||||
if(__program_name == NULL)
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -1,192 +0,0 @@
|
||||
/*
|
||||
* $Id: stdlib_shared_objs.c,v 1.1 2010-08-21 11:37:03 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2010 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if defined(__amigaos4__)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDLIB_HEADERS_H
|
||||
#include "stdlib_headers.h"
|
||||
#endif /* _STDLIB_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <libraries/elf.h>
|
||||
#include <proto/elf.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* These are used to initialize the shared objects linked to this binary,
|
||||
and for the dlopen(), dlclose() and dlsym() functions. */
|
||||
struct Library * __ElfBase;
|
||||
struct ElfIFace * __IElf;
|
||||
|
||||
/* This is used with the dlopen(), dlclose() and dlsym() functions. */
|
||||
Elf32_Handle __dl_elf_handle;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* This is used to initialize the shared objects only. */
|
||||
static Elf32_Handle elf_handle;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void shared_obj_init(void);
|
||||
void shared_obj_exit(void);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static VOID close_elf_library(void)
|
||||
{
|
||||
if(__IElf != NULL)
|
||||
{
|
||||
DropInterface((struct Interface *)__IElf);
|
||||
__IElf = NULL;
|
||||
}
|
||||
|
||||
if(__ElfBase != NULL)
|
||||
{
|
||||
CloseLibrary(__ElfBase);
|
||||
__ElfBase = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static BOOL open_elf_library(void)
|
||||
{
|
||||
BOOL success = FALSE;
|
||||
|
||||
/* We need elf.library V52.2 or higher. */
|
||||
__ElfBase = OpenLibrary("elf.library",0);
|
||||
if(__ElfBase == NULL || (__ElfBase->lib_Version < 52) || (__ElfBase->lib_Version == 52 && __ElfBase->lib_Revision < 2))
|
||||
goto out;
|
||||
|
||||
__IElf = (struct ElfIFace *)GetInterface(__ElfBase,"main",1,NULL);
|
||||
if(__IElf == NULL)
|
||||
goto out;
|
||||
|
||||
success = TRUE;
|
||||
|
||||
out:
|
||||
|
||||
return(success);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void shared_obj_exit(void)
|
||||
{
|
||||
struct ElfIFace * IElf = __IElf;
|
||||
|
||||
#ifndef __THREAD_SAFE
|
||||
{
|
||||
/* Release this program's Elf handle, if we grabbed it below. */
|
||||
if(__dl_elf_handle != NULL)
|
||||
{
|
||||
CloseElfTags(__dl_elf_handle,
|
||||
CET_ReClose,TRUE,
|
||||
TAG_DONE);
|
||||
|
||||
__dl_elf_handle = NULL;
|
||||
}
|
||||
}
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
/* If we got what we wanted, trigger the destructors,
|
||||
etc. in the shared objects linked to this binary. */
|
||||
if(elf_handle != NULL)
|
||||
{
|
||||
InitSHLibs(elf_handle,FALSE);
|
||||
elf_handle = NULL;
|
||||
}
|
||||
|
||||
close_elf_library();
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void shared_obj_init(void)
|
||||
{
|
||||
if(open_elf_library())
|
||||
{
|
||||
struct ElfIFace * IElf = __IElf;
|
||||
BPTR segment_list;
|
||||
|
||||
/* Try to find the Elf handle associated with this
|
||||
program's segment list. */
|
||||
segment_list = GetProcSegList(NULL,GPSLF_CLI | GPSLF_SEG);
|
||||
if(segment_list != ZERO)
|
||||
{
|
||||
if(GetSegListInfoTags(segment_list,
|
||||
GSLI_ElfHandle,&elf_handle,
|
||||
TAG_DONE) == 1)
|
||||
{
|
||||
if(elf_handle != NULL)
|
||||
{
|
||||
/* Trigger the constructors, etc. in the shared objects
|
||||
linked to this binary. */
|
||||
InitSHLibs(elf_handle,TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Next: try to grab the Elf handle associated with the currently
|
||||
running process. This is not thread-safe! */
|
||||
#ifndef __THREAD_SAFE
|
||||
{
|
||||
segment_list = GetProcSegList(NULL,GPSLF_RUN);
|
||||
if(segment_list != ZERO)
|
||||
{
|
||||
Elf32_Handle handle = NULL;
|
||||
|
||||
if(GetSegListInfoTags(segment_list,
|
||||
GSLI_ElfHandle,&handle,
|
||||
TAG_DONE) == 1)
|
||||
{
|
||||
if(handle != NULL)
|
||||
{
|
||||
__dl_elf_handle = OpenElfTags(
|
||||
OET_ElfHandle,handle,
|
||||
TAG_DONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* __THREAD_SAFE */
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /*__amigaos4__ */
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_unsetenv.c,v 1.10 2008-04-30 16:32:49 obarthel Exp $
|
||||
* $Id: stdlib_unsetenv.c,v 1.8 2006-09-25 14:51:15 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -43,12 +43,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDIO_HEADERS_H
|
||||
#include "stdio_headers.h"
|
||||
#endif /* _STDIO_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDLIB_MEMORY_H
|
||||
#include "stdlib_memory.h"
|
||||
#endif /* _STDLIB_MEMORY_H */
|
||||
@@ -59,12 +53,10 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
void
|
||||
unsetenv(const char *name)
|
||||
{
|
||||
char * name_copy = NULL;
|
||||
int result = -1;
|
||||
LONG status;
|
||||
size_t i;
|
||||
|
||||
if(__check_abort_enabled)
|
||||
@@ -99,21 +91,11 @@ unsetenv(const char *name)
|
||||
}
|
||||
|
||||
PROFILE_OFF();
|
||||
status = DeleteVar((STRPTR)name,0);
|
||||
DeleteVar((STRPTR)name,0);
|
||||
PROFILE_ON();
|
||||
|
||||
if(status == DOSFALSE)
|
||||
{
|
||||
__set_errno(__translate_access_io_error_to_errno(IoErr()));
|
||||
goto out;
|
||||
}
|
||||
|
||||
result = 0;
|
||||
|
||||
out:
|
||||
|
||||
if(name_copy != NULL)
|
||||
free(name_copy);
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: string_memcmp.c,v 1.8 2010-08-20 15:33:36 obarthel Exp $
|
||||
* $Id: string_memcmp.c,v 1.7 2006-01-08 12:04:26 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -135,14 +135,7 @@ __memcmp(const char *m1,const char *m2,size_t len)
|
||||
{
|
||||
if((*m1) != (*m2))
|
||||
{
|
||||
int b1,b2;
|
||||
|
||||
/* The comparison must be performed as if the
|
||||
bytes were unsigned characters. */
|
||||
b1 = *(unsigned char *)m1;
|
||||
b2 = *(unsigned char *)m2;
|
||||
|
||||
result = b1 - b2;
|
||||
result = (*m1) - (*m2);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -192,12 +185,7 @@ memcmp(const void *ptr1, const void *ptr2, size_t len)
|
||||
{
|
||||
if((*m1) != (*m2))
|
||||
{
|
||||
int b1,b2;
|
||||
|
||||
b1 = *(unsigned char *)m1;
|
||||
b2 = *(unsigned char *)m2;
|
||||
|
||||
result = b1 - b2;
|
||||
result = (*m1) - (*m2);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: string_strcmp.c,v 1.5 2010-08-20 15:33:36 obarthel Exp $
|
||||
* $Id: string_strcmp.c,v 1.4 2006-01-08 12:04:27 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -62,8 +62,6 @@ strcmp(const char *s1, const char * s2)
|
||||
|
||||
if(s1 != s2)
|
||||
{
|
||||
int c1,c2;
|
||||
|
||||
while((*s1) == (*s2))
|
||||
{
|
||||
if((*s1) == '\0')
|
||||
@@ -73,12 +71,7 @@ strcmp(const char *s1, const char * s2)
|
||||
s2++;
|
||||
}
|
||||
|
||||
/* The comparison must be performed as if the
|
||||
characters were unsigned characters. */
|
||||
c1 = *(unsigned char *)s1;
|
||||
c2 = *(unsigned char *)s2;
|
||||
|
||||
result = c1 - c2;
|
||||
result = (*s1) - (*s2);
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: string_strncmp.c,v 1.5 2010-08-20 15:33:36 obarthel Exp $
|
||||
* $Id: string_strncmp.c,v 1.4 2006-01-08 12:04:27 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -78,14 +78,7 @@ strncmp(const char *s1, const char *s2, size_t n)
|
||||
}
|
||||
else
|
||||
{
|
||||
int c1,c2;
|
||||
|
||||
/* The comparison must be performed as if the
|
||||
characters were unsigned characters. */
|
||||
c1 = *(unsigned char *)s1;
|
||||
c2 = *(unsigned char *)s2;
|
||||
|
||||
result = c1 - c2;
|
||||
result = (*s1) - (*s2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: systeminfo_sysinfo.c,v 1.6 2010-08-20 15:33:36 obarthel Exp $
|
||||
* $Id: systeminfo_sysinfo.c,v 1.5 2006-09-22 09:02:51 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -141,7 +141,7 @@ sysinfo(int cmd,char *buf,long buflen)
|
||||
|
||||
GetCPUInfoTags(GCIT_VectorUnit,&vecu,TAG_DONE);
|
||||
|
||||
if(vecu == VECTORTYPE_ALTIVEC || vecu == 2 /* VECTORTYPE_VMX == 2 */) /* AltiVec and VMX are the same. */
|
||||
if(vecu == VECTORTYPE_ALTIVEC || vecu == VECTORTYPE_VMX) /* AltiVec and VMX are the same. */
|
||||
s = "ppc+altivec ppc common";
|
||||
else
|
||||
s = "ppc common";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_common_pathconf.c,v 1.4 2008-04-16 07:38:10 obarthel Exp $
|
||||
* $Id: unistd_common_pathconf.c,v 1.3 2006-09-21 09:24:20 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -55,18 +55,6 @@
|
||||
#define ID_RAWCON (0x52415700L) /* 'RAW\0' */
|
||||
#endif /* ID_RAWCON */
|
||||
|
||||
#ifndef ID_BUSY_DISK
|
||||
#define ID_BUSY_DISK (0x42555359L) /* 'BUSY' */
|
||||
#endif /* ID_LONGNAME_DOS_DISK */
|
||||
|
||||
#ifndef ID_LONGNAME_DOS_DISK
|
||||
#define ID_LONGNAME_DOS_DISK (0x444F5306L) /* 'DOS\6' */
|
||||
#endif /* ID_LONGNAME_DOS_DISK */
|
||||
|
||||
#ifndef ID_LONGNAME_FFS_DISK
|
||||
#define ID_LONGNAME_FFS_DISK (0x444F5307L) /* 'DOS\7' */
|
||||
#endif /* ID_LONGNAME_FFS_DISK */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
struct fs_info
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_isatty.c,v 1.10 2008-04-16 07:46:05 obarthel Exp $
|
||||
* $Id: unistd_isatty.c,v 1.9 2006-11-16 14:39:23 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -67,12 +67,6 @@ isatty(int file_descriptor)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET))
|
||||
{
|
||||
__set_errno(ENOTTY);
|
||||
goto out;
|
||||
}
|
||||
|
||||
__fd_lock(fd);
|
||||
|
||||
result = 1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_translateu2a.c,v 1.12 2010-08-20 15:33:36 obarthel Exp $
|
||||
* $Id: unistd_translateu2a.c,v 1.11 2006-10-03 16:36:47 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -50,7 +50,6 @@
|
||||
* ././foo
|
||||
* foo/./baz
|
||||
* foo/./bar/./baz
|
||||
* foo/./././bar
|
||||
* foo/.
|
||||
* /.
|
||||
* /tmp
|
||||
@@ -261,7 +260,7 @@ __translate_unix_to_amiga_path_name(char const ** name_ptr,struct name_translati
|
||||
D(("name = '%s' (line %ld)",name,__LINE__));
|
||||
}
|
||||
|
||||
/* Ditch all embedded '/./' ('foo/./bar' -> 'foo/bar', 'foo/././bar' -> 'foo/bar'). */
|
||||
/* Ditch all embedded '/./' ('foo/./bar' -> 'foo/bar'). */
|
||||
if(len > 2)
|
||||
{
|
||||
BOOL have_slash_dot_slash = FALSE;
|
||||
@@ -279,11 +278,10 @@ __translate_unix_to_amiga_path_name(char const ** name_ptr,struct name_translati
|
||||
{
|
||||
for(i = j = 0 ; i < len ; i++)
|
||||
{
|
||||
while(i < len - 2 && name[i] == '/' && name[i + 1] == '.' && name[i + 2] == '/')
|
||||
replace[j++] = name[i];
|
||||
|
||||
if(name[i] == '/' && name[i + 1] == '.' && name[i + 2] == '/')
|
||||
i += 2;
|
||||
|
||||
if(i < len)
|
||||
replace[j++] = name[i];
|
||||
}
|
||||
|
||||
len = j;
|
||||
@@ -476,10 +474,10 @@ __translate_unix_to_amiga_path_name(char const ** name_ptr,struct name_translati
|
||||
{
|
||||
for(i = j = 0 ; i < len ; i++)
|
||||
{
|
||||
if(i < len - 3 && name[i] == '/' && name[i + 1] == '.' && name[i + 2] == '.' && name[i + 3] == '/')
|
||||
i += 2;
|
||||
|
||||
replace[j++] = name[i];
|
||||
|
||||
if(name[i] == '/' && name[i + 1] == '.' && name[i + 2] == '.' && name[i + 3] == '/')
|
||||
i += 2;
|
||||
}
|
||||
|
||||
len = j;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 205
|
||||
#define DATE "21.8.2010"
|
||||
#define VERS "unix.lib 1.205"
|
||||
#define VSTRING "unix.lib 1.205 (21.8.2010)\r\n"
|
||||
#define VERSTAG "\0$VER: unix.lib 1.205 (21.8.2010)"
|
||||
#define REVISION 202
|
||||
#define DATE "16.1.2007"
|
||||
#define VERS "unix.lib 1.202"
|
||||
#define VSTRING "unix.lib 1.202 (16.1.2007)\r\n"
|
||||
#define VERSTAG "\0$VER: unix.lib 1.202 (16.1.2007)"
|
||||
|
||||
@@ -1 +1 @@
|
||||
205
|
||||
202
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: utsname_uname.c,v 1.8 2010-08-20 15:33:36 obarthel Exp $
|
||||
* $Id: utsname_uname.c,v 1.7 2006-11-13 09:25:28 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -135,9 +135,7 @@ uname(struct utsname *info)
|
||||
* 45.3 3.9-BB2
|
||||
*/
|
||||
|
||||
if (Version == 53)
|
||||
version_string = "4.1";
|
||||
else if (46 <= Version && Version <= 52)
|
||||
if (46 <= Version && Version <= 52)
|
||||
version_string = "4.0";
|
||||
else if (Version == 45)
|
||||
version_string = "3.9";
|
||||
|
||||
Reference in New Issue
Block a user