Skip to content

Commit

Permalink
Merge pull request #172 from AmigaLabs/beta10
Browse files Browse the repository at this point in the history
Merge Beta10 into master
  • Loading branch information
afxgroup committed Mar 21, 2024
2 parents 63f6298 + 66a8072 commit f5dbfa8
Show file tree
Hide file tree
Showing 39 changed files with 303 additions and 124 deletions.
1 change: 1 addition & 0 deletions GNUmakefile.os4
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ include libm.gmk
include libamiga.gmk
include libdebug.gmk
include libpthread.gmk
include libprofile.gmk
include libcrypt.gmk
include librt.gmk
include shared.gmk
Expand Down
5 changes: 1 addition & 4 deletions libc.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ C_STDIO := \
prng/srand.o \
prng/srand48.o \
prng/srandom.o \
stdio/__std.o \
stdio/asprintf.o \
stdio/change_fd_action.o \
stdio/change_fd_user_data.o \
Expand Down Expand Up @@ -952,10 +953,6 @@ C_LIBRARY := \

C_LIB := \
c.lib_rev.o \
profile/_mcount.o \
profile/profil.o \
profile/gmon.o \
profile/mcount.o \
shared_library/stubs.o \
unistd/getopt.o \
unistd/getopt_long.o \
Expand Down
3 changes: 0 additions & 3 deletions libcrypt.gmk
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#
# $Id: libcrypt.gmk,v 1.0 2022-07-09 10:09:48 clib4devs Exp $
#
# :ts=8
#
# -*- mode: makefile; -*-

OUT_STATIC := $(BUILD_DIR)/obj/libcrypt
OUT_SHARED := $(BUILD_DIR)/obj.shared/libcrypt
Expand Down
57 changes: 57 additions & 0 deletions libprofile.gmk
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#
# $Id: libprofile.gmk,v 1.1 2006-09-17 17:37:27 clib2devs Exp $
#

OUT_STATIC := $(BUILD_DIR)/obj/libprofile
OUT_SHARED := $(BUILD_DIR)/obj.shared/libprofile

ifeq ($(SHARED),yes)
LIBS += $(OUTPUT_LIB)/libprofile.so
endif
ifeq ($(STATIC),yes)
LIBS += $(OUTPUT_LIB)/libprofile.a
endif

PROFILE_LIB = \
profile/_mcount.o \
profile/profil.o \
profile/gmon.o \
profile/mcount.o

SOURCES_SHARED = $(addprefix $(OUT_SHARED)/, $(PROFILE_LIB))
SOURCES_STATIC = $(addprefix $(OUT_STATIC)/, $(PROFILE_LIB))

# Dependencies to rebuild if the library version changes

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

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

$(OUT_STATIC)/%.o : $(LIB_DIR)/%.S
$(VERBOSE)$(ASSEMBLE)

$(OUT_SHARED)/%.o : $(LIB_DIR)/%.S
$(VERBOSE)$(ASSEMBLE)

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

ifdef SPE
$(OUT_STATIC)/%.o : $(LIB_DIR)/%.c
$(VERBOSE)$(COMPILE_SPE)
$(OUT_SHARED)/%.o : $(LIB_DIR)/%.c
$(VERBOSE)$(COMPILE_SHARED_SPE)
else
$(OUT_STATIC)/%.o : $(LIB_DIR)/%.c
$(VERBOSE)$(COMPILE)
$(OUT_SHARED)/%.o : $(LIB_DIR)/%.c
$(VERBOSE)$(COMPILE_SHARED)
endif

$(OUTPUT_LIB)/libprofile.a : $(SOURCES_STATIC)
$(VERBOSE)$(MAKELIB)

$(OUTPUT_LIB)/libprofile.so : $(OUTPUT_LIB)/libc.so $(SOURCES_SHARED)
$(VERBOSE)$(MAKESHARED)
6 changes: 3 additions & 3 deletions library/c.lib_rev.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define REVISION 0
#define SUBREVISION 0

#define DATE "27.09.2023"
#define DATE "21.03.2024"
#define VERS "clib4.library 1.0.0"
#define VSTRING "clib4.library 1.0.0 (27.09.2023)\r\n"
#define VERSTAG "\0$VER: clib4.library 1.0.0 (27.09.2023)"
#define VSTRING "clib4.library 1.0.0 (21.03.2024)\r\n"
#define VERSTAG "\0$VER: clib4.library 1.0.0 (21.03.2024)"
24 changes: 11 additions & 13 deletions library/include/ctype.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#define _CTYPE_H

#include <features.h>
#include <dos.h>

__BEGIN_DECLS

Expand Down Expand Up @@ -48,18 +47,17 @@ extern int toascii(int c);

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

#define isalnum(c) ((__CLIB4->__ctype_table[(c) & 255] & (__CTYPE_DIGIT|__CTYPE_LOWER_CASE|__CTYPE_UPPER_CASE)) != 0)
#define isalpha(c) ((__CLIB4->__ctype_table[(c) & 255] & (__CTYPE_LOWER_CASE|__CTYPE_UPPER_CASE)) != 0)
#define iscntrl(c) ((__CLIB4->__ctype_table[(c) & 255] & __CTYPE_CONTROL) != 0)
#define isdigit(c) ((__CLIB4->__ctype_table[(c) & 255] & __CTYPE_DIGIT) != 0)
#define isxdigit(c) ((__CLIB4->__ctype_table[(c) & 255] & __CTYPE_HEX_DIGIT) != 0)
#define isgraph(c) ((__CLIB4->__ctype_table[(c) & 255] & (__CTYPE_DIGIT|__CTYPE_PUNCTUATION|__CTYPE_LOWER_CASE|__CTYPE_UPPER_CASE)) != 0)
#define ispunct(c) ((__CLIB4->__ctype_table[(c) & 255] & __CTYPE_PUNCTUATION) != 0)
#define isprint(c) ((__CLIB4->__ctype_table[(c) & 255] & __CTYPE_PRINTABLE) != 0)
#define islower(c) ((__CLIB4->__ctype_table[(c) & 255] & __CTYPE_LOWER_CASE) != 0)
#define isupper(c) ((__CLIB4->__ctype_table[(c) & 255] & __CTYPE_UPPER_CASE) != 0)
#define isspace(c) ((__CLIB4->__ctype_table[(c) & 255] & __CTYPE_WHITE_SPACE) != 0)
#define isblank(c) ((c) == ' ' || (c) == '\t')
static __inline int __isspace(int _c) {
return _c == ' ' || (unsigned)_c-'\t' < 5;
}

#define isalpha(a) (0 ? isalpha(a) : (((unsigned)(a)|32)-'a') < 26)
#define isdigit(a) (0 ? isdigit(a) : ((unsigned)(a)-'0') < 10)
#define islower(a) (0 ? islower(a) : ((unsigned)(a)-'a') < 26)
#define isupper(a) (0 ? isupper(a) : ((unsigned)(a)-'A') < 26)
#define isprint(a) (0 ? isprint(a) : ((unsigned)(a)-0x20) < 0x5f)
#define isgraph(a) (0 ? isgraph(a) : ((unsigned)(a)-0x21) < 0x5e)
#define isspace(a) __isspace(a)

#endif /* __cplusplus */

Expand Down
3 changes: 3 additions & 0 deletions library/include/dos.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#include <wchar.h>
#include <setjmp.h>
#include <resolv.h>
#include <exec/types.h>
#include <exec/lists.h>
#include <exec/semaphores.h>

/* Category name handling variables. */
#define NUM_LOCALES (LC_MAX + 1)
Expand Down
2 changes: 0 additions & 2 deletions library/include/malloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

#include <stddef.h>
#include <stdio.h>
#include <exec/lists.h>
#include <exec/nodes.h>

#define SIZE_ALIGN (4 * sizeof(size_t))
#define SIZE_MASK (-SIZE_ALIGN)
Expand Down
11 changes: 7 additions & 4 deletions library/include/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ __BEGIN_DECLS
#include <stdlib.h>
#endif /* _STDLIB_H */

#include <dos.h>

/* Natural log of 2 */
#define _M_LN2 (double) 0.693147180559945309417

Expand Down Expand Up @@ -88,8 +86,13 @@ extern float ynf(int n, float x);
/* HUGE_VALL is a 'long double' Infinity. */
#define HUGE_VALL (1.0L / 0.0L)

#define INFINITY ((const float) __CLIB4->__infinity)
#define NAN ((const float) __CLIB4->__nan)
# ifndef INFINITY
# define INFINITY (__builtin_inff())
# endif

# ifndef NAN
# define NAN (__builtin_nanf(""))
# endif

#define FP_INFINITE 0x01 /* -/+ infinity */
#define FP_NAN 0x02 /* not a number */
Expand Down
33 changes: 8 additions & 25 deletions library/include/pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,10 @@
#include <sys/types.h>
#include <sys/time.h>
#include <errno.h>
#include <exec/types.h>
#include <exec/semaphores.h>
#include <sched.h>
#include <features.h>

#ifdef __cplusplus
#ifdef __USE_AMIGAOS_NAMESPACE__
namespace AmigaOS {
#endif
extern "C" {
#endif
__BEGIN_DECLS

//
// POSIX options
Expand Down Expand Up @@ -150,7 +143,7 @@ struct pthread_mutexattr {
typedef struct pthread_mutexattr pthread_mutexattr_t;

struct pthread_mutex {
APTR mutex;
void* mutex; // APTR
int kind;
int incond;
struct Task *owner;
Expand Down Expand Up @@ -180,13 +173,13 @@ typedef struct pthread_condattr pthread_condattr_t;

struct pthread_cond {
int pad1;
struct SignalSemaphore semaphore;
struct MinList waiters;
void* semaphore; // SignalSemaphore
void* waiters; // MinList
};

typedef struct pthread_cond pthread_cond_t;

#define PTHREAD_COND_INITIALIZER {0, NULL_SEMAPHORE, NULL_MINLIST}
#define PTHREAD_COND_INITIALIZER {0, 0, 0}

//
// Barriers
Expand All @@ -200,12 +193,7 @@ struct pthread_barrierattr {

typedef struct pthread_barrierattr pthread_barrierattr_t;

struct pthread_barrier {
unsigned int curr_height;
unsigned int total_height;
pthread_cond_t breeched;
pthread_mutex_t lock;
};
struct pthread_barrier;

typedef struct pthread_barrier pthread_barrier_t;

Expand All @@ -220,7 +208,7 @@ struct pthread_rwlockattr {
typedef struct pthread_rwlockattr pthread_rwlockattr_t;

struct pthread_rwlock {
struct SignalSemaphore semaphore;
void* semaphore; // SignalSemaphore
};

typedef struct pthread_rwlock pthread_rwlock_t;
Expand Down Expand Up @@ -414,11 +402,6 @@ extern void pthread_cleanup_pop(int execute);

extern int pthread_kill(pthread_t thread, int sig);

#ifdef __cplusplus
}
#ifdef __USE_AMIGAOS_NAMESPACE__
}
#endif
#endif
__END_DECLS

#endif
9 changes: 1 addition & 8 deletions library/include/semaphore.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,7 @@
#undef SEM_FAILED
#define SEM_FAILED ((sem_t *)(-1))

struct sema
{
struct Node node;
int value;
int waiters_count;
pthread_mutex_t lock;
pthread_cond_t count_nonzero;
};
struct sema;

typedef struct sema sem_t;

Expand Down
6 changes: 0 additions & 6 deletions library/include/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@

#include <features.h>

#ifdef __cplusplus
#ifdef __USE_AMIGAOS_NAMESPACE__
#define pthread_attr_t AmigaOS::pthread_attr_t
#endif
#endif

__BEGIN_DECLS

typedef void (*_sig_func_ptr)(int);
Expand Down
11 changes: 6 additions & 5 deletions library/include/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include <sys/types.h>
#include <wchar.h>

#include <dos.h>

__BEGIN_DECLS

/* 'End of file' indicator returned by, for example, fgetc() */
Expand Down Expand Up @@ -116,9 +114,12 @@ typedef struct __sFILE FILE;
/****************************************************************************/

/* The three standard I/O streams */
#define stdin ((FILE *) __CLIB4->__iob[0])
#define stdout ((FILE *) __CLIB4->__iob[1])
#define stderr ((FILE *) __CLIB4->__iob[2])
extern FILE *__stdin();
extern FILE *__stdout();
extern FILE *__stderr();
#define stdin (__stdin())
#define stdout ( __stdout())
#define stderr (__stderr())

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

Expand Down
20 changes: 14 additions & 6 deletions library/include/sys/cdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,21 @@
#define __flexarr [0]

#ifdef __cplusplus
#define __BEGIN_DECLS \
extern "C" \
{
#define __END_DECLS }
#ifdef __USE_AMIGAOS_NAMESPACE__
#define __BEGIN_DECLS \
namespace AmigaOS { \
extern "C" \
{
#define __END_DECLS } }
#else
#define __BEGIN_DECLS \
extern "C" \
{
#define __END_DECLS }
#endif
#else
#define __BEGIN_DECLS
#define __END_DECLS
#define __BEGIN_DECLS
#define __END_DECLS
#endif

#ifndef __BOUNDED_POINTERS__
Expand Down
2 changes: 2 additions & 0 deletions library/include/sys/times.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

__BEGIN_DECLS

#include <sys/types.h>

/* Structure describing CPU time used by a process and its children. */
struct tms
{
Expand Down
6 changes: 0 additions & 6 deletions library/include/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,10 @@
#include <fcntl.h>
#endif /* _FCNTL_H */

#ifndef _STDIO_H
#include <stdio.h>
#endif /* _STDIO_H */

#ifndef _STDINT_H
#include <stdint.h>
#endif /* _STDINT_H */

#include <sys/select.h>

__BEGIN_DECLS

#define STDIN_FILENO 0
Expand Down
1 change: 1 addition & 0 deletions library/profile/gmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <proto/dos.h>
#include <proto/elf.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <macros.h>
#include <sys/uio.h>
Expand Down
Loading

0 comments on commit f5dbfa8

Please sign in to comment.