Skip to content

Commit

Permalink
Merge pull request #51 from afxgroup/beta1
Browse files Browse the repository at this point in the history
Beta1
  • Loading branch information
afxgroup authored Apr 26, 2022
2 parents 9cf912c + 588d4dc commit 3499196
Show file tree
Hide file tree
Showing 516 changed files with 14,734 additions and 16,285 deletions.
6 changes: 3 additions & 3 deletions GNUmakefile.os4
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CC := ppc-amigaos-gcc
AR := ppc-amigaos-ar -q
RANLIB := ppc-amigaos-ranlib

# if we are on AmigaOS use native commands
# On AmigaOS use native commands
ifeq ($(UNAME), AmigaOS)
COPY := copy
DELETE := delete all quiet force
Expand Down Expand Up @@ -88,9 +88,9 @@ INCLUDES := -I$(LIB_DIR)/include \
-I$(LIB_DIR)/mount

OPTIONS := -msdata=data -DHAVE_SYSV -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__CLIB2__ -Wa,-mregnames -fno-builtin -nostdlib
OPTIMIZE := -DNDEBUG -O3 -mmultiple -mupdate -mstrict-align
OPTIMIZE := -O2 -mmultiple -mupdate -mstrict-align -DNDEBUG

DEBUG := -gstabs
DEBUG := -gstabs #-DDEBUG

CFLAGS := $(COMPILER_VERSION) $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(MEMDEBUG) $(OPTIONS) $(INCLUDES) -D__USE_INLINE__
CFLAGS_N := $(COMPILER_VERSION) $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(MEMDEBUG) $(OPTIONS) $(INCLUDES)
Expand Down
58 changes: 25 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,36 +103,35 @@ Clib2 now contain also libauto with almost all OS4 components. We'll try to keep

Added resolv library to use dns functions.

### libdebug

To use `libdebug` you have to explicitly link `-lc` and then `-ldebug` otherwise you will have undefined references to debug library functions in libc because the C library is added
by the linker at the end of the link command (use gcc -v to see the verbose output)

### TODO

There is a memory leak at clib2 end needs to be tracked down
Try to use Microsoft <a href="https://github.com/microsoft/mimalloc">`mimalloc`</a> as memory allocator that should be faster and more better when there are multiple cores.
- There is a memory leak at clib2 end needs to be tracked down
- Try to use Microsoft <a href="https://github.com/microsoft/mimalloc">`mimalloc`</a> as memory allocator that should be faster and more better when there are multiple cores.
- Create a shared library

## Legal status

Because this library is in part based upon free software it would be uncourteous not to make it free software itself. The BSD license would probably be appropriate here.

The PowerPC math library is based in part on work by Sun Microsystems:

<pre>
========================================================================
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.

Developed at SunPro, a Sun Microsystems, Inc. business.
>The PowerPC math library is based in part on work by Sun Microsystems:
>
>Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
>
>Developed at SunPro, a Sun Microsystems, Inc. business.
Permission to use, copy, modify, and distribute this
software is freely granted, provided that this notice
is preserved.
========================================================================
</pre>

Most of (actual) wchar functions are based in part from newlib code.

<pre>
========================================================================
Copyright (c) 1990 The Regents of the University of California.
>Most of (actual) wchar functions are based in part from newlib code.
>Copyright (c) 1990 The Regents of the University of California.
All rights reserved.

Redistribution and use in source and binary forms are permitted
>
>Redistribution and use in source and binary forms are permitted
provided that the above copyright notice and this paragraph are
duplicated in all such forms and that any documentation,
and other materials related to such distribution and use
Expand All @@ -143,25 +142,20 @@ from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
========================================================================
</pre>

iconv code license

<pre>
========================================================================
Copyright (c) 2003-2004, Artem B. Bityuckiy

Redistribution and use in source and binary forms, with or without
>iconv code license
>Copyright (c) 2003-2004, Artem B. Bityuckiy
>
>Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
>1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
>2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
>
>THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
Expand All @@ -172,5 +166,3 @@ 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.
========================================================================
</pre>
9 changes: 6 additions & 3 deletions libc.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ C_DIRENT := \
dirent/dirfd.o \
dirent/opendir.o \
dirent/readdir.o \
dirent/readdir_r.o \
dirent/readdir64_r.o \
dirent/rewinddir.o

C_ICONV := \
Expand Down Expand Up @@ -418,6 +420,7 @@ C_STDLIB := \
stdlib/abort.o \
stdlib/abs.o \
stdlib/aligned_alloc.o \
stdlib/arith64.o \
stdlib/assertion_failure.o \
stdlib/atexit.o \
stdlib/atof.o \
Expand All @@ -442,7 +445,6 @@ C_STDLIB := \
stdlib/getexecname.o \
stdlib/getdefstacksize.o \
stdlib/getenv.o \
stdlib/getmemstats.o \
stdlib/getsp.o \
stdlib/get_errno.o \
stdlib/inistate.o \
Expand Down Expand Up @@ -510,7 +512,6 @@ C_STDLIB := \
stdlib/system.o \
stdlib/sysvbase.o \
stdlib/termination_message.o \
stdlib/threshold.o \
stdlib/utilitybase.o \
stdlib/udivsi3.o \
stdlib/udivsi4.o \
Expand Down Expand Up @@ -683,6 +684,7 @@ C_UNISTD := \
unistd/ftruncate.o \
unistd/ftruncate64.o \
unistd/getcwd.o \
unistd/getdomainname.o \
unistd/getlogin.o \
unistd/getlogin_r.o \
unistd/getopt.o \
Expand All @@ -705,6 +707,7 @@ C_UNISTD := \
unistd/realpath.o \
unistd/restorepathname.o \
unistd/setcurrentpath.o \
unistd/setdomainname.o \
unistd/sleep.o \
unistd/spawnv.o \
unistd/spawnvp.o \
Expand Down Expand Up @@ -907,4 +910,4 @@ $(OUTPUT_LIB)/libc.so : $(SOURCES_SHARED)
@$(MAKEDIR) $(@D)
@$(DELETE) $@
$(VERBOSE)echo "Making Shared \033[0;31m$@\033[0m"
$(VERBOSE)$(CC) -nostdlib -mcrt=clib2 -shared -o $@ $(OUTPUT_LIB)/shcrtbegin.o $^ $(OUTPUT_LIB)/shcrtend.o $(LOG_COMMAND)
$(VERBOSE)$(CC) -nostdlib -mcrt=clib2 -shared -o $@ $(OUTPUT_LIB)/shcrtbegin.o $^ $(OUTPUT_LIB)/shcrtend.o $(LOG_COMMAND) -ldebug
7 changes: 2 additions & 5 deletions libdebug.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ OUT_SHARED := $(BUILD_DIR)/obj.shared/libdebug
LIBS += $(OUTPUT_LIB)/libdebug.so \
$(OUTPUT_LIB)/libdebug.a

##############################################################################

DEBUG_LIB = \
debug/debug.lib_rev.o \
debug/debug.o \
Expand Down Expand Up @@ -49,11 +47,10 @@ SOURCES_STATIC = $(addprefix $(OUT_STATIC)/, $(DEBUG_LIB))

# Dependencies to rebuild if the library version changes

$(OUT_STATIC)/debug.lib_rev.o : debug/debug.lib_rev.c $(LIB_DIR)/debug/debug.lib_rev.h
$(OUT_SHARED)/debug.lib_rev.o : debug/debug.lib_rev.c $(LIB_DIR)/debug/debug.lib_rev.h
$(OUT_STATIC)/debug.lib_rev.o : $(LIB_DIR)/debug.lib_rev.c $(LIB_DIR)/debug.lib_rev.h
$(OUT_SHARED)/debug.lib_rev.o : $(LIB_DIR)/debug.lib_rev.c $(LIB_DIR)/debug.lib_rev.h

$(OUT_STATIC)/%.o : CFLAGS += $(LARGEDATA)

$(OUT_SHARED)/%.o : CFLAGS += $(PIC) $(LARGEDATA)

$(OUT_STATIC)/%.o : $(LIB_DIR)/%.c
Expand Down
8 changes: 4 additions & 4 deletions library/amiga/acrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ ACrypt(UBYTE *buffer, const UBYTE *password, const UBYTE *user) {

assert(buffer != NULL && password != NULL && user != NULL);

SHOWPOINTER(buffer);
SHOWSTRING(password);
SHOWSTRING(user);
SHOWPOINTER((char *)buffer);
SHOWSTRING((char *)password);
SHOWSTRING((char *)user);

if (buffer == NULL || password == NULL || user == NULL) {
SHOWMSG("invalid parameters");
Expand Down Expand Up @@ -58,7 +58,7 @@ ACrypt(UBYTE *buffer, const UBYTE *password, const UBYTE *user) {

buffer[OSIZE - 1] = '\0';

SHOWSTRING(buffer);
SHOWSTRING((char *)buffer);

result = buffer;

Expand Down
2 changes: 1 addition & 1 deletion library/amiga/hotkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ HotKey(CONST_STRPTR descr, struct MsgPort *port, LONG ID) {

result = filter;

out:
out:

if (result == NULL && filter != NULL)
DeleteCxObjAll(filter);
Expand Down
42 changes: 2 additions & 40 deletions library/crtbegin.c
Original file line number Diff line number Diff line change
@@ -1,43 +1,9 @@
/*
* crtbegin.c
*
* :ts=4
*
* Handles global constructors and destructors for the OS4 GCC build.
*
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
* 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.
*/
* $Id: crtbegin.c,v 1.3 2022-03-09 21:07:25 clib2devs Exp $
*/

#ifndef EXEC_TYPES_H

#include <exec/types.h>

#endif /* EXEC_TYPES_H */

#include <proto/exec.h>
Expand All @@ -46,15 +12,11 @@
#include <libraries/elf.h>

#ifndef _STDLIB_HEADERS_H

#include "stdlib_headers.h"

#endif /* _STDLIB_HEADERS_H */

#ifndef _MACROS_H

#include "macros.h"

#endif /* _MACROS_H */

/*
Expand Down
34 changes: 1 addition & 33 deletions library/crtend.c
Original file line number Diff line number Diff line change
@@ -1,38 +1,6 @@
/*
* $Id: crtend.c,v 1.2 2005-03-09 21:07:25 clib2devs Exp $
*
* :ts=4
*
* End markers for the CTOR and DTOR list.
*
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
* 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.
*/
*/

static void (*__CTOR_LIST__[1]) (void) __attribute__((used, section(".ctors"), aligned(sizeof(void (*)(void))) ));
static void (*__DTOR_LIST__[1]) (void) __attribute__((used, section(".dtors"), aligned(sizeof(void (*)(void))) ));
58 changes: 27 additions & 31 deletions library/ctype/isalnum.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,36 @@
#include "ctype_headers.h"
#endif /* _CTYPE_HEADERS_H */

/****************************************************************************/

#undef isalnum
#undef isalpha
#undef isdigit

/****************************************************************************/

int
isalnum(int c)
{
DECLARE_LOCALEBASE();
int result;

__locale_lock();

if(__locale_table[LC_CTYPE] != NULL)
{
assert( LocaleBase != NULL );

/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = IsAlNum(__locale_table[LC_CTYPE],(ULONG)(c & 255));
else
result = FALSE;
}
else
{
result = isalpha(c) || isdigit(c);
}

__locale_unlock();

return(result);
isalnum(int c) {
DECLARE_LOCALEBASE();
int result;

ENTER();
SHOWVALUE(c);

__locale_lock();

if (__locale_table[LC_CTYPE] != NULL) {
assert(LocaleBase != NULL);

/* The parameter must be either EOF or in the range of an
'unsigned char'. If it's not, then the behaviour is
undefined. */
if (c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX)))
result = IsAlNum(__locale_table[LC_CTYPE], (ULONG)(c & 255));
else
result = FALSE;
} else {
result = isalpha(c) || isdigit(c);
}

__locale_unlock();

RETURN(result);
return (result);
}
Loading

0 comments on commit 3499196

Please sign in to comment.