mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4cd7f3e32 |
1006
library/GNUmakefile.68k
Normal file
1006
library/GNUmakefile.68k
Normal file
File diff suppressed because it is too large
Load Diff
886
library/GNUmakefile.os4
Normal file
886
library/GNUmakefile.os4
Normal file
@@ -0,0 +1,886 @@
|
|||||||
|
#
|
||||||
|
# $Id: GNUmakefile.os4,v 1.3 2004-08-07 09:15:32 obarthel Exp $
|
||||||
|
#
|
||||||
|
# :ts=8
|
||||||
|
#
|
||||||
|
# -*- mode: makefile; -*-
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# You may have to tweak this for the native OS4 compiler
|
||||||
|
SDK_INCLUDE = $(V)/include
|
||||||
|
NET_INCLUDE = netinclude
|
||||||
|
|
||||||
|
# These are for the cross compiler
|
||||||
|
CC = ppc-amigaos-gcc
|
||||||
|
AR = ppc-amigaos-ar -q
|
||||||
|
RANLIB = ppc-amigaos-ranlib
|
||||||
|
COPY = cp
|
||||||
|
DELETE = rm -r
|
||||||
|
MAKEDIR = mkdir
|
||||||
|
|
||||||
|
# The following are for the native OS4 compiler
|
||||||
|
# CC = gcc
|
||||||
|
# AR = ar -q
|
||||||
|
# RANLIB = ranlib
|
||||||
|
# COPY = copy
|
||||||
|
# DELETE = delete all quiet
|
||||||
|
# MAKEDIR = makedir
|
||||||
|
|
||||||
|
MAKE = make -f GNUmakefile.os4
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
ifeq (,$(TYPE))
|
||||||
|
LIBC_OBJS = libc_objs
|
||||||
|
LIBUNIX_OBJS = libunix_objs
|
||||||
|
LIBM_OBJS = libm_objs
|
||||||
|
LIBSTACK_OBJS = libstack_objs
|
||||||
|
LIBNET_OBJS = libnet_objs
|
||||||
|
LIBDEBUG_OBJS = libdebug_objs
|
||||||
|
LIBAMIGA_OBJS = libamiga_objs
|
||||||
|
else
|
||||||
|
LIBC_OBJS = $(TYPE)/libc_objs
|
||||||
|
LIBUNIX_OBJS = $(TYPE)/libunix_objs
|
||||||
|
LIBM_OBJS = $(TYPE)/libm_objs
|
||||||
|
LIBSTACK_OBJS = $(TYPE)/libstack_objs
|
||||||
|
LIBNET_OBJS = $(TYPE)/libnet_objs
|
||||||
|
LIBDEBUG_OBJS = $(TYPE)/libdebug_objs
|
||||||
|
LIBAMIGA_OBJS = $(TYPE)/libamiga_objs
|
||||||
|
endif
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
%.o : %.c
|
||||||
|
@echo "Compiling $<"
|
||||||
|
@$(CC) -c $(CFLAGS) -DPPC_FLOATING_POINT_SUPPORT $<
|
||||||
|
|
||||||
|
$(LIBC_OBJS)/%.o : %.c
|
||||||
|
@echo "Compiling $< [$(TYPE):c]"
|
||||||
|
@$(CC) -o $(LIBC_OBJS)/$*.o -c $(CFLAGS) $<
|
||||||
|
|
||||||
|
$(LIBUNIX_OBJS)/%.o : %.c
|
||||||
|
@echo "Compiling $< [$(TYPE):unix]"
|
||||||
|
@$(CC) -o $(LIBUNIX_OBJS)/$*.o -c $(CFLAGS) -DUNIX_PATH_SEMANTICS $<
|
||||||
|
|
||||||
|
$(LIBM_OBJS)/%.o : %.c
|
||||||
|
@echo "Compiling $< [$(TYPE):m]"
|
||||||
|
@$(CC) -o $(LIBM_OBJS)/$*.o -c $(CFLAGS) -DPPC_FLOATING_POINT_SUPPORT $<
|
||||||
|
|
||||||
|
$(LIBSTACK_OBJS)/%.o : %.c
|
||||||
|
@echo "Compiling $< [$(TYPE):stack]"
|
||||||
|
@$(CC) -o $(LIBSTACK_OBJS)/$*.o -c $(CFLAGS) $<
|
||||||
|
|
||||||
|
$(LIBNET_OBJS)/%.o : %.c
|
||||||
|
@echo "Compiling $< [$(TYPE):net]"
|
||||||
|
@$(CC) -o $(LIBNET_OBJS)/$*.o -c $(CFLAGS) -I$(NET_INCLUDE) -DSOCKET_SUPPORT -DUSERGROUP_SUPPORT $<
|
||||||
|
|
||||||
|
$(LIBDEBUG_OBJS)/%.o : %.c
|
||||||
|
@echo "Compiling $< [$(TYPE):debug]"
|
||||||
|
@$(CC) -o $(LIBDEBUG_OBJS)/$*.o -c $(CFLAGS) $<
|
||||||
|
|
||||||
|
$(LIBAMIGA_OBJS)/%.o : %.c
|
||||||
|
@echo "Compiling $< [$(TYPE):amiga]"
|
||||||
|
@$(CC) -o $(LIBAMIGA_OBJS)/$*.o -c $(CFLAGS) $<
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
ifeq (small_data,$(TYPE))
|
||||||
|
CODE_TYPE := -msdata=sysv -DSMALL_DATA
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (large_data,$(TYPE))
|
||||||
|
CODE_TYPE := -msdata=data
|
||||||
|
endif
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
WARNINGS = \
|
||||||
|
-Wall -W -Wshadow -Wpointer-arith -Wsign-compare -Wmissing-prototypes \
|
||||||
|
-Wundef -Wbad-function-cast -Wmissing-declarations -Wconversion
|
||||||
|
|
||||||
|
INCLUDES = -Iinclude -I. -I$(SDK_INCLUDE)
|
||||||
|
OPTIONS = -DNDEBUG -DUSE_64_BIT_INTS -fno-builtin -D__USE_INLINE__ -Wa,-mregnames
|
||||||
|
OPTIMIZE = -O3 -fomit-frame-pointer -funroll-loops
|
||||||
|
#DEBUG = -g
|
||||||
|
|
||||||
|
CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_TYPE) $(INCLUDES)
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
C_LIB = \
|
||||||
|
c.lib_rev.o \
|
||||||
|
ctype_isalnum.o \
|
||||||
|
ctype_isalpha.o \
|
||||||
|
ctype_isascii.o \
|
||||||
|
ctype_iscntrl.o \
|
||||||
|
ctype_isdigit.o \
|
||||||
|
ctype_isgraph.o \
|
||||||
|
ctype_islower.o \
|
||||||
|
ctype_isprint.o \
|
||||||
|
ctype_ispunct.o \
|
||||||
|
ctype_isspace.o \
|
||||||
|
ctype_isupper.o \
|
||||||
|
ctype_isxdigit.o \
|
||||||
|
ctype_tolower.o \
|
||||||
|
ctype_toupper.o \
|
||||||
|
ctype_table.o \
|
||||||
|
dirent_closedir.o \
|
||||||
|
dirent_data.o \
|
||||||
|
dirent_opendir.o \
|
||||||
|
dirent_readdir.o \
|
||||||
|
dirent_rewinddir.o \
|
||||||
|
errno_data.o \
|
||||||
|
fcntl_close.o \
|
||||||
|
fcntl_creat.o \
|
||||||
|
fcntl_fcntl.o \
|
||||||
|
fcntl_lseek.o \
|
||||||
|
fcntl_open.o \
|
||||||
|
fcntl_read.o \
|
||||||
|
fcntl_write.o \
|
||||||
|
libgen_basename.o \
|
||||||
|
libgen_dirname.o \
|
||||||
|
locale_data.o \
|
||||||
|
locale_init_exit.o \
|
||||||
|
locale_localeconv.o \
|
||||||
|
locale_setlocale.o \
|
||||||
|
mount_convertinfo.o \
|
||||||
|
mount_fstatfs.o \
|
||||||
|
mount_statfs.o \
|
||||||
|
signal_checkabort.o \
|
||||||
|
signal_data.o \
|
||||||
|
signal_kill.o \
|
||||||
|
signal_raise.o \
|
||||||
|
signal_sigaddset.o \
|
||||||
|
signal_sigblock.o \
|
||||||
|
signal_sigemptyset.o \
|
||||||
|
signal_sigmask.o \
|
||||||
|
signal_signal.o \
|
||||||
|
signal_sigprocmask.o \
|
||||||
|
signal_sigsetmask.o \
|
||||||
|
stat_chmod.o \
|
||||||
|
stat_convertfileinfo.o \
|
||||||
|
stat_data.o \
|
||||||
|
stat_fchmod.o \
|
||||||
|
stat_fstat.o \
|
||||||
|
stat_lstat.o \
|
||||||
|
stat_mkdir.o \
|
||||||
|
stat_rmdir.o \
|
||||||
|
stat_stat.o \
|
||||||
|
stat_umask.o \
|
||||||
|
stdio_asprintf.o \
|
||||||
|
stdio_clearerr.o \
|
||||||
|
stdio_data.o \
|
||||||
|
stdio_dropiobreadbuffer.o \
|
||||||
|
stdio_duplicate_fd.o \
|
||||||
|
stdio_fclose.o \
|
||||||
|
stdio_fdhookentry.o \
|
||||||
|
stdio_feof.o \
|
||||||
|
stdio_ferror.o \
|
||||||
|
stdio_fflush.o \
|
||||||
|
stdio_flush.o \
|
||||||
|
stdio_fgetc.o \
|
||||||
|
stdio_fgetpos.o \
|
||||||
|
stdio_fgets.o \
|
||||||
|
stdio_filliobreadbuffer.o \
|
||||||
|
stdio_findvacantfdentry.o \
|
||||||
|
stdio_findvacantiobentry.o \
|
||||||
|
stdio_flushiobwritebuffer.o \
|
||||||
|
stdio_fopen.o \
|
||||||
|
stdio_fprintf.o \
|
||||||
|
stdio_fputc.o \
|
||||||
|
stdio_fputs.o \
|
||||||
|
stdio_fread.o \
|
||||||
|
stdio_freopen.o \
|
||||||
|
stdio_fscanf.o \
|
||||||
|
stdio_fseek.o \
|
||||||
|
stdio_fsetpos.o \
|
||||||
|
stdio_ftell.o \
|
||||||
|
stdio_fwrite.o \
|
||||||
|
stdio_getc.o \
|
||||||
|
stdio_getchar.o \
|
||||||
|
stdio_get_file_descriptor.o \
|
||||||
|
stdio_gets.o \
|
||||||
|
stdio_growfdtable.o \
|
||||||
|
stdio_growiobtable.o \
|
||||||
|
stdio_initializefd.o \
|
||||||
|
stdio_initializeiob.o \
|
||||||
|
stdio_init_exit.o \
|
||||||
|
stdio_iobhookentry.o \
|
||||||
|
stdio_locksemaphorename.o \
|
||||||
|
stdio_nostdio.o \
|
||||||
|
stdio_openiob.o \
|
||||||
|
stdio_perror.o \
|
||||||
|
stdio_popen.o \
|
||||||
|
stdio_printf.o \
|
||||||
|
stdio_putc.o \
|
||||||
|
stdio_putchar.o \
|
||||||
|
stdio_puts.o \
|
||||||
|
stdio_remove.o \
|
||||||
|
stdio_rename.o \
|
||||||
|
stdio_rewind.o \
|
||||||
|
stdio_scanf.o \
|
||||||
|
stdio_setbuf.o \
|
||||||
|
stdio_setvbuf.o \
|
||||||
|
stdio_snprintf.o \
|
||||||
|
stdio_sprintf.o \
|
||||||
|
stdio_sscanf.o \
|
||||||
|
stdio_sscanf_hook_entry.o \
|
||||||
|
stdio_tmpfile.o \
|
||||||
|
stdio_tmpnam.o \
|
||||||
|
stdio_translateioerror.o \
|
||||||
|
stdio_ungetc.o \
|
||||||
|
stdio_vasprintf.o \
|
||||||
|
stdio_vasprintf_hook_entry.o \
|
||||||
|
stdio_vfprintf.o \
|
||||||
|
stdio_vfscanf.o \
|
||||||
|
stdio_vprintf.o \
|
||||||
|
stdio_vsnprintf.o \
|
||||||
|
stdio_vsnprintf_hook_entry.o \
|
||||||
|
stdio_vsprintf.o \
|
||||||
|
stdio_vsprintf_hook_entry.o \
|
||||||
|
stdlib_abort.o \
|
||||||
|
stdlib_abs.o \
|
||||||
|
stdlib_alloca.o \
|
||||||
|
stdlib_assertion_failure.o \
|
||||||
|
stdlib_atexit.o \
|
||||||
|
stdlib_atoi.o \
|
||||||
|
stdlib_atol.o \
|
||||||
|
stdlib_bsearch.o \
|
||||||
|
stdlib_calloc.o \
|
||||||
|
stdlib_data.o \
|
||||||
|
stdlib_default_pool_size.o \
|
||||||
|
stdlib_default_puddle_size.o \
|
||||||
|
stdlib_destructor.o \
|
||||||
|
stdlib_disablerequesters.o \
|
||||||
|
stdlib_div.o \
|
||||||
|
stdlib_modsi3.o \
|
||||||
|
stdlib_divsi3.o \
|
||||||
|
stdlib_divsi4.o \
|
||||||
|
stdlib_umodsi3.o \
|
||||||
|
stdlib_udivsi3.o \
|
||||||
|
stdlib_udivsi4.o \
|
||||||
|
stdlib_exit.o \
|
||||||
|
stdlib_free.o \
|
||||||
|
stdlib_getenv.o \
|
||||||
|
stdlib_getsp.o \
|
||||||
|
stdlib_init_exit.o \
|
||||||
|
stdlib_labs.o \
|
||||||
|
stdlib_ldiv.o \
|
||||||
|
stdlib_getdefstacksize.o \
|
||||||
|
stdlib_stackargbytes.o \
|
||||||
|
stdlib_stack_usage.o \
|
||||||
|
stdlib_checkdetach.o \
|
||||||
|
stdlib_detach.o \
|
||||||
|
stdlib_isresident.o \
|
||||||
|
stdlib_sysbase.o \
|
||||||
|
stdlib_dosbase.o \
|
||||||
|
stdlib_machine_test.o \
|
||||||
|
stdlib_malloc.o \
|
||||||
|
stdlib_math.o \
|
||||||
|
stdlib_mkdtemp.o \
|
||||||
|
stdlib_mkstemp.o \
|
||||||
|
stdlib_mktemp.o \
|
||||||
|
stdlib_mulsi3.o \
|
||||||
|
stdlib_never_free.o \
|
||||||
|
stdlib_putenv.o \
|
||||||
|
stdlib_qsort.o \
|
||||||
|
stdlib_rand.o \
|
||||||
|
stdlib_realloc.o \
|
||||||
|
stdlib_red_black.o \
|
||||||
|
stdlib_setenv.o \
|
||||||
|
stdlib_setjmp.o \
|
||||||
|
stdlib_shell_escape.o \
|
||||||
|
stdlib_showerror.o \
|
||||||
|
stdlib_socket.o \
|
||||||
|
stdlib_srand.o \
|
||||||
|
stdlib_stackcheck.o \
|
||||||
|
stdlib_stackoverflow.o \
|
||||||
|
stdlib_stacksafezone.o \
|
||||||
|
stdlib_stacksize.o \
|
||||||
|
stdlib_startup.o \
|
||||||
|
stdlib_strtol.o \
|
||||||
|
stdlib_strtoul.o \
|
||||||
|
stdlib_swapstack.o \
|
||||||
|
stdlib_system.o \
|
||||||
|
stdlib_termination_message.o \
|
||||||
|
stdlib_threshold.o \
|
||||||
|
stdlib_unsetenv.o \
|
||||||
|
stdlib_usergroup.o \
|
||||||
|
stdlib_wildcard_expand.o \
|
||||||
|
strings_strcasecmp.o \
|
||||||
|
strings_strncasecmp.o \
|
||||||
|
string_bcmp.o \
|
||||||
|
string_bcopy.o \
|
||||||
|
string_bzero.o \
|
||||||
|
string_index.o \
|
||||||
|
string_memchr.o \
|
||||||
|
string_memcmp.o \
|
||||||
|
string_memcpy.o \
|
||||||
|
string_memmove.o \
|
||||||
|
string_memset.o \
|
||||||
|
string_rindex.o \
|
||||||
|
string_strcat.o \
|
||||||
|
string_strchr.o \
|
||||||
|
string_strcmp.o \
|
||||||
|
string_strcoll.o \
|
||||||
|
string_strcpy.o \
|
||||||
|
string_strcspn.o \
|
||||||
|
string_strdup.o \
|
||||||
|
string_strerror.o \
|
||||||
|
string_strlen.o \
|
||||||
|
string_strncat.o \
|
||||||
|
string_strncmp.o \
|
||||||
|
string_strncpy.o \
|
||||||
|
string_strpbrk.o \
|
||||||
|
string_strrchr.o \
|
||||||
|
string_strspn.o \
|
||||||
|
string_strstr.o \
|
||||||
|
string_strtok.o \
|
||||||
|
string_strxfrm.o \
|
||||||
|
time_asctime.o \
|
||||||
|
time_clock.o \
|
||||||
|
time_converttime.o \
|
||||||
|
time_ctime.o \
|
||||||
|
time_data.o \
|
||||||
|
time_gettimeofday.o \
|
||||||
|
time_gmtime.o \
|
||||||
|
time_localtime.o \
|
||||||
|
time_mktime.o \
|
||||||
|
time_numbertostring.o \
|
||||||
|
time_strftime.o \
|
||||||
|
time_time.o \
|
||||||
|
unistd_access.o \
|
||||||
|
unistd_chdir.o \
|
||||||
|
unistd_chown.o \
|
||||||
|
unistd_currentpathname.o \
|
||||||
|
unistd_data.o \
|
||||||
|
unistd_dup.o \
|
||||||
|
unistd_dup2.o \
|
||||||
|
unistd_fchown.o \
|
||||||
|
unistd_fdopen.o \
|
||||||
|
unistd_fileno.o \
|
||||||
|
unistd_ftruncate.o \
|
||||||
|
unistd_getcwd.o \
|
||||||
|
unistd_getopt.o \
|
||||||
|
unistd_getpid.o \
|
||||||
|
unistd_init_exit.o \
|
||||||
|
unistd_isatty.o \
|
||||||
|
unistd_lchown.o \
|
||||||
|
unistd_link.o \
|
||||||
|
unistd_readlink.o \
|
||||||
|
unistd_realpath.o \
|
||||||
|
unistd_sleep.o \
|
||||||
|
unistd_symlink.o \
|
||||||
|
unistd_truncate.o \
|
||||||
|
unistd_unlink.o \
|
||||||
|
utime_utime.o
|
||||||
|
|
||||||
|
|
||||||
|
UNIX_LIB = \
|
||||||
|
unix.lib_rev.o \
|
||||||
|
dirent_closedir.o \
|
||||||
|
dirent_data.o \
|
||||||
|
dirent_opendir.o \
|
||||||
|
dirent_readdir.o \
|
||||||
|
dirent_rewinddir.o \
|
||||||
|
fcntl_creat.o \
|
||||||
|
fcntl_fcntl.o \
|
||||||
|
fcntl_open.o \
|
||||||
|
mount_convertinfo.o \
|
||||||
|
mount_statfs.o \
|
||||||
|
stat_chmod.o \
|
||||||
|
stat_fstat.o \
|
||||||
|
stat_lstat.o \
|
||||||
|
stat_mkdir.o \
|
||||||
|
stat_rmdir.o \
|
||||||
|
stat_stat.o \
|
||||||
|
stdio_fdhookentry.o \
|
||||||
|
stdio_init_exit.o \
|
||||||
|
stdio_locksemaphorename.o \
|
||||||
|
stdio_openiob.o \
|
||||||
|
stdio_fflush.o \
|
||||||
|
stdio_fopen.o \
|
||||||
|
stdio_fopen.o \
|
||||||
|
stdio_popen.o \
|
||||||
|
stdio_remove.o \
|
||||||
|
stdio_rename.o \
|
||||||
|
stdlib_mkdtemp.o \
|
||||||
|
stdlib_mkstemp.o \
|
||||||
|
stdlib_mkstemp.o \
|
||||||
|
stdlib_mktemp.o \
|
||||||
|
stdlib_system.o \
|
||||||
|
unistd_access.o \
|
||||||
|
unistd_chdir.o \
|
||||||
|
unistd_chown.o \
|
||||||
|
unistd_getcwd.o \
|
||||||
|
unistd_lchown.o \
|
||||||
|
unistd_link.o \
|
||||||
|
unistd_readlink.o \
|
||||||
|
unistd_realpath.o \
|
||||||
|
unistd_restorepathname.o \
|
||||||
|
unistd_setcurrentpath.o \
|
||||||
|
unistd_strip_double_slash.o \
|
||||||
|
unistd_translatea2u.o \
|
||||||
|
unistd_translaterel.o \
|
||||||
|
unistd_translateu2a.o \
|
||||||
|
unistd_truncate.o \
|
||||||
|
unistd_unix_path_semantics.o \
|
||||||
|
unistd_unlink.o \
|
||||||
|
unistd_wildcard_expand.o \
|
||||||
|
utime_utime.o
|
||||||
|
|
||||||
|
MATH_LIB = \
|
||||||
|
math_acos.o \
|
||||||
|
math_asin.o \
|
||||||
|
math_atan.o \
|
||||||
|
math_atan2.o \
|
||||||
|
math_ceil.o \
|
||||||
|
math_cos.o \
|
||||||
|
math_cosh.o \
|
||||||
|
math_data.o \
|
||||||
|
math_exp.o \
|
||||||
|
math_fabs.o \
|
||||||
|
math_floor.o \
|
||||||
|
math_fmod.o \
|
||||||
|
math_frexp.o \
|
||||||
|
math_init_exit.o \
|
||||||
|
math_isnan.o \
|
||||||
|
math_isinf.o \
|
||||||
|
math_ldexp.o \
|
||||||
|
math_log.o \
|
||||||
|
math_log10.o \
|
||||||
|
math_modf.o \
|
||||||
|
math_pow.o \
|
||||||
|
math_rint.o \
|
||||||
|
math_rintf.o \
|
||||||
|
math_sin.o \
|
||||||
|
math_sinh.o \
|
||||||
|
math_sqrt.o \
|
||||||
|
math_tan.o \
|
||||||
|
math_tanh.o \
|
||||||
|
math_kernel_expm1.o \
|
||||||
|
math_kernel_scalbn.o \
|
||||||
|
math_kernel_tan.o \
|
||||||
|
math_kernel_cos.o \
|
||||||
|
math_kernel_rem_pio2.o \
|
||||||
|
math_kernel_sin.o \
|
||||||
|
stdio_asprintf.o \
|
||||||
|
stdio_flush.o \
|
||||||
|
stdio_fprintf.o \
|
||||||
|
stdio_fscanf.o \
|
||||||
|
stdio_printf.o \
|
||||||
|
stdio_scanf.o \
|
||||||
|
stdio_snprintf.o \
|
||||||
|
stdio_sprintf.o \
|
||||||
|
stdio_sscanf.o \
|
||||||
|
stdio_vasprintf.o \
|
||||||
|
stdio_vfprintf.o \
|
||||||
|
stdio_vfscanf.o \
|
||||||
|
stdio_vfscanf.o \
|
||||||
|
stdio_vprintf.o \
|
||||||
|
stdio_vsnprintf.o \
|
||||||
|
stdio_vsprintf.o \
|
||||||
|
stdlib_atof.o \
|
||||||
|
stdlib_machine_test.o \
|
||||||
|
stdlib_strtod.o \
|
||||||
|
time_difftime.o
|
||||||
|
|
||||||
|
MATH_LIB_IEEE = \
|
||||||
|
m.lib_rev.o \
|
||||||
|
$(MATH_LIB) \
|
||||||
|
math_adddf3.o \
|
||||||
|
math_addsf3.o \
|
||||||
|
math_divdf3.o \
|
||||||
|
math_divsf3.o \
|
||||||
|
math_eqdf2.o \
|
||||||
|
math_eqsf2.o \
|
||||||
|
math_extendsfdf2.o \
|
||||||
|
math_fixdfsi.o \
|
||||||
|
math_fixsfsi.o \
|
||||||
|
math_fixunsdfsi.o \
|
||||||
|
math_fixunssfsi.o \
|
||||||
|
math_floatsidf.o \
|
||||||
|
math_floatsisf.o \
|
||||||
|
math_gedf2.o \
|
||||||
|
math_gesf2.o \
|
||||||
|
math_gtdf2.o \
|
||||||
|
math_gtsf2.o \
|
||||||
|
math_ledf2.o \
|
||||||
|
math_lesf2.o \
|
||||||
|
math_ltdf2.o \
|
||||||
|
math_ltsf2.o \
|
||||||
|
math_muldf3.o \
|
||||||
|
math_mulsf3.o \
|
||||||
|
math_nedf2.o \
|
||||||
|
math_negdf2.o \
|
||||||
|
math_negsf2.o \
|
||||||
|
math_nesf2.o \
|
||||||
|
math_subdf3.o \
|
||||||
|
math_subsf3.o \
|
||||||
|
math_truncdfsf2.o
|
||||||
|
|
||||||
|
STACK_LIB = \
|
||||||
|
stack.lib_rev.o \
|
||||||
|
stdlib_setjmp.o \
|
||||||
|
stdlib_stackextension.o \
|
||||||
|
stdlib_stackminframe.o \
|
||||||
|
stdlib_stackoverflow.o \
|
||||||
|
stdlib_stacksafezone.o
|
||||||
|
|
||||||
|
NET_LIB = \
|
||||||
|
net.lib_rev.o \
|
||||||
|
socket_accept.o \
|
||||||
|
socket_bind.o \
|
||||||
|
socket_connect.o \
|
||||||
|
socket_data.o \
|
||||||
|
socket_gethostbyaddr.o \
|
||||||
|
socket_gethostbyname.o \
|
||||||
|
socket_gethostid.o \
|
||||||
|
socket_gethostname.o \
|
||||||
|
socket_getnetbyaddr.o \
|
||||||
|
socket_getnetbyname.o \
|
||||||
|
socket_getpeername.o \
|
||||||
|
socket_getprotobyname.o \
|
||||||
|
socket_getprotobynumber.o \
|
||||||
|
socket_getservbyname.o \
|
||||||
|
socket_getservbyport.o \
|
||||||
|
socket_getsockname.o \
|
||||||
|
socket_getsockopt.o \
|
||||||
|
socket_get_descriptor.o \
|
||||||
|
socket_inet_addr.o \
|
||||||
|
socket_inet_aton.o \
|
||||||
|
socket_inet_lnaof.o \
|
||||||
|
socket_inet_makeaddr.o \
|
||||||
|
socket_inet_netof.o \
|
||||||
|
socket_inet_network.o \
|
||||||
|
socket_inet_ntoa.o \
|
||||||
|
socket_init_exit.o \
|
||||||
|
socket_ioctl.o \
|
||||||
|
socket_isdaemon.o \
|
||||||
|
socket_listen.o \
|
||||||
|
socket_recv.o \
|
||||||
|
socket_recvfrom.o \
|
||||||
|
socket_recvmsg.o \
|
||||||
|
socket_select.o \
|
||||||
|
socket_send.o \
|
||||||
|
socket_sendmsg.o \
|
||||||
|
socket_sendto.o \
|
||||||
|
socket_setsockopt.o \
|
||||||
|
socket_shutdown.o \
|
||||||
|
socket_socket.o \
|
||||||
|
socket_hook_entry.o \
|
||||||
|
socket_hstrerror.o \
|
||||||
|
usergroup_crypt.o \
|
||||||
|
usergroup_data.o \
|
||||||
|
usergroup_endgrent.o \
|
||||||
|
usergroup_endpwent.o \
|
||||||
|
usergroup_getegid.o \
|
||||||
|
usergroup_geteuid.o \
|
||||||
|
usergroup_getgid.o \
|
||||||
|
usergroup_getgrent.o \
|
||||||
|
usergroup_getgrgid.o \
|
||||||
|
usergroup_getgrnam.o \
|
||||||
|
usergroup_getgroups.o \
|
||||||
|
usergroup_getpass.o \
|
||||||
|
usergroup_getpwent.o \
|
||||||
|
usergroup_getpwnam.o \
|
||||||
|
usergroup_getpwuid.o \
|
||||||
|
usergroup_getuid.o \
|
||||||
|
usergroup_initgroups.o \
|
||||||
|
usergroup_init_exit.o \
|
||||||
|
usergroup_rootmode.o \
|
||||||
|
usergroup_setegid.o \
|
||||||
|
usergroup_seteuid.o \
|
||||||
|
usergroup_setgid.o \
|
||||||
|
usergroup_setgrent.o \
|
||||||
|
usergroup_setgroups.o \
|
||||||
|
usergroup_setpwent.o \
|
||||||
|
usergroup_setregid.o \
|
||||||
|
usergroup_setreuid.o \
|
||||||
|
usergroup_setsid.o \
|
||||||
|
usergroup_setuid.o \
|
||||||
|
stat_umask.o
|
||||||
|
|
||||||
|
DEBUG_LIB = \
|
||||||
|
debug.lib_rev.o \
|
||||||
|
debug.o \
|
||||||
|
debug_level.o \
|
||||||
|
debug_cmpstrexec.o \
|
||||||
|
debug_kcmpstr.o \
|
||||||
|
debug_kdofmt.o \
|
||||||
|
debug_kgetc.o \
|
||||||
|
debug_kgetch1.o \
|
||||||
|
debug_kgetch2.o \
|
||||||
|
debug_kgetchar1.o \
|
||||||
|
debug_kgetchar2.o \
|
||||||
|
debug_kgetnum1.o \
|
||||||
|
debug_kgetnum2.o \
|
||||||
|
debug_kmaygetch.o \
|
||||||
|
debug_kmaygetchar.o \
|
||||||
|
debug_kprintf1.o \
|
||||||
|
debug_kprintf2.o \
|
||||||
|
debug_kputc.o \
|
||||||
|
debug_kputch1.o \
|
||||||
|
debug_kputch2.o \
|
||||||
|
debug_kputchar1.o \
|
||||||
|
debug_kputchar2.o \
|
||||||
|
debug_kputfmt.o \
|
||||||
|
debug_kputs1.o \
|
||||||
|
debug_kputs2.o \
|
||||||
|
debug_kputstr1.o \
|
||||||
|
debug_kputstr2.o \
|
||||||
|
debug_kvprintf1.o \
|
||||||
|
debug_kvprintf2.o
|
||||||
|
|
||||||
|
AMIGA_LIB = \
|
||||||
|
amiga.lib_rev.o \
|
||||||
|
amiga_acrypt.o \
|
||||||
|
amiga_addtof.o \
|
||||||
|
amiga_argarraydone.o \
|
||||||
|
amiga_argarrayinit.o \
|
||||||
|
amiga_argint.o \
|
||||||
|
amiga_argstring.o \
|
||||||
|
amiga_callhooka.o \
|
||||||
|
amiga_coercemethod.o \
|
||||||
|
amiga_createstdio.o \
|
||||||
|
amiga_deletestdio.o \
|
||||||
|
amiga_domethod.o \
|
||||||
|
amiga_dosupermethod.o \
|
||||||
|
amiga_dotimer.o \
|
||||||
|
amiga_fastrand.o \
|
||||||
|
amiga_freeievents.o \
|
||||||
|
amiga_hotkey.o \
|
||||||
|
amiga_invertstring.o \
|
||||||
|
amiga_rangerand.o \
|
||||||
|
amiga_remtof.o \
|
||||||
|
amiga_setsuperattrs.o \
|
||||||
|
amiga_timedelay.o \
|
||||||
|
amiga_waitbeam.o
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
LIBS := $(LIBC_OBJS)/libc.a $(LIBSTACK_OBJS)/libstack.a $(LIBUNIX_OBJS)/libunix.a \
|
||||||
|
$(LIBDEBUG_OBJS)/libdebug.a $(LIBAMIGA_OBJS)/libamiga.a \
|
||||||
|
$(LIBM_OBJS)/libm.a $(LIBNET_OBJS)/libnet.a
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
STARTUPS := crt0.o crtbegin.o crtend.o mainnb.o
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
all: \
|
||||||
|
lib/crt0.o \
|
||||||
|
lib/crtbegin.o \
|
||||||
|
lib/crtend.o \
|
||||||
|
lib/mainnb.o \
|
||||||
|
lib/libm.a
|
||||||
|
|
||||||
|
copy:
|
||||||
|
$(COPY) $(foreach file,$(LIBS),large_data/$(file)) lib
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-$(DELETE) $(TYPE) $(STARTUPS) \
|
||||||
|
$(LIBC_OBJS) $(LIBUNIX_OBJS) $(LIBM_OBJS) $(LIBSTACK_OBJS) $(LIBNET_OBJS) $(LIBDEBUG_OBJS) $(LIBAMIGA_OBJS)
|
||||||
|
|
||||||
|
realclean:
|
||||||
|
$(MAKE) clean
|
||||||
|
-$(DELETE) lib small_data large_data
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
version:
|
||||||
|
cp c.lib_rev.rev amiga.lib_rev.rev
|
||||||
|
cp c.lib_rev.rev debug.lib_rev.rev
|
||||||
|
cp c.lib_rev.rev m.lib_rev.rev
|
||||||
|
cp c.lib_rev.rev m881.lib_rev.rev
|
||||||
|
cp c.lib_rev.rev net.lib_rev.rev
|
||||||
|
cp c.lib_rev.rev stack.lib_rev.rev
|
||||||
|
cp c.lib_rev.rev unix.lib_rev.rev
|
||||||
|
bumprev 1 amiga.lib
|
||||||
|
bumprev 1 c.lib
|
||||||
|
bumprev 1 debug.lib
|
||||||
|
bumprev 1 m.lib
|
||||||
|
bumprev 1 m881.lib
|
||||||
|
bumprev 1 net.lib
|
||||||
|
bumprev 1 stack.lib
|
||||||
|
bumprev 1 unix.lib
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
cvs-tag:
|
||||||
|
cvs -q tag V1_`cat c.lib_rev.rev`
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
kitchen_sink: $(TYPE) $(LIBS) $(STARTUPS)
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
ifneq (,$(TYPE))
|
||||||
|
$(TYPE):
|
||||||
|
$(MAKEDIR) $@
|
||||||
|
endif
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
lib:
|
||||||
|
-$(MAKEDIR) $@
|
||||||
|
|
||||||
|
lib/libm.a: lib
|
||||||
|
$(MAKE) TYPE=large_data kitchen_sink
|
||||||
|
$(COPY) $(foreach file,$(LIBS),large_data/$(file)) lib
|
||||||
|
|
||||||
|
lib/small-data/libm.a: lib lib/small-data
|
||||||
|
$(MAKE) TYPE=small_data kitchen_sink
|
||||||
|
$(COPY) $(foreach file,$(LIBS),small_data/$(file)) lib/small-data
|
||||||
|
|
||||||
|
lib/crt0.o : lib crt0.o
|
||||||
|
$(COPY) crt0.o lib
|
||||||
|
|
||||||
|
lib/crtbegin.o : lib crtbegin.o
|
||||||
|
$(COPY) crtbegin.o lib
|
||||||
|
|
||||||
|
lib/crtend.o : lib crtend.o
|
||||||
|
$(COPY) crtend.o lib
|
||||||
|
|
||||||
|
lib/mainnb.o : lib mainnb.o
|
||||||
|
$(COPY) mainnb.o lib
|
||||||
|
|
||||||
|
lib/mainb.o : lib mainb.o
|
||||||
|
$(COPY) mainb.o lib
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
$(LIBAMIGA_OBJS)/amiga_hookentry.o : amiga_hookentry.c
|
||||||
|
|
||||||
|
$(LIBC_OBJS)/stdlib_getsp.o : stdlib_getsp.c
|
||||||
|
|
||||||
|
$(LIBC_OBJS)/stdlib_swapstack.o : stdlib_swapstack.c
|
||||||
|
|
||||||
|
$(LIBC_OBJS)/stdlib_setjmp.o : stdlib_setjmp.c
|
||||||
|
|
||||||
|
$(LIBSTACK_OBJS)/stdlib_setjmp.o : stdlib_setjmp.c
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
$(LIBC_OBJS)/stdlib_stacksize.o : stdlib_stacksize.c stdlib_gcc_help.h
|
||||||
|
|
||||||
|
$(LIBC_OBJS)/stdlib_shell_escape.o : stdlib_shell_escape.c stdlib_gcc_help.h
|
||||||
|
|
||||||
|
$(LIBC_OBJS)/stdlib_alloca.o : stdlib_alloca.c stdlib_mem_debug.h
|
||||||
|
|
||||||
|
$(LIBC_OBJS)/stdlib_calloc.o : stdlib_calloc.c stdlib_mem_debug.h
|
||||||
|
|
||||||
|
$(LIBC_OBJS)/stdlib_free.o : stdlib_free.c stdlib_mem_debug.h
|
||||||
|
|
||||||
|
$(LIBC_OBJS)/stdlib_init_exit.o : stdlib_init_exit.c stdlib_mem_debug.h
|
||||||
|
|
||||||
|
$(LIBC_OBJS)/stdlib_malloc.o : stdlib_malloc.c stdlib_mem_debug.h
|
||||||
|
|
||||||
|
$(LIBC_OBJS)/stdlib_realloc.o : stdlib_realloc.c stdlib_mem_debug.h
|
||||||
|
|
||||||
|
$(LIBC_OBJS)/stdlib_red_black.o : stdlib_red_black.c stdlib_mem_debug.h
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
$(LIBC_OBJS) :
|
||||||
|
$(MAKEDIR) $@
|
||||||
|
|
||||||
|
$(LIBC_OBJS)/libc.a : $(LIBC_OBJS) $(foreach file,$(C_LIB),$(LIBC_OBJS)/$(file))
|
||||||
|
-$(DELETE) $@
|
||||||
|
@$(AR) $@ $(foreach file,$(C_LIB),$(LIBC_OBJS)/$(file))
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
$(LIBUNIX_OBJS) :
|
||||||
|
$(MAKEDIR) $@
|
||||||
|
|
||||||
|
$(LIBUNIX_OBJS)/libunix.a : $(LIBUNIX_OBJS) $(foreach file,$(UNIX_LIB),$(LIBUNIX_OBJS)/$(file))
|
||||||
|
-$(DELETE) $@
|
||||||
|
@$(AR) $@ $(foreach file,$(UNIX_LIB),$(LIBUNIX_OBJS)/$(file))
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
$(LIBM_OBJS) :
|
||||||
|
$(MAKEDIR) $@
|
||||||
|
|
||||||
|
$(LIBM_OBJS)/libm.a : $(LIBM_OBJS) $(foreach file,$(MATH_LIB_IEEE),$(LIBM_OBJS)/$(file))
|
||||||
|
-$(DELETE) $@
|
||||||
|
@$(AR) $@ $(foreach file,$(MATH_LIB_IEEE),$(LIBM_OBJS)/$(file))
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
$(LIBSTACK_OBJS) :
|
||||||
|
$(MAKEDIR) $@
|
||||||
|
|
||||||
|
$(LIBSTACK_OBJS)/libstack.a : $(LIBSTACK_OBJS) $(foreach file,$(STACK_LIB),$(LIBSTACK_OBJS)/$(file))
|
||||||
|
-$(DELETE) $@
|
||||||
|
@$(AR) $@ $(foreach file,$(STACK_LIB),$(LIBSTACK_OBJS)/$(file))
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
$(LIBNET_OBJS) :
|
||||||
|
$(MAKEDIR) $@
|
||||||
|
|
||||||
|
$(LIBNET_OBJS)/libnet.a : $(LIBNET_OBJS) $(foreach file,$(NET_LIB),$(LIBNET_OBJS)/$(file))
|
||||||
|
-$(DELETE) $@
|
||||||
|
@$(AR) $@ $(foreach file,$(NET_LIB),$(LIBNET_OBJS)/$(file))
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
$(LIBDEBUG_OBJS) :
|
||||||
|
$(MAKEDIR) $@
|
||||||
|
|
||||||
|
$(LIBDEBUG_OBJS)/libdebug.a : $(LIBDEBUG_OBJS) $(foreach file,$(DEBUG_LIB),$(LIBDEBUG_OBJS)/$(file))
|
||||||
|
-$(DELETE) $@
|
||||||
|
@$(AR) $@ $(foreach file,$(DEBUG_LIB),$(LIBDEBUG_OBJS)/$(file))
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
$(LIBAMIGA_OBJS) :
|
||||||
|
$(MAKEDIR) $@
|
||||||
|
|
||||||
|
$(LIBAMIGA_OBJS)/libamiga.a : $(LIBAMIGA_OBJS) $(foreach file,$(AMIGA_LIB),$(LIBAMIGA_OBJS)/$(file))
|
||||||
|
-$(DELETE) $@
|
||||||
|
@$(AR) $@ $(foreach file,$(AMIGA_LIB),$(LIBAMIGA_OBJS)/$(file))
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
crt0.o : crt0.S
|
||||||
|
@echo "Assembling $<"
|
||||||
|
@$(CC) -Wa,-mregnames -o crt0.o -c crt0.S
|
||||||
|
|
||||||
|
bcrt0.o : crt0.S
|
||||||
|
@echo "Assembling $<"
|
||||||
|
@$(CC) -DSMALL_DATA -Wa,-mregnames -o bcrt0.o -c crt0.S
|
||||||
|
|
||||||
|
mainnb.o : stdlib_main.c
|
||||||
|
@echo "Compiling $<"
|
||||||
|
@$(CC) -o mainnb.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -msdata=data stdlib_main.c
|
||||||
|
|
||||||
|
mainb.o : stdlib_main.c
|
||||||
|
@echo "Compiling $<"
|
||||||
|
@$(CC) -o mainb.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -msdata=sysv -DSMALL_DATA stdlib_main.c
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
mkid:
|
||||||
|
# mkid -v #?.(c|h|asm|i) include/#?.(c|h|asm|i) include/sys/#?.(c|h|asm|i)
|
||||||
|
mkid *.[ch] include/*.h include/sys/*.h
|
||||||
|
|
||||||
|
update:
|
||||||
|
mkid -v -u
|
||||||
38
library/amiga.lib_rev.c
Normal file
38
library/amiga.lib_rev.c
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga.lib_rev.c,v 1.1.1.1 2004-07-26 16:30:15 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "amiga.lib_rev.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
char __amiga_lib_version[] = VERSTAG;
|
||||||
6
library/amiga.lib_rev.h
Normal file
6
library/amiga.lib_rev.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#define VERSION 1
|
||||||
|
#define REVISION 169
|
||||||
|
#define DATE "8.8.2004"
|
||||||
|
#define VERS "amiga.lib 1.169"
|
||||||
|
#define VSTRING "amiga.lib 1.169 (8.8.2004)\r\n"
|
||||||
|
#define VERSTAG "\0$VER: amiga.lib 1.169 (8.8.2004)"
|
||||||
1
library/amiga.lib_rev.rev
Normal file
1
library/amiga.lib_rev.rev
Normal file
@@ -0,0 +1 @@
|
|||||||
|
169
|
||||||
102
library/amiga_acrypt.c
Normal file
102
library/amiga_acrypt.c
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_acrypt.c,v 1.1.1.1 2004-07-26 16:30:16 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <exec/types.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#define OSIZE 12
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
UBYTE *
|
||||||
|
ACrypt(UBYTE * buffer, const UBYTE * password, const UBYTE * user)
|
||||||
|
{
|
||||||
|
UBYTE * result = NULL;
|
||||||
|
LONG buf[OSIZE];
|
||||||
|
LONG i,d,k;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
assert( buffer != NULL && password != NULL && user != NULL );
|
||||||
|
|
||||||
|
SHOWPOINTER(buffer);
|
||||||
|
SHOWSTRING(password);
|
||||||
|
SHOWSTRING(user);
|
||||||
|
|
||||||
|
if(buffer == NULL || password == NULL || user == NULL)
|
||||||
|
{
|
||||||
|
SHOWMSG("invalid parameters");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 0 ; i < OSIZE ; i++)
|
||||||
|
{
|
||||||
|
if((*password) != '\0')
|
||||||
|
d = (*password++);
|
||||||
|
else
|
||||||
|
d = i;
|
||||||
|
|
||||||
|
if((*user) != '\0')
|
||||||
|
d += (*user++);
|
||||||
|
else
|
||||||
|
d += i;
|
||||||
|
|
||||||
|
buf[i] = 'A' + d;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 0 ; i < OSIZE ; i++)
|
||||||
|
{
|
||||||
|
for(k = 0 ; k < OSIZE ; k++)
|
||||||
|
buf[i] = (buf[i] + buf[OSIZE - k - 1]) % 53;
|
||||||
|
|
||||||
|
buffer[i] = buf[i] + 'A';
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer[OSIZE-1] = '\0';
|
||||||
|
|
||||||
|
SHOWSTRING(buffer);
|
||||||
|
|
||||||
|
result = buffer;
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
RETURN(result);
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
83
library/amiga_addtof.c
Normal file
83
library/amiga_addtof.c
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_addtof.c,v 1.1.1.1 2004-07-26 16:30:16 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <exec/interrupts.h>
|
||||||
|
#include <hardware/intbits.h>
|
||||||
|
#include <graphics/graphint.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <proto/graphics.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "macros.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
typedef LONG (* CFUNC)(APTR arg);
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
static LONG INTERRUPT ASM
|
||||||
|
call_routine(REG(a1,struct Isrvstr *i))
|
||||||
|
{
|
||||||
|
CFUNC p = (CFUNC)i->ccode;
|
||||||
|
|
||||||
|
(*p)(i->Carg);
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
AddTOF(struct Isrvstr *i,CFUNC p,APTR arg)
|
||||||
|
{
|
||||||
|
assert( i != NULL && p != NULL );
|
||||||
|
|
||||||
|
i->code = (long (*)())call_routine;
|
||||||
|
i->Iptr = i;
|
||||||
|
i->ccode = p;
|
||||||
|
i->Carg = arg;
|
||||||
|
|
||||||
|
AddIntServer(INTB_VERTB,(struct Interrupt *)i);
|
||||||
|
}
|
||||||
71
library/amiga_argarraydone.c
Normal file
71
library/amiga_argarraydone.c
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_argarraydone.c,v 1.1.1.1 2004-07-26 16:30:16 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <workbench/workbench.h>
|
||||||
|
#include <exec/memory.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <proto/icon.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
extern char **CXLIB_argarray;
|
||||||
|
|
||||||
|
extern struct DiskObject * CXLIB_disko;
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ArgArrayDone(VOID)
|
||||||
|
{
|
||||||
|
if(CXLIB_argarray != NULL)
|
||||||
|
{
|
||||||
|
FreeVec(CXLIB_argarray);
|
||||||
|
CXLIB_argarray = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(CXLIB_disko != NULL)
|
||||||
|
{
|
||||||
|
FreeDiskObject(CXLIB_disko);
|
||||||
|
CXLIB_disko = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
99
library/amiga_argarrayinit.c
Normal file
99
library/amiga_argarrayinit.c
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_argarrayinit.c,v 1.1.1.1 2004-07-26 16:30:16 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <libraries/commodities.h>
|
||||||
|
#include <workbench/workbench.h>
|
||||||
|
#include <workbench/startup.h>
|
||||||
|
#include <exec/memory.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <proto/dos.h>
|
||||||
|
#include <proto/icon.h>
|
||||||
|
#include <proto/commodities.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
const unsigned char ** CXLIB_argarray;
|
||||||
|
|
||||||
|
struct DiskObject * CXLIB_disko;
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
STRPTR *
|
||||||
|
ArgArrayInit(LONG argc, CONST_STRPTR * argv)
|
||||||
|
{
|
||||||
|
unsigned char ** result = NULL;
|
||||||
|
|
||||||
|
if(argc != 0) /* run from CLI */
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if(argc == 1)
|
||||||
|
goto out; /* skip command name */
|
||||||
|
|
||||||
|
CXLIB_argarray = (const unsigned char **)AllocVec(sizeof(char *) * argc,MEMF_ANY|MEMF_CLEAR);
|
||||||
|
if(CXLIB_argarray == NULL)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
for(i = 1 ; i < argc ; i++)
|
||||||
|
CXLIB_argarray[i-1] = argv[i];
|
||||||
|
|
||||||
|
result = (unsigned char **)CXLIB_argarray;
|
||||||
|
}
|
||||||
|
else if (IconBase != NULL)
|
||||||
|
{
|
||||||
|
struct WBStartup * msg;
|
||||||
|
|
||||||
|
/* run from WB */
|
||||||
|
msg = (struct WBStartup *)argv;
|
||||||
|
|
||||||
|
CXLIB_disko = GetDiskObject(msg->sm_ArgList[0].wa_Name);
|
||||||
|
if(CXLIB_disko == NULL)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
result = (unsigned char **)CXLIB_disko->do_ToolTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
60
library/amiga_argint.c
Normal file
60
library/amiga_argint.c
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_argint.c,v 1.1.1.1 2004-07-26 16:30:16 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <workbench/workbench.h>
|
||||||
|
#include <exec/memory.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/dos.h>
|
||||||
|
#include <proto/icon.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
ArgInt(CONST_STRPTR *tt,CONST_STRPTR entry,LONG default_val)
|
||||||
|
{
|
||||||
|
STRPTR str;
|
||||||
|
|
||||||
|
if(tt != NULL && IconBase != NULL && ((str = (STRPTR)FindToolType((STRPTR *)tt,(STRPTR)entry))) != NULL)
|
||||||
|
StrToLong(str,&default_val);
|
||||||
|
|
||||||
|
return(default_val);
|
||||||
|
}
|
||||||
61
library/amiga_argstring.c
Normal file
61
library/amiga_argstring.c
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_argstring.c,v 1.1.1.1 2004-07-26 16:30:16 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <libraries/commodities.h>
|
||||||
|
#include <workbench/workbench.h>
|
||||||
|
#include <workbench/startup.h>
|
||||||
|
#include <exec/memory.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/icon.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
STRPTR
|
||||||
|
ArgString(CONST_STRPTR *tt,CONST_STRPTR entry,CONST_STRPTR default_string)
|
||||||
|
{
|
||||||
|
STRPTR result;
|
||||||
|
|
||||||
|
if(tt != NULL && IconBase != NULL && ((result = (STRPTR)FindToolType((STRPTR *)tt,(STRPTR)entry))) != NULL)
|
||||||
|
return(result);
|
||||||
|
else
|
||||||
|
return((STRPTR)default_string);
|
||||||
|
}
|
||||||
84
library/amiga_beginio.c
Normal file
84
library/amiga_beginio.c
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_beginio.c,v 1.1.1.1 2004-07-26 16:30:17 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <exec/devices.h>
|
||||||
|
#include <exec/io.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(__SASC)
|
||||||
|
|
||||||
|
VOID __begin_io(struct IORequest * ior);
|
||||||
|
#pragma libcall DeviceBase __begin_io 01e 901
|
||||||
|
|
||||||
|
#endif /* __SASC */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
|
||||||
|
#define __begin_io(ior) ({ \
|
||||||
|
struct IORequest * _BeginIO_ior = (ior); \
|
||||||
|
{ \
|
||||||
|
register struct Library * const __BeginIO__bn __asm("a6") = (struct Library *) (DeviceBase);\
|
||||||
|
register struct IORequest * __BeginIO_ior __asm("a1") = (_BeginIO_ior); \
|
||||||
|
__asm volatile ("jsr a6@(-30:W)" \
|
||||||
|
: \
|
||||||
|
: "r"(__BeginIO__bn), "r"(__BeginIO_ior) \
|
||||||
|
: "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \
|
||||||
|
} \
|
||||||
|
})
|
||||||
|
|
||||||
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
BeginIO(struct IORequest *ior)
|
||||||
|
{
|
||||||
|
struct Device * DeviceBase;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
assert( ior != NULL && ior->io_Device != NULL );
|
||||||
|
|
||||||
|
DeviceBase = ior->io_Device;
|
||||||
|
__begin_io(ior);
|
||||||
|
|
||||||
|
LEAVE();
|
||||||
|
}
|
||||||
67
library/amiga_callhook.c
Normal file
67
library/amiga_callhook.c
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_callhook.c,v 1.1.1.1 2004-07-26 16:30:17 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 __PPC__
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
CallHook(struct Hook *hook_ptr,Object *obj,...)
|
||||||
|
{
|
||||||
|
ULONG result;
|
||||||
|
va_list arg;
|
||||||
|
|
||||||
|
assert( hook_ptr != NULL );
|
||||||
|
|
||||||
|
va_start(arg,obj);
|
||||||
|
|
||||||
|
result = CallHookA(hook_ptr,obj,(APTR)arg);
|
||||||
|
|
||||||
|
va_end(arg);
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* __PPC__ */
|
||||||
80
library/amiga_callhooka.asm
Normal file
80
library/amiga_callhooka.asm
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
*
|
||||||
|
* $Id: amiga_callhooka.asm,v 1.1.1.1 2004-07-26 16:30:17 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=8
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*
|
||||||
|
|
||||||
|
section text,code
|
||||||
|
|
||||||
|
h_Entry equ 8
|
||||||
|
|
||||||
|
xdef _CallHookA
|
||||||
|
|
||||||
|
****************************************************************************
|
||||||
|
* new hook standard
|
||||||
|
* use struct Hook (with minnode at the top)
|
||||||
|
*
|
||||||
|
* *** register calling convention: ***
|
||||||
|
* A0 - pointer to hook itself
|
||||||
|
* A1 - pointer to parameter packed ("message")
|
||||||
|
* A2 - Hook specific address data ("object," e.g, gadget )
|
||||||
|
*
|
||||||
|
* *** C conventions: ***
|
||||||
|
* Note that parameters are in unusual register order: a0, a2, a1.
|
||||||
|
* This is to provide a performance boost for assembly language
|
||||||
|
* programming (the object in a2 is most frequently untouched).
|
||||||
|
* It is also no problem in "register direct" C function parameters.
|
||||||
|
*
|
||||||
|
* calling through a hook
|
||||||
|
* CallHook( hook, object, msgid, p1, p2, ... );
|
||||||
|
* CallHookA( hook, object, msgpkt );
|
||||||
|
*
|
||||||
|
* using a C function: CFunction( hook, object, message );
|
||||||
|
* hook.h_Entry = HookEntry;
|
||||||
|
* hook.h_SubEntry = CFunction;
|
||||||
|
*
|
||||||
|
****************************************************************************
|
||||||
|
|
||||||
|
* C calling hook interface for prepared message packet
|
||||||
|
_CallHookA:
|
||||||
|
movem.l a2/a6,-(sp)
|
||||||
|
move.l 12(sp),a0
|
||||||
|
move.l 16(sp),a2
|
||||||
|
move.l 20(sp),a1
|
||||||
|
pea.l hook_return(pc)
|
||||||
|
move.l h_Entry(a0),-(sp)
|
||||||
|
rts
|
||||||
|
|
||||||
|
hook_return:
|
||||||
|
|
||||||
|
movem.l (sp)+,a2/a6
|
||||||
|
rts
|
||||||
|
|
||||||
|
end
|
||||||
93
library/amiga_callhooka.c
Normal file
93
library/amiga_callhooka.c
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_callhooka.c,v 1.1.1.1 2004-07-26 16:30:17 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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(__GNUC__) && !defined(__PPC__))
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
asm("
|
||||||
|
|
||||||
|
h_Entry = 8
|
||||||
|
|
||||||
|
.text
|
||||||
|
.even
|
||||||
|
|
||||||
|
|---------------------------------------------------------------------------
|
||||||
|
| new hook standard
|
||||||
|
| use struct Hook (with minnode at the top)
|
||||||
|
|
|
||||||
|
| *** register calling convention: ***
|
||||||
|
| A0 - pointer to hook itself
|
||||||
|
| A1 - pointer to parameter packed ('message')
|
||||||
|
| A2 - Hook specific address data ('object,' e.g, gadget )
|
||||||
|
|
|
||||||
|
| *** C conventions: ***
|
||||||
|
| Note that parameters are in unusual register order: a0, a2, a1.
|
||||||
|
| This is to provide a performance boost for assembly language
|
||||||
|
| programming (the object in a2 is most frequently untouched).
|
||||||
|
| It is also no problem in 'register direct' C function parameters.
|
||||||
|
|
|
||||||
|
| calling through a hook
|
||||||
|
| CallHook( hook, object, msgid, p1, p2, ... );
|
||||||
|
| CallHookA( hook, object, msgpkt );
|
||||||
|
|
|
||||||
|
| using a C function: CFunction( hook, object, message );
|
||||||
|
| hook.h_Entry = HookEntry;
|
||||||
|
| hook.h_SubEntry = CFunction;
|
||||||
|
|
|
||||||
|
|---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
| C calling hook interface for prepared message packet
|
||||||
|
|
||||||
|
.globl _CallHookA
|
||||||
|
|
||||||
|
_CallHookA:
|
||||||
|
|
||||||
|
moveml a2/a6,sp@-
|
||||||
|
moveal sp@(12),a0
|
||||||
|
moveal sp@(16),a2
|
||||||
|
moveal sp@(20),a1
|
||||||
|
pea callhooka_return
|
||||||
|
movel a0@(h_Entry),sp@-
|
||||||
|
rts
|
||||||
|
|
||||||
|
callhooka_return:
|
||||||
|
|
||||||
|
moveml sp@+,a2/a6
|
||||||
|
rts
|
||||||
|
|
||||||
|
");
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* __GNUC__ && !__PPC__ */
|
||||||
93
library/amiga_coercemethod.c
Normal file
93
library/amiga_coercemethod.c
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_coercemethod.c,v 1.1.1.1 2004-07-26 16:30:17 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 __PPC__
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <intuition/intuition.h>
|
||||||
|
#include <intuition/classes.h>
|
||||||
|
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
CoerceMethodA(Class * cl,Object * obj,Msg msg)
|
||||||
|
{
|
||||||
|
ULONG result = 0;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
SHOWPOINTER(cl);
|
||||||
|
SHOWPOINTER(obj);
|
||||||
|
SHOWPOINTER(msg);
|
||||||
|
|
||||||
|
assert( cl != NULL && obj != NULL );
|
||||||
|
|
||||||
|
if(cl != NULL && obj != NULL)
|
||||||
|
result = CallHookA(&cl->cl_Dispatcher,obj,msg);
|
||||||
|
|
||||||
|
RETURN(result);
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
CoerceMethod(Class *cl, Object *obj, ULONG method_id, ...)
|
||||||
|
{
|
||||||
|
ULONG result = 0;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
SHOWPOINTER(cl);
|
||||||
|
SHOWPOINTER(obj);
|
||||||
|
SHOWVALUE(method_id);
|
||||||
|
|
||||||
|
assert( cl != NULL && obj != NULL );
|
||||||
|
|
||||||
|
if(cl != NULL && obj != NULL)
|
||||||
|
result = CoerceMethodA(cl,obj,(Msg)&method_id);
|
||||||
|
|
||||||
|
RETURN(result);
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* __PPC__ */
|
||||||
62
library/amiga_createextio.c
Normal file
62
library/amiga_createextio.c
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_createextio.c,v 1.1.1.1 2004-07-26 16:30:18 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
struct IORequest *
|
||||||
|
CreateExtIO(CONST struct MsgPort * port, LONG io_size)
|
||||||
|
{
|
||||||
|
struct IORequest * result = NULL;
|
||||||
|
|
||||||
|
assert( port != NULL && io_size > 0 );
|
||||||
|
|
||||||
|
if(port == NULL || io_size < (LONG)sizeof(*result))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
result = CreateIORequest(port,(ULONG)io_size);
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
69
library/amiga_createport.c
Normal file
69
library/amiga_createport.c
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_createport.c,v 1.1.1.1 2004-07-26 16:30:18 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
struct MsgPort *
|
||||||
|
CreatePort(CONST_STRPTR name, LONG pri)
|
||||||
|
{
|
||||||
|
struct MsgPort * result = NULL;
|
||||||
|
|
||||||
|
assert( -128 <= pri && pri <= 127 );
|
||||||
|
|
||||||
|
if(pri < -128 || pri > 127)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
result = CreateMsgPort();
|
||||||
|
if(result != NULL && name != NULL)
|
||||||
|
{
|
||||||
|
result->mp_Node.ln_Name = (char *)name;
|
||||||
|
result->mp_Node.ln_Pri = pri;
|
||||||
|
|
||||||
|
AddPort(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
62
library/amiga_createstdio.c
Normal file
62
library/amiga_createstdio.c
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_createstdio.c,v 1.1.1.1 2004-07-26 16:30:18 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
struct IOStdReq *
|
||||||
|
CreateStdIO(CONST struct MsgPort * port)
|
||||||
|
{
|
||||||
|
struct IOStdReq * result = NULL;
|
||||||
|
|
||||||
|
assert( port != NULL );
|
||||||
|
|
||||||
|
if(port == NULL)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
result = (struct IOStdReq *)CreateIORequest((struct MsgPort *)port,sizeof(*result));
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
194
library/amiga_createtask.c
Normal file
194
library/amiga_createtask.c
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_createtask.c,v 1.1.1.1 2004-07-26 16:30:18 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 __PPC__
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <exec/libraries.h>
|
||||||
|
#include <exec/memory.h>
|
||||||
|
#include <exec/tasks.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "macros.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a task with given name, priority, and stack size.
|
||||||
|
* It will use the default exception and trap handlers for now.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* the template for the mementries. Unfortunately, this is hard to
|
||||||
|
* do from C: mementries have unions, and they cannot be statically
|
||||||
|
* initialized...
|
||||||
|
*
|
||||||
|
* In the interest of simplicity I recreate the mem entry structures
|
||||||
|
* here with appropriate sizes. We will copy this to a local
|
||||||
|
* variable and set the stack size to what the user specified,
|
||||||
|
* then attempt to actually allocate the memory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define ME_TASK 0
|
||||||
|
#define ME_STACK 1
|
||||||
|
|
||||||
|
#define NUM_MEM_ENTRIES 2
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
struct FakeMemEntry
|
||||||
|
{
|
||||||
|
ULONG fme_Reqs;
|
||||||
|
ULONG fme_Size;
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
struct FakeMemList
|
||||||
|
{
|
||||||
|
struct Node fml_Node;
|
||||||
|
UWORD fml_NumEntries;
|
||||||
|
struct FakeMemEntry fml_ME[NUM_MEM_ENTRIES];
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
struct Task *
|
||||||
|
CreateTask(CONST_STRPTR name,LONG pri,CONST APTR init_pc,ULONG stack_size)
|
||||||
|
{
|
||||||
|
struct Task * new_task;
|
||||||
|
struct FakeMemList fake_mem_list;
|
||||||
|
struct MemList * ml = NULL;
|
||||||
|
APTR result = NULL;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
SHOWSTRING(name);
|
||||||
|
SHOWVALUE(pri);
|
||||||
|
SHOWPOINTER(init_pc);
|
||||||
|
SHOWVALUE(stack_size);
|
||||||
|
|
||||||
|
assert( name != NULL && (-128 <= pri && pri <= 127) && init_pc != NULL && stack_size > 0 );
|
||||||
|
|
||||||
|
if(name == NULL || pri < -128 || pri > 127 || init_pc == NULL || stack_size == 0)
|
||||||
|
{
|
||||||
|
SHOWMSG("invalid parameters");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* round the stack up to longwords... */
|
||||||
|
stack_size = (stack_size + 3UL) & ~3UL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This will allocate two chunks of memory: task of PUBLIC
|
||||||
|
* and stack of PRIVATE
|
||||||
|
*/
|
||||||
|
memset(&fake_mem_list,0,sizeof(fake_mem_list));
|
||||||
|
|
||||||
|
fake_mem_list.fml_NumEntries = NUM_MEM_ENTRIES;
|
||||||
|
fake_mem_list.fml_ME[ME_TASK].fme_Reqs = MEMF_PUBLIC | MEMF_CLEAR;
|
||||||
|
fake_mem_list.fml_ME[ME_TASK].fme_Size = sizeof(struct Task);
|
||||||
|
fake_mem_list.fml_ME[ME_STACK].fme_Reqs = MEMF_ANY | MEMF_CLEAR;
|
||||||
|
fake_mem_list.fml_ME[ME_STACK].fme_Size = stack_size;
|
||||||
|
|
||||||
|
ml = (struct MemList *)AllocEntry((struct MemList *)&fake_mem_list);
|
||||||
|
|
||||||
|
/* Did the allocation succeed? */
|
||||||
|
if(((LONG)ml) < 0)
|
||||||
|
{
|
||||||
|
SHOWMSG("memory allocation failed");
|
||||||
|
|
||||||
|
/* Note: if AllocEntry() fails, the entire allocation is
|
||||||
|
* released before the function returns with bit #31
|
||||||
|
* set and the number of the slot that failed being
|
||||||
|
* returned. Thus, the return value is not a valid
|
||||||
|
* address that would need to be freed.
|
||||||
|
*/
|
||||||
|
ml = NULL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set the stack accounting stuff */
|
||||||
|
new_task = (struct Task *)ml->ml_ME[ME_TASK].me_Addr;
|
||||||
|
|
||||||
|
new_task->tc_SPLower = ml->ml_ME[ME_STACK].me_Addr;
|
||||||
|
new_task->tc_SPUpper = (APTR)((ULONG)(new_task->tc_SPLower) + stack_size);
|
||||||
|
new_task->tc_SPReg = new_task->tc_SPUpper;
|
||||||
|
|
||||||
|
/* misc task data structures */
|
||||||
|
new_task->tc_Node.ln_Type = NT_TASK;
|
||||||
|
new_task->tc_Node.ln_Pri = pri;
|
||||||
|
new_task->tc_Node.ln_Name = (char *)name;
|
||||||
|
|
||||||
|
/* add it to the tasks memory list */
|
||||||
|
NewList(&new_task->tc_MemEntry);
|
||||||
|
AddHead(&new_task->tc_MemEntry,(struct Node *)ml);
|
||||||
|
|
||||||
|
/* add the task to the system -- use the default final PC */
|
||||||
|
|
||||||
|
PROFILE_OFF();
|
||||||
|
result = AddTask(new_task,init_pc,NULL);
|
||||||
|
PROFILE_ON();
|
||||||
|
|
||||||
|
if(result == NULL)
|
||||||
|
{
|
||||||
|
SHOWMSG("could not add task");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gobbled up by task. */
|
||||||
|
ml = NULL;
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
if(ml != NULL)
|
||||||
|
FreeEntry(ml);
|
||||||
|
|
||||||
|
RETURN(result);
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* __PPC__ */
|
||||||
54
library/amiga_deleteextio.c
Normal file
54
library/amiga_deleteextio.c
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_deleteextio.c,v 1.1.1.1 2004-07-26 16:30:18 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DeleteExtIO(struct IORequest * io)
|
||||||
|
{
|
||||||
|
assert(io != NULL);
|
||||||
|
|
||||||
|
if(io != NULL)
|
||||||
|
DeleteIORequest((struct IORequest *)io);
|
||||||
|
}
|
||||||
56
library/amiga_deleteport.c
Normal file
56
library/amiga_deleteport.c
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_deleteport.c,v 1.1.1.1 2004-07-26 16:30:19 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DeletePort(struct MsgPort * port)
|
||||||
|
{
|
||||||
|
assert( port != NULL );
|
||||||
|
|
||||||
|
if(port->mp_Node.ln_Name != NULL)
|
||||||
|
RemPort(port);
|
||||||
|
|
||||||
|
DeleteMsgPort(port);
|
||||||
|
}
|
||||||
52
library/amiga_deletestdio.c
Normal file
52
library/amiga_deletestdio.c
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_deletestdio.c,v 1.1.1.1 2004-07-26 16:30:19 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DeleteStdIO(struct IOStdReq * io)
|
||||||
|
{
|
||||||
|
if(io != NULL)
|
||||||
|
DeleteIORequest((struct IORequest *)io);
|
||||||
|
}
|
||||||
48
library/amiga_deletetask.c
Normal file
48
library/amiga_deletetask.c
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_deletetask.c,v 1.1.1.1 2004-07-26 16:30:19 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <exec/libraries.h>
|
||||||
|
#include <exec/tasks.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DeleteTask(struct Task *tc)
|
||||||
|
{
|
||||||
|
RemTask(tc);
|
||||||
|
}
|
||||||
100
library/amiga_domethod.c
Normal file
100
library/amiga_domethod.c
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_domethod.c,v 1.1.1.1 2004-07-26 16:30:19 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 __PPC__
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <intuition/intuition.h>
|
||||||
|
#include <intuition/classes.h>
|
||||||
|
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
DoMethodA(Object * obj,Msg msg)
|
||||||
|
{
|
||||||
|
ULONG result = 0;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
SHOWPOINTER(obj);
|
||||||
|
SHOWPOINTER(msg);
|
||||||
|
|
||||||
|
assert(obj != NULL);
|
||||||
|
|
||||||
|
if(obj != NULL)
|
||||||
|
{
|
||||||
|
Class * cl;
|
||||||
|
|
||||||
|
cl = OCLASS(obj);
|
||||||
|
|
||||||
|
assert( cl != NULL );
|
||||||
|
|
||||||
|
if(cl != NULL)
|
||||||
|
result = CallHookA(&cl->cl_Dispatcher,obj,msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN(result);
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
DoMethod(Object *obj, ULONG method_id, ...)
|
||||||
|
{
|
||||||
|
ULONG result = 0;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
SHOWPOINTER(obj);
|
||||||
|
SHOWVALUE(method_id);
|
||||||
|
|
||||||
|
assert( obj != NULL );
|
||||||
|
|
||||||
|
if(obj != NULL)
|
||||||
|
result = DoMethodA(obj,(Msg)&method_id);
|
||||||
|
|
||||||
|
RETURN(result);
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* __PPC__ */
|
||||||
93
library/amiga_dosupermethod.c
Normal file
93
library/amiga_dosupermethod.c
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_dosupermethod.c,v 1.1.1.1 2004-07-26 16:30:19 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 __PPC__
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <intuition/intuition.h>
|
||||||
|
#include <intuition/classes.h>
|
||||||
|
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
DoSuperMethodA(Class * cl, Object * obj, Msg msg)
|
||||||
|
{
|
||||||
|
ULONG result = 0;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
SHOWPOINTER(cl);
|
||||||
|
SHOWPOINTER(obj);
|
||||||
|
SHOWPOINTER(msg);
|
||||||
|
|
||||||
|
assert( cl != NULL && obj != NULL );
|
||||||
|
|
||||||
|
if(cl != NULL && obj != NULL)
|
||||||
|
result = CallHookA(&cl->cl_Super->cl_Dispatcher,obj,msg);
|
||||||
|
|
||||||
|
RETURN(result);
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
DoSuperMethod(Class *cl, Object *obj, ULONG method_id, ...)
|
||||||
|
{
|
||||||
|
ULONG result = 0;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
SHOWPOINTER(cl);
|
||||||
|
SHOWPOINTER(obj);
|
||||||
|
SHOWVALUE(method_id);
|
||||||
|
|
||||||
|
assert( cl != NULL && obj != NULL );
|
||||||
|
|
||||||
|
if(cl != NULL && obj != NULL)
|
||||||
|
result = DoSuperMethodA(cl,obj,(Msg)&method_id);
|
||||||
|
|
||||||
|
RETURN(result);
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* __PPC__ */
|
||||||
113
library/amiga_dotimer.c
Normal file
113
library/amiga_dotimer.c
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_dotimer.c,v 1.1.1.1 2004-07-26 16:30:19 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <exec/errors.h>
|
||||||
|
|
||||||
|
#include <devices/timer.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "macros.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
DoTimer(struct timeval *tv,LONG unit,LONG command)
|
||||||
|
{
|
||||||
|
struct timerequest * tr = NULL;
|
||||||
|
struct MsgPort * mp;
|
||||||
|
LONG error;
|
||||||
|
|
||||||
|
assert( tv != NULL );
|
||||||
|
|
||||||
|
mp = AllocVec(sizeof(*mp),MEMF_ANY|MEMF_PUBLIC|MEMF_CLEAR);
|
||||||
|
if(mp == NULL)
|
||||||
|
{
|
||||||
|
error = IOERR_OPENFAIL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
mp->mp_Node.ln_Type = NT_MSGPORT;
|
||||||
|
mp->mp_Flags = PA_SIGNAL;
|
||||||
|
mp->mp_SigBit = SIGB_SINGLE;
|
||||||
|
mp->mp_SigTask = FindTask(NULL);
|
||||||
|
NewList(&mp->mp_MsgList);
|
||||||
|
|
||||||
|
tr = (struct timerequest *)CreateIORequest(mp,sizeof(*tr));
|
||||||
|
if(tr == NULL)
|
||||||
|
{
|
||||||
|
error = IOERR_OPENFAIL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = OpenDevice(TIMERNAME,(ULONG)unit,(struct IORequest *)tr,0);
|
||||||
|
if(error != 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
tr->tr_node.io_Command = command;
|
||||||
|
tr->tr_time.tv_secs = tv->tv_secs;
|
||||||
|
tr->tr_time.tv_micro = tv->tv_micro;
|
||||||
|
|
||||||
|
PROFILE_OFF();
|
||||||
|
|
||||||
|
SetSignal(0,SIGF_SINGLE);
|
||||||
|
|
||||||
|
error = DoIO((struct IORequest *)tr);
|
||||||
|
|
||||||
|
PROFILE_ON();
|
||||||
|
|
||||||
|
tv->tv_secs = tr->tr_time.tv_secs;
|
||||||
|
tv->tv_micro = tr->tr_time.tv_micro;
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
if(tr != NULL)
|
||||||
|
{
|
||||||
|
if(tr->tr_node.io_Device != NULL)
|
||||||
|
CloseDevice((struct IORequest *)tr);
|
||||||
|
|
||||||
|
DeleteIORequest((struct IORequest *)tr);
|
||||||
|
}
|
||||||
|
|
||||||
|
FreeVec(mp);
|
||||||
|
|
||||||
|
return(error);
|
||||||
|
}
|
||||||
52
library/amiga_fastrand.c
Normal file
52
library/amiga_fastrand.c
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_fastrand.c,v 1.1.1.1 2004-07-26 16:30:20 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <exec/types.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
FastRand(ULONG seed)
|
||||||
|
{
|
||||||
|
ULONG value;
|
||||||
|
|
||||||
|
value = seed + seed;
|
||||||
|
if(value < seed)
|
||||||
|
value ^= 0x1D872B41;
|
||||||
|
|
||||||
|
return(value);
|
||||||
|
}
|
||||||
62
library/amiga_freeievents.c
Normal file
62
library/amiga_freeievents.c
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_freeievents.c,v 1.1.1.1 2004-07-26 16:30:20 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <devices/inputevent.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FreeIEvents(struct InputEvent * ie)
|
||||||
|
{
|
||||||
|
struct InputEvent * next;
|
||||||
|
|
||||||
|
while(ie != NULL)
|
||||||
|
{
|
||||||
|
next = ie->ie_NextEvent;
|
||||||
|
|
||||||
|
FreeVec(ie);
|
||||||
|
|
||||||
|
ie = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
51
library/amiga_hookentry.asm
Normal file
51
library/amiga_hookentry.asm
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
*
|
||||||
|
* $Id: amiga_hookentry.asm,v 1.1.1.1 2004-07-26 16:30:20 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=8
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*
|
||||||
|
|
||||||
|
section text,code
|
||||||
|
|
||||||
|
h_SubEntry equ 12
|
||||||
|
|
||||||
|
xdef _HookEntry
|
||||||
|
|
||||||
|
_HookEntry:
|
||||||
|
|
||||||
|
move.l a1,-(sp)
|
||||||
|
move.l a2,-(sp)
|
||||||
|
move.l a0,-(sp)
|
||||||
|
move.l h_SubEntry(a0),a0
|
||||||
|
jsr (a0)
|
||||||
|
lea 12(sp),sp
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
end
|
||||||
61
library/amiga_hookentry.c
Normal file
61
library/amiga_hookentry.c
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_hookentry.c,v 1.1.1.1 2004-07-26 16:30:20 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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(__GNUC__) && !defined(__PPC__))
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
asm("
|
||||||
|
|
||||||
|
h_SubEntry = 12
|
||||||
|
|
||||||
|
.text
|
||||||
|
.even
|
||||||
|
|
||||||
|
.globl _HookEntry
|
||||||
|
|
||||||
|
_HookEntry:
|
||||||
|
|
||||||
|
movel a1,sp@-
|
||||||
|
movel a2,sp@-
|
||||||
|
movel a0,sp@-
|
||||||
|
movel a0@(h_SubEntry:W),a0
|
||||||
|
jsr a0@
|
||||||
|
lea sp@(12:W),sp
|
||||||
|
rts
|
||||||
|
|
||||||
|
");
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* __GNUC__ && !__PPC__ */
|
||||||
78
library/amiga_hotkey.c
Normal file
78
library/amiga_hotkey.c
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_hotkey.c,v 1.1.1.1 2004-07-26 16:30:20 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <libraries/commodities.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/commodities.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
CxObj *
|
||||||
|
HotKey(CONST_STRPTR descr,struct MsgPort * port,LONG ID)
|
||||||
|
{
|
||||||
|
CxObj * result = NULL;
|
||||||
|
CxObj * filter = NULL;
|
||||||
|
|
||||||
|
assert( descr != NULL && port != NULL );
|
||||||
|
|
||||||
|
if(CxBase == NULL)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
filter = CxFilter(descr);
|
||||||
|
if(filter == NULL)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
AttachCxObj(filter,CxSender(port,ID));
|
||||||
|
AttachCxObj(filter,CxTranslate(NULL));
|
||||||
|
|
||||||
|
if(CxObjError(filter))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
result = filter;
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
if(result == NULL && filter != NULL)
|
||||||
|
DeleteCxObjAll(filter);
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
208
library/amiga_invertstring.c
Normal file
208
library/amiga_invertstring.c
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_invertstring.c,v 1.1.1.1 2004-07-26 16:30:20 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <libraries/commodities.h>
|
||||||
|
#include <devices/keymap.h>
|
||||||
|
#include <exec/memory.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <proto/commodities.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
static int
|
||||||
|
do_escape(int cc)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
|
switch(cc)
|
||||||
|
{
|
||||||
|
case 'n':
|
||||||
|
case 'r':
|
||||||
|
|
||||||
|
result = '\r';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 't':
|
||||||
|
|
||||||
|
result = '\t';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '0':
|
||||||
|
|
||||||
|
result = '\0';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '\\':
|
||||||
|
case '\"':
|
||||||
|
case '\'':
|
||||||
|
case '<':
|
||||||
|
|
||||||
|
result = cc;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
|
||||||
|
result = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
static ULONG
|
||||||
|
do_angle(STRPTR * strp, struct InputEvent *ie)
|
||||||
|
{
|
||||||
|
ULONG result;
|
||||||
|
char * cp;
|
||||||
|
IX ix;
|
||||||
|
|
||||||
|
/* find closing angle '>', put a null there */
|
||||||
|
for(cp = (*strp) ; (*cp) ; cp++)
|
||||||
|
{
|
||||||
|
if((*cp) == '>')
|
||||||
|
{
|
||||||
|
(*cp) = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = ParseIX((*strp),&ix);
|
||||||
|
|
||||||
|
if(cp != NULL)
|
||||||
|
{
|
||||||
|
(*cp) = '>'; /* fix it */
|
||||||
|
(*strp) = cp; /* point to char following '>' */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(*strp) = cp - 1; /* ++will point to terminating null */
|
||||||
|
}
|
||||||
|
|
||||||
|
if(result == 0)
|
||||||
|
{
|
||||||
|
/* use IX to describe a suitable InputEvent */
|
||||||
|
ie->ie_Class = ix.ix_Class;
|
||||||
|
ie->ie_Code = ix.ix_Code;
|
||||||
|
ie->ie_Qualifier = ix.ix_Qualifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
extern VOID FreeIEvents(struct InputEvent *ie);
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
struct InputEvent *
|
||||||
|
InvertString(CONST_STRPTR str, CONST struct KeyMap *km)
|
||||||
|
{
|
||||||
|
/* bugs:
|
||||||
|
can't escape '>'
|
||||||
|
puts '\0' on closing angles */
|
||||||
|
|
||||||
|
/* allocate input event for each character in string */
|
||||||
|
|
||||||
|
struct InputEvent * result = NULL;
|
||||||
|
struct InputEvent * chain = NULL;
|
||||||
|
struct InputEvent * ie;
|
||||||
|
int cc;
|
||||||
|
|
||||||
|
if(CxBase == NULL || str == NULL || (*str) == '\0')
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
do /* have checked that str is not null */
|
||||||
|
{
|
||||||
|
/* allocate the next ie and link it in */
|
||||||
|
ie = AllocVec(sizeof(*ie),MEMF_ANY|MEMF_CLEAR|MEMF_PUBLIC);
|
||||||
|
if(ie == NULL)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
ie->ie_NextEvent = chain;
|
||||||
|
chain = ie;
|
||||||
|
|
||||||
|
/* now fill in the input event */
|
||||||
|
cc = (*str);
|
||||||
|
switch(cc)
|
||||||
|
{
|
||||||
|
case '<':
|
||||||
|
|
||||||
|
str++;
|
||||||
|
|
||||||
|
if(do_angle((STRPTR*)&str, ie) != 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '\\':
|
||||||
|
|
||||||
|
str++;
|
||||||
|
|
||||||
|
cc = do_escape(*str); /* get escaped character */
|
||||||
|
if(cc < 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
/* fall through */
|
||||||
|
|
||||||
|
default:
|
||||||
|
|
||||||
|
InvertKeyMap((ULONG) cc, ie, (struct KeyMap *)km);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
while((*str) != '\0');
|
||||||
|
|
||||||
|
result = chain;
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
if(result == NULL && chain != NULL)
|
||||||
|
FreeIEvents(chain);
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
60
library/amiga_newlist.c
Normal file
60
library/amiga_newlist.c
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_newlist.c,v 1.1.1.1 2004-07-26 16:30:21 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <exec/lists.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NewList(struct List *lh)
|
||||||
|
{
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
SHOWPOINTER(lh);
|
||||||
|
|
||||||
|
assert( lh != NULL );
|
||||||
|
|
||||||
|
lh->lh_Head = (struct Node *)&lh->lh_Tail;
|
||||||
|
lh->lh_Tail = NULL;
|
||||||
|
lh->lh_TailPred = (struct Node *)&lh->lh_Head;
|
||||||
|
|
||||||
|
LEAVE();
|
||||||
|
}
|
||||||
80
library/amiga_rangerand.c
Normal file
80
library/amiga_rangerand.c
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_rangerand.c,v 1.1.1.1 2004-07-26 16:30:21 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <exec/types.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
ULONG RangeSeed;
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
UWORD
|
||||||
|
RangeRand(ULONG max_value)
|
||||||
|
{
|
||||||
|
ULONG next_value;
|
||||||
|
ULONG result;
|
||||||
|
ULONG value;
|
||||||
|
UWORD range;
|
||||||
|
UWORD bits;
|
||||||
|
|
||||||
|
range = (max_value & 0xFFFF);
|
||||||
|
bits = range - 1;
|
||||||
|
|
||||||
|
value = RangeSeed;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
next_value = value + value;
|
||||||
|
if(next_value <= value)
|
||||||
|
next_value ^= 0x1D872B41;
|
||||||
|
|
||||||
|
value = next_value;
|
||||||
|
|
||||||
|
bits = bits >> 1;
|
||||||
|
}
|
||||||
|
while(bits != 0);
|
||||||
|
|
||||||
|
RangeSeed = value;
|
||||||
|
|
||||||
|
if(range == 0)
|
||||||
|
result = value & 0xFFFF;
|
||||||
|
else
|
||||||
|
result = (range * (value & 0xFFFF)) >> 16;
|
||||||
|
|
||||||
|
return((UWORD)result);
|
||||||
|
}
|
||||||
57
library/amiga_remtof.c
Normal file
57
library/amiga_remtof.c
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_remtof.c,v 1.1.1.1 2004-07-26 16:30:21 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <exec/interrupts.h>
|
||||||
|
#include <hardware/intbits.h>
|
||||||
|
#include <graphics/graphint.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/exec.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
RemTOF(struct Isrvstr *i)
|
||||||
|
{
|
||||||
|
assert( i != NULL );
|
||||||
|
|
||||||
|
RemIntServer(INTB_VERTB,(struct Interrupt *)i);
|
||||||
|
}
|
||||||
101
library/amiga_setsuperattrs.c
Normal file
101
library/amiga_setsuperattrs.c
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_setsuperattrs.c,v 1.1.1.1 2004-07-26 16:30:21 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 __PPC__
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <intuition/intuition.h>
|
||||||
|
#include <intuition/classes.h>
|
||||||
|
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
STATIC ULONG
|
||||||
|
SetSuperAttrsA(Class * cl,Object * obj,struct TagItem * tags)
|
||||||
|
{
|
||||||
|
ULONG result = 0;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
SHOWPOINTER(cl);
|
||||||
|
SHOWPOINTER(obj);
|
||||||
|
SHOWPOINTER(tags);
|
||||||
|
|
||||||
|
assert( cl != NULL && obj != NULL );
|
||||||
|
|
||||||
|
if(cl != NULL && obj != NULL)
|
||||||
|
{
|
||||||
|
struct opSet ops;
|
||||||
|
|
||||||
|
ops.MethodID = OM_SET;
|
||||||
|
ops.ops_AttrList = tags;
|
||||||
|
ops.ops_GInfo = NULL;
|
||||||
|
|
||||||
|
result = CallHookA(&cl->cl_Super->cl_Dispatcher,obj,&ops);
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN(result);
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
SetSuperAttrs(Class * cl,Object * obj,ULONG tag1,...)
|
||||||
|
{
|
||||||
|
ULONG result = 0;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
SHOWPOINTER(cl);
|
||||||
|
SHOWPOINTER(obj);
|
||||||
|
SHOWVALUE(tag1);
|
||||||
|
|
||||||
|
assert( cl != NULL && obj != NULL );
|
||||||
|
|
||||||
|
if(cl != NULL && obj != NULL)
|
||||||
|
result = SetSuperAttrsA(cl,obj,(struct TagItem *)&tag1);
|
||||||
|
|
||||||
|
RETURN(result);
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* __PPC__ */
|
||||||
54
library/amiga_timedelay.c
Normal file
54
library/amiga_timedelay.c
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_timedelay.c,v 1.1.1.1 2004-07-26 16:30:21 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <devices/timer.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
TimeDelay(LONG unit,ULONG seconds,ULONG micros)
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
LONG error;
|
||||||
|
|
||||||
|
tv.tv_secs = seconds;
|
||||||
|
tv.tv_micro = micros;
|
||||||
|
|
||||||
|
error = DoTimer(&tv,unit,TR_ADDREQUEST);
|
||||||
|
|
||||||
|
return(error);
|
||||||
|
}
|
||||||
60
library/amiga_waitbeam.c
Normal file
60
library/amiga_waitbeam.c
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* $Id: amiga_waitbeam.c,v 1.1.1.1 2004-07-26 16:30:22 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <exec/interrupts.h>
|
||||||
|
#include <hardware/intbits.h>
|
||||||
|
#include <graphics/graphint.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <proto/graphics.h>
|
||||||
|
#include <clib/alib_protos.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#define DO_NOTHING ((void)0)
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
waitbeam(LONG position)
|
||||||
|
{
|
||||||
|
while(position > VBeamPos())
|
||||||
|
DO_NOTHING;
|
||||||
|
}
|
||||||
38
library/c.lib_rev.c
Normal file
38
library/c.lib_rev.c
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* $Id: c.lib_rev.c,v 1.1.1.1 2004-07-26 16:30:22 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "c.lib_rev.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
char __c_lib_version[] = VERSTAG;
|
||||||
6
library/c.lib_rev.h
Normal file
6
library/c.lib_rev.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#define VERSION 1
|
||||||
|
#define REVISION 169
|
||||||
|
#define DATE "8.8.2004"
|
||||||
|
#define VERS "c.lib 1.169"
|
||||||
|
#define VSTRING "c.lib 1.169 (8.8.2004)\r\n"
|
||||||
|
#define VERSTAG "\0$VER: c.lib 1.169 (8.8.2004)"
|
||||||
1
library/c.lib_rev.rev
Normal file
1
library/c.lib_rev.rev
Normal file
@@ -0,0 +1 @@
|
|||||||
|
169
|
||||||
22
library/crt0.S
Normal file
22
library/crt0.S
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// $Id: crt0.S,v 1.1.1.1 2004-07-26 16:30:22 obarthel Exp $
|
||||||
|
//
|
||||||
|
// :ts=4
|
||||||
|
//
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
.globl _main
|
||||||
|
.globl _start
|
||||||
|
|
||||||
|
_start:
|
||||||
|
|
||||||
|
#if defined(SMALL_DATA)
|
||||||
|
/* Don't do a function call here, since that
|
||||||
|
means LR has to be saved */
|
||||||
|
lis r13, _SDA_BASE_@ha
|
||||||
|
addi r13, r13, _SDA_BASE_@l
|
||||||
|
#endif
|
||||||
|
|
||||||
|
b _main
|
||||||
|
|
||||||
138
library/crtbegin.c
Normal file
138
library/crtbegin.c
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
/*
|
||||||
|
* $Id: crtbegin.c,v 1.1.1.1 2004-07-26 16:30:22 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Handles global constructors and destructors.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <exec/types.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(__amigaos4__)
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Dummy constructor and destructor array. The linker script will put these at the
|
||||||
|
* very beginning of section ".ctors" and ".dtors". crtend.o contains a similar entry
|
||||||
|
* with a NULL pointer entry and is put at the end of the sections. This way, the init
|
||||||
|
* code can find the global constructor/destructor pointers
|
||||||
|
*/
|
||||||
|
static void (*__CTOR_LIST__[1]) (void) __attribute__((section(".ctors"))) = { (void *)-1 };
|
||||||
|
static void (*__DTOR_LIST__[1]) (void) __attribute__((section(".dtors"))) = { (void *)-1 };
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
static void
|
||||||
|
_do_ctors(void)
|
||||||
|
{
|
||||||
|
void (**pFuncPtr)(void);
|
||||||
|
|
||||||
|
/* Skip the first entry in the list (it's -1 anyway) */
|
||||||
|
pFuncPtr = __CTOR_LIST__ + 1;
|
||||||
|
|
||||||
|
/* Call all constructors in forward order */
|
||||||
|
while (*pFuncPtr != NULL)
|
||||||
|
(**pFuncPtr++)();
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
static void
|
||||||
|
_do_dtors(void)
|
||||||
|
{
|
||||||
|
ULONG i = (ULONG)__DTOR_LIST__[0];
|
||||||
|
void (**pFuncPtr)(void);
|
||||||
|
|
||||||
|
if (i == ~0UL)
|
||||||
|
{
|
||||||
|
/* Find the end of the destructors list */
|
||||||
|
i = 1;
|
||||||
|
|
||||||
|
while (__DTOR_LIST__[i] != NULL)
|
||||||
|
i++;
|
||||||
|
|
||||||
|
/* We're at the NULL entry now. Go back by one */
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Call all destructors in reverse order */
|
||||||
|
pFuncPtr = __DTOR_LIST__ + i;
|
||||||
|
while (i-- > 0)
|
||||||
|
(**pFuncPtr--)();
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
typedef void (*func_ptr)(void);
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
static void
|
||||||
|
_do_ctors(void)
|
||||||
|
{
|
||||||
|
extern func_ptr __CTOR_LIST__[];
|
||||||
|
ULONG nptrs = (ULONG)__CTOR_LIST__[0];
|
||||||
|
ULONG i;
|
||||||
|
|
||||||
|
for(i = nptrs ; i > 0 ; i--)
|
||||||
|
__CTOR_LIST__[i]();
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
static void
|
||||||
|
_do_dtors(void)
|
||||||
|
{
|
||||||
|
extern func_ptr __DTOR_LIST__[];
|
||||||
|
extern jmp_buf __exit_jmp_buf;
|
||||||
|
ULONG nptrs = (ULONG)__DTOR_LIST__[0];
|
||||||
|
static ULONG i;
|
||||||
|
|
||||||
|
/* If one of the destructors drops into
|
||||||
|
* exit(), processing will continue with
|
||||||
|
* the next following destructor.
|
||||||
|
*/
|
||||||
|
(void)setjmp(__exit_jmp_buf);
|
||||||
|
|
||||||
|
while(i++ < nptrs)
|
||||||
|
__DTOR_LIST__[i]();
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /*__amigaos4__ */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* FIXME: Do we need to put these in .init/.fini sections? */
|
||||||
|
|
||||||
|
//void _init(void) __attribute__((section(".init")));
|
||||||
|
//void _fini(void) __attribute__((section(".fini")));
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
_init(void)
|
||||||
|
{
|
||||||
|
_do_ctors();
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
_fini(void)
|
||||||
|
{
|
||||||
|
_do_dtors();
|
||||||
|
}
|
||||||
18
library/crtend.c
Normal file
18
library/crtend.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* $Id: crtend.c,v 1.1.1.1 2004-07-26 16:30:22 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* End markers for the CTOR and DTOR list.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(__amigaos4__)
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
static volatile void (*__CTOR_LIST__[1]) (void) __attribute__((used,section(".ctors"))) = { (void *)0 };
|
||||||
|
static volatile void (*__DTOR_LIST__[1]) (void) __attribute__((used,section(".dtors"))) = { (void *)0 };
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /*__amigaos4__ */
|
||||||
61
library/ctype_headers.h
Normal file
61
library/ctype_headers.h
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_headers.h,v 1.1.1.1 2004-07-26 16:30:22 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#define _CTYPE_HEADERS_H
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _LOCALE_HEADERS_H
|
||||||
|
#include "locale_headers.h"
|
||||||
|
#endif /* _LOCALE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _STDLIB_LOCALE_UTILITY_H
|
||||||
|
#include "stdlib_locale_utility.h"
|
||||||
|
#endif /* _STDLIB_LOCALE_UTILITY_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "macros.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
64
library/ctype_isalnum.c
Normal file
64
library/ctype_isalnum.c
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_isalnum.c,v 1.1.1.1 2004-07-26 16:30:22 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#include "ctype_headers.h"
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#undef isalnum
|
||||||
|
#undef isalpha
|
||||||
|
#undef isdigit
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
isalnum(int c)
|
||||||
|
{
|
||||||
|
DECLARE_LOCALEBASE();
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if(__locale_table[LC_CTYPE] != NULL)
|
||||||
|
{
|
||||||
|
assert( LocaleBase != NULL );
|
||||||
|
|
||||||
|
result = IsAlNum(__locale_table[LC_CTYPE],(ULONG)c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = isalpha(c) || isdigit(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
63
library/ctype_isalpha.c
Normal file
63
library/ctype_isalpha.c
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_isalpha.c,v 1.1.1.1 2004-07-26 16:30:22 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#include "ctype_headers.h"
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#undef isalpha
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
isalpha(int c)
|
||||||
|
{
|
||||||
|
DECLARE_LOCALEBASE();
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if(__locale_table[LC_CTYPE] != NULL)
|
||||||
|
{
|
||||||
|
assert( LocaleBase != NULL );
|
||||||
|
|
||||||
|
result = IsAlpha(__locale_table[LC_CTYPE],(ULONG)c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = (('a' <= c && c <= 'z') ||
|
||||||
|
('A' <= c && c <= 'Z'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
56
library/ctype_isascii.c
Normal file
56
library/ctype_isascii.c
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_isascii.c,v 1.1.1.1 2004-07-26 16:30:22 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#include "ctype_headers.h"
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#undef isascii
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int isascii(int c);
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
isascii(int c)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
|
result = (0 <= c && c <= 127);
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
62
library/ctype_iscntrl.c
Normal file
62
library/ctype_iscntrl.c
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_iscntrl.c,v 1.1.1.1 2004-07-26 16:30:23 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#include "ctype_headers.h"
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#undef iscntrl
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
iscntrl(int c)
|
||||||
|
{
|
||||||
|
DECLARE_LOCALEBASE();
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if(__locale_table[LC_CTYPE] != NULL)
|
||||||
|
{
|
||||||
|
assert( LocaleBase != NULL );
|
||||||
|
|
||||||
|
result = IsCntrl(__locale_table[LC_CTYPE],(ULONG)c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = (('\0' <= c && c < ' ') || (c == 127));
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
62
library/ctype_isdigit.c
Normal file
62
library/ctype_isdigit.c
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_isdigit.c,v 1.1.1.1 2004-07-26 16:30:23 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#include "ctype_headers.h"
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#undef isdigit
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
isdigit(int c)
|
||||||
|
{
|
||||||
|
DECLARE_LOCALEBASE();
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if(__locale_table[LC_CTYPE] != NULL)
|
||||||
|
{
|
||||||
|
assert( LocaleBase != NULL );
|
||||||
|
|
||||||
|
result = IsDigit(__locale_table[LC_CTYPE],(ULONG)c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = ('0' <= c && c <= '9');
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
62
library/ctype_isgraph.c
Normal file
62
library/ctype_isgraph.c
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_isgraph.c,v 1.1.1.1 2004-07-26 16:30:23 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#include "ctype_headers.h"
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#undef isgraph
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
isgraph(int c)
|
||||||
|
{
|
||||||
|
DECLARE_LOCALEBASE();
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if(__locale_table[LC_CTYPE] != NULL)
|
||||||
|
{
|
||||||
|
assert( LocaleBase != NULL );
|
||||||
|
|
||||||
|
result = IsGraph(__locale_table[LC_CTYPE],(ULONG)c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = (' ' < c && c < 127);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
62
library/ctype_islower.c
Normal file
62
library/ctype_islower.c
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_islower.c,v 1.1.1.1 2004-07-26 16:30:23 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#include "ctype_headers.h"
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#undef islower
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
islower(int c)
|
||||||
|
{
|
||||||
|
DECLARE_LOCALEBASE();
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if(__locale_table[LC_CTYPE] != NULL)
|
||||||
|
{
|
||||||
|
assert( LocaleBase != NULL );
|
||||||
|
|
||||||
|
result = IsLower(__locale_table[LC_CTYPE],(ULONG)c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = ('a' <= c && c <= 'z');
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
62
library/ctype_isprint.c
Normal file
62
library/ctype_isprint.c
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_isprint.c,v 1.1.1.1 2004-07-26 16:30:23 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#include "ctype_headers.h"
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#undef isprint
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
isprint(int c)
|
||||||
|
{
|
||||||
|
DECLARE_LOCALEBASE();
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if(__locale_table[LC_CTYPE] != NULL)
|
||||||
|
{
|
||||||
|
assert( LocaleBase != NULL );
|
||||||
|
|
||||||
|
result = IsPrint(__locale_table[LC_CTYPE],(ULONG)c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = (' ' <= c && c <= '~');
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
65
library/ctype_ispunct.c
Normal file
65
library/ctype_ispunct.c
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_ispunct.c,v 1.1.1.1 2004-07-26 16:30:23 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#include "ctype_headers.h"
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#undef ispunct
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
ispunct(int c)
|
||||||
|
{
|
||||||
|
DECLARE_LOCALEBASE();
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if(__locale_table[LC_CTYPE] != NULL)
|
||||||
|
{
|
||||||
|
assert( LocaleBase != NULL );
|
||||||
|
|
||||||
|
result = IsPunct(__locale_table[LC_CTYPE],(ULONG)c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = (('!' <= c && c <= '/') ||
|
||||||
|
(':' <= c && c <= '@') ||
|
||||||
|
('[' <= c && c <= '`') ||
|
||||||
|
('{' <= c && c <= '~'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
67
library/ctype_isspace.c
Normal file
67
library/ctype_isspace.c
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_isspace.c,v 1.1.1.1 2004-07-26 16:30:23 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#include "ctype_headers.h"
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#undef isspace
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
isspace(int c)
|
||||||
|
{
|
||||||
|
DECLARE_LOCALEBASE();
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if(__locale_table[LC_CTYPE] != NULL)
|
||||||
|
{
|
||||||
|
assert( LocaleBase != NULL );
|
||||||
|
|
||||||
|
result = IsSpace(__locale_table[LC_CTYPE],(ULONG)c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = (c == '\t' ||
|
||||||
|
c == '\r' ||
|
||||||
|
c == '\n' ||
|
||||||
|
c == '\v' ||
|
||||||
|
c == '\f' ||
|
||||||
|
c == ' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
62
library/ctype_isupper.c
Normal file
62
library/ctype_isupper.c
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_isupper.c,v 1.1.1.1 2004-07-26 16:30:24 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#include "ctype_headers.h"
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#undef isupper
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
isupper(int c)
|
||||||
|
{
|
||||||
|
DECLARE_LOCALEBASE();
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if(__locale_table[LC_CTYPE] != NULL)
|
||||||
|
{
|
||||||
|
assert( LocaleBase != NULL );
|
||||||
|
|
||||||
|
result = IsUpper(__locale_table[LC_CTYPE],(ULONG)c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = ('A' <= c && c <= 'Z');
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
64
library/ctype_isxdigit.c
Normal file
64
library/ctype_isxdigit.c
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_isxdigit.c,v 1.1.1.1 2004-07-26 16:30:24 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#include "ctype_headers.h"
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#undef isxdigit
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
isxdigit(int c)
|
||||||
|
{
|
||||||
|
DECLARE_LOCALEBASE();
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if(__locale_table[LC_CTYPE] != NULL)
|
||||||
|
{
|
||||||
|
assert( LocaleBase != NULL );
|
||||||
|
|
||||||
|
result = IsXDigit(__locale_table[LC_CTYPE],(ULONG)c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = (('0' <= c && c <= '9') ||
|
||||||
|
('a' <= c && c <= 'f') ||
|
||||||
|
('A' <= c && c <= 'F'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
196
library/ctype_table.c
Normal file
196
library/ctype_table.c
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_table.c,v 1.1.1.1 2004-07-26 16:30:24 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define __C_MACROS__
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* The construction of this table is rather peculiar. The assumption is that
|
||||||
|
the table index from which a flag value could be fetched is in the range
|
||||||
|
-128..255 since the character to be tested could be a signed or unsigned
|
||||||
|
8 bit value. The table access pointer (declared below) therefore points
|
||||||
|
to the 128th byte of '__ctype_data[]'. */
|
||||||
|
static const unsigned char __ctype_data[3 * 128] =
|
||||||
|
{
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
|
||||||
|
/* 0 */ __CTYPE_CONTROL,
|
||||||
|
/* 1 */ __CTYPE_CONTROL,
|
||||||
|
/* 2 */ __CTYPE_CONTROL,
|
||||||
|
/* 3 */ __CTYPE_CONTROL,
|
||||||
|
/* 4 */ __CTYPE_CONTROL,
|
||||||
|
/* 5 */ __CTYPE_CONTROL,
|
||||||
|
/* 6 */ __CTYPE_CONTROL,
|
||||||
|
/* 7 */ __CTYPE_CONTROL,
|
||||||
|
/* 8 */ __CTYPE_CONTROL,
|
||||||
|
/* 9 */ __CTYPE_CONTROL|__CTYPE_WHITE_SPACE,
|
||||||
|
/* 10 */ __CTYPE_CONTROL|__CTYPE_WHITE_SPACE,
|
||||||
|
/* 11 */ __CTYPE_CONTROL|__CTYPE_WHITE_SPACE,
|
||||||
|
/* 12 */ __CTYPE_CONTROL|__CTYPE_WHITE_SPACE,
|
||||||
|
/* 13 */ __CTYPE_CONTROL|__CTYPE_WHITE_SPACE,
|
||||||
|
/* 14 */ __CTYPE_CONTROL,
|
||||||
|
/* 15 */ __CTYPE_CONTROL,
|
||||||
|
/* 16 */ __CTYPE_CONTROL,
|
||||||
|
/* 17 */ __CTYPE_CONTROL,
|
||||||
|
/* 18 */ __CTYPE_CONTROL,
|
||||||
|
/* 19 */ __CTYPE_CONTROL,
|
||||||
|
/* 20 */ __CTYPE_CONTROL,
|
||||||
|
/* 21 */ __CTYPE_CONTROL,
|
||||||
|
/* 22 */ __CTYPE_CONTROL,
|
||||||
|
/* 23 */ __CTYPE_CONTROL,
|
||||||
|
/* 24 */ __CTYPE_CONTROL,
|
||||||
|
/* 25 */ __CTYPE_CONTROL,
|
||||||
|
/* 26 */ __CTYPE_CONTROL,
|
||||||
|
/* 27 */ __CTYPE_CONTROL,
|
||||||
|
/* 28 */ __CTYPE_CONTROL,
|
||||||
|
/* 29 */ __CTYPE_CONTROL,
|
||||||
|
/* 30 */ __CTYPE_CONTROL,
|
||||||
|
/* 31 */ __CTYPE_CONTROL,
|
||||||
|
/* 32, ' ' */ __CTYPE_PRINTABLE|__CTYPE_WHITE_SPACE,
|
||||||
|
/* 33, '!' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 34, '"' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 35, '#' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 36, '$' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 37, '%' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 38, '&' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 39, ''' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 40, '(' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 41, ')' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 42, '*' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 43, '+' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 44, ',' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 45, '-' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 46, '.' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 47, '/' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 48, '0' */ __CTYPE_DIGIT|__CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE,
|
||||||
|
/* 49, '1' */ __CTYPE_DIGIT|__CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE,
|
||||||
|
/* 50, '2' */ __CTYPE_DIGIT|__CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE,
|
||||||
|
/* 51, '3' */ __CTYPE_DIGIT|__CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE,
|
||||||
|
/* 52, '4' */ __CTYPE_DIGIT|__CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE,
|
||||||
|
/* 53, '5' */ __CTYPE_DIGIT|__CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE,
|
||||||
|
/* 54, '6' */ __CTYPE_DIGIT|__CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE,
|
||||||
|
/* 55, '7' */ __CTYPE_DIGIT|__CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE,
|
||||||
|
/* 56, '8' */ __CTYPE_DIGIT|__CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE,
|
||||||
|
/* 57, '9' */ __CTYPE_DIGIT|__CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE,
|
||||||
|
/* 58, ':' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 59, ';' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 60, '<' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 61, '=' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 62, '>' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 63, '?' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 64, '@' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 65, 'A' */ __CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 66, 'B' */ __CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 67, 'C' */ __CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 68, 'D' */ __CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 69, 'E' */ __CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 70, 'F' */ __CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 71, 'G' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 72, 'H' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 73, 'I' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 74, 'J' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 75, 'K' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 76, 'L' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 77, 'M' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 78, 'N' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 79, 'O' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 80, 'P' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 81, 'Q' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 82, 'R' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 83, 'S' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 84, 'T' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 85, 'U' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 86, 'V' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 87, 'W' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 88, 'X' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 89, 'Y' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 90, 'Z' */ __CTYPE_PRINTABLE|__CTYPE_UPPER_CASE,
|
||||||
|
/* 91, '[' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 92, '\' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 93, ']' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 94, '^' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 95, '_' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 96, '`' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 97, 'a' */ __CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 98, 'b' */ __CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 99, 'c' */ __CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 100, 'd' */ __CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 101, 'e' */ __CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 102, 'f' */ __CTYPE_HEX_DIGIT|__CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 103, 'g' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 104, 'h' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 105, 'i' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 106, 'j' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 107, 'k' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 108, 'l' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 109, 'm' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 110, 'n' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 111, 'o' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 112, 'p' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 113, 'q' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 114, 'r' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 115, 's' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 116, 't' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 117, 'u' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 118, 'v' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 119, 'w' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 120, 'x' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 121, 'y' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 122, 'z' */ __CTYPE_PRINTABLE|__CTYPE_LOWER_CASE,
|
||||||
|
/* 123, '{' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 124, '|' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 125, '}' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 126, '~' */ __CTYPE_PUNCTUATION|__CTYPE_PRINTABLE,
|
||||||
|
/* 127 */ __CTYPE_CONTROL,
|
||||||
|
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
const unsigned char * const __ctype_table = &__ctype_data[128];
|
||||||
58
library/ctype_tolower.c
Normal file
58
library/ctype_tolower.c
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_tolower.c,v 1.1.1.1 2004-07-26 16:30:25 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#include "ctype_headers.h"
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
tolower(int c)
|
||||||
|
{
|
||||||
|
DECLARE_LOCALEBASE();
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if(__locale_table[LC_CTYPE] != NULL)
|
||||||
|
{
|
||||||
|
assert( LocaleBase != NULL );
|
||||||
|
|
||||||
|
result = ConvToLower(__locale_table[LC_CTYPE],(ULONG)c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = ('A' <= c && c <= 'Z') ? (c + ('a' - 'A')) : c;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
58
library/ctype_toupper.c
Normal file
58
library/ctype_toupper.c
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* $Id: ctype_toupper.c,v 1.1.1.1 2004-07-26 16:30:25 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _CTYPE_HEADERS_H
|
||||||
|
#include "ctype_headers.h"
|
||||||
|
#endif /* _CTYPE_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
toupper(int c)
|
||||||
|
{
|
||||||
|
DECLARE_LOCALEBASE();
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if(__locale_table[LC_CTYPE] != NULL)
|
||||||
|
{
|
||||||
|
assert( LocaleBase != NULL );
|
||||||
|
|
||||||
|
result = ConvToUpper(__locale_table[LC_CTYPE],(ULONG)c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = ('a' <= c && c <= 'z') ? (c - ('a' - 'A')) : c;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
342
library/debug.c
Normal file
342
library/debug.c
Normal file
@@ -0,0 +1,342 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug.c,v 1.1.1.1 2004-07-26 16:30:25 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=8
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#define NULL ((void *)0L)
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
|
#define DEBUG 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
extern void KPrintF(const char * format,...);
|
||||||
|
extern void KPutFmt(const char * format,va_list arg);
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#define DEBUGLEVEL_OnlyAsserts 0
|
||||||
|
#define DEBUGLEVEL_Reports 1
|
||||||
|
#define DEBUGLEVEL_CallTracing 2
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
extern int __debug_level;
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
static int indent_level = 0;
|
||||||
|
|
||||||
|
static char program_name[40];
|
||||||
|
static int program_name_len = 0;
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
_SETPROGRAMNAME(char *name)
|
||||||
|
{
|
||||||
|
if(name != NULL && name[0] != '\0')
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for(i = 0 ; name[i] != '\0' && i < (int)sizeof(program_name)-1 ; i++)
|
||||||
|
program_name[i] = name[i];
|
||||||
|
|
||||||
|
program_name[i] = '\0';
|
||||||
|
|
||||||
|
program_name_len = i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
program_name_len = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
_SETDEBUGLEVEL(int level)
|
||||||
|
{
|
||||||
|
int old_level = __debug_level;
|
||||||
|
|
||||||
|
__debug_level = level;
|
||||||
|
|
||||||
|
return(old_level);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
_GETDEBUGLEVEL(void)
|
||||||
|
{
|
||||||
|
return(__debug_level);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
static int previous_debug_level = -1;
|
||||||
|
|
||||||
|
void
|
||||||
|
_PUSHDEBUGLEVEL(int level)
|
||||||
|
{
|
||||||
|
previous_debug_level = _SETDEBUGLEVEL(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_POPDEBUGLEVEL(void)
|
||||||
|
{
|
||||||
|
if(previous_debug_level != -1)
|
||||||
|
{
|
||||||
|
_SETDEBUGLEVEL(previous_debug_level);
|
||||||
|
|
||||||
|
previous_debug_level = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
static void
|
||||||
|
_INDENT(void)
|
||||||
|
{
|
||||||
|
if(program_name_len > 0)
|
||||||
|
KPrintF("(%s) ",program_name);
|
||||||
|
|
||||||
|
if(__debug_level >= DEBUGLEVEL_CallTracing)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for(i = 0 ; i < indent_level ; i++)
|
||||||
|
KPrintF(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
_SHOWVALUE(
|
||||||
|
unsigned long value,
|
||||||
|
int size,
|
||||||
|
const char *name,
|
||||||
|
const char *file,
|
||||||
|
int line)
|
||||||
|
{
|
||||||
|
if(__debug_level >= DEBUGLEVEL_Reports)
|
||||||
|
{
|
||||||
|
char *fmt;
|
||||||
|
|
||||||
|
switch(size)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
|
||||||
|
fmt = "%s:%ld:%s = %ld, 0x%02lx";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
|
||||||
|
fmt = "%s:%ld:%s = %ld, 0x%04lx";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
|
||||||
|
fmt = "%s:%ld:%s = %ld, 0x%08lx";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_INDENT();
|
||||||
|
|
||||||
|
KPrintF(fmt,file,line,name,value,value);
|
||||||
|
|
||||||
|
if(size == 1 && value < 256)
|
||||||
|
{
|
||||||
|
if(value < ' ' || (value >= 127 && value < 160))
|
||||||
|
KPrintF(", '\\x%02lx'",value);
|
||||||
|
else
|
||||||
|
KPrintF(", '%lc'",value);
|
||||||
|
}
|
||||||
|
|
||||||
|
KPrintF("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
_SHOWPOINTER(
|
||||||
|
const void *pointer,
|
||||||
|
const char *name,
|
||||||
|
const char *file,
|
||||||
|
int line)
|
||||||
|
{
|
||||||
|
if(__debug_level >= DEBUGLEVEL_Reports)
|
||||||
|
{
|
||||||
|
char *fmt;
|
||||||
|
|
||||||
|
_INDENT();
|
||||||
|
|
||||||
|
if(pointer != NULL)
|
||||||
|
fmt = "%s:%ld:%s = 0x%08lx\n";
|
||||||
|
else
|
||||||
|
fmt = "%s:%ld:%s = NULL\n";
|
||||||
|
|
||||||
|
KPrintF(fmt,file,line,name,pointer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
_SHOWSTRING(
|
||||||
|
const char *string,
|
||||||
|
const char *name,
|
||||||
|
const char *file,
|
||||||
|
int line)
|
||||||
|
{
|
||||||
|
if(__debug_level >= DEBUGLEVEL_Reports)
|
||||||
|
{
|
||||||
|
_INDENT();
|
||||||
|
KPrintF("%s:%ld:%s = 0x%08lx \"%s\"\n",file,line,name,string,string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
_SHOWMSG(
|
||||||
|
const char *string,
|
||||||
|
const char *file,
|
||||||
|
int line)
|
||||||
|
{
|
||||||
|
if(__debug_level >= DEBUGLEVEL_Reports)
|
||||||
|
{
|
||||||
|
_INDENT();
|
||||||
|
KPrintF("%s:%ld:%s\n",file,line,string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
_DPRINTF_HEADER(
|
||||||
|
const char *file,
|
||||||
|
int line)
|
||||||
|
{
|
||||||
|
if(__debug_level >= DEBUGLEVEL_Reports)
|
||||||
|
{
|
||||||
|
_INDENT();
|
||||||
|
KPrintF("%s:%ld:",file,line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_DPRINTF(const char *fmt,...)
|
||||||
|
{
|
||||||
|
if(__debug_level >= DEBUGLEVEL_Reports)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start(args,fmt);
|
||||||
|
KPutFmt((char *)fmt,args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
KPrintF("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_DLOG(const char *fmt,...)
|
||||||
|
{
|
||||||
|
if(__debug_level >= DEBUGLEVEL_Reports)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start(args,fmt);
|
||||||
|
KPutFmt((char *)fmt,args);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
_ENTER(
|
||||||
|
const char *file,
|
||||||
|
int line,
|
||||||
|
const char *function)
|
||||||
|
{
|
||||||
|
if(__debug_level >= DEBUGLEVEL_CallTracing)
|
||||||
|
{
|
||||||
|
_INDENT();
|
||||||
|
KPrintF("%s:%ld:Entering %s\n",file,line,function);
|
||||||
|
}
|
||||||
|
|
||||||
|
indent_level++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_LEAVE(
|
||||||
|
const char *file,
|
||||||
|
int line,
|
||||||
|
const char *function)
|
||||||
|
{
|
||||||
|
indent_level--;
|
||||||
|
|
||||||
|
if(__debug_level >= DEBUGLEVEL_CallTracing)
|
||||||
|
{
|
||||||
|
_INDENT();
|
||||||
|
KPrintF("%s:%ld: Leaving %s\n",file,line,function);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_RETURN(
|
||||||
|
const char *file,
|
||||||
|
int line,
|
||||||
|
const char *function,
|
||||||
|
unsigned long result)
|
||||||
|
{
|
||||||
|
indent_level--;
|
||||||
|
|
||||||
|
if(__debug_level >= DEBUGLEVEL_CallTracing)
|
||||||
|
{
|
||||||
|
_INDENT();
|
||||||
|
KPrintF("%s:%ld: Leaving %s (result 0x%08lx, %ld)\n",file,line,function,result,result);
|
||||||
|
}
|
||||||
|
}
|
||||||
191
library/debug.h
Normal file
191
library/debug.h
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug.h,v 1.1.1.1 2004-07-26 16:30:26 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=8
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _DEBUG_H
|
||||||
|
#define _DEBUG_H
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* IMPORTANT: If DEBUG is redefined, it must happen only here. This
|
||||||
|
* will cause all modules to depend upon it to be rebuilt
|
||||||
|
* by the smakefile (that is, provided the smakefile has
|
||||||
|
* all the necessary dependency lines in place).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*#define DEBUG*/
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#define PUSH_REPORTS() PUSHDEBUGLEVEL(1)
|
||||||
|
#define PUSH_CALLS() PUSHDEBUGLEVEL(2)
|
||||||
|
#define PUSH_ALL() PUSHDEBUGLEVEL(2)
|
||||||
|
#define POP() POPDEBUGLEVEL()
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
extern void kprintf(const char *format,...);
|
||||||
|
extern void abort(void);
|
||||||
|
extern char * __program_name;
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void _SHOWVALUE(unsigned long value,int size,const char *name,const char *file,int line);
|
||||||
|
void _SHOWPOINTER(const void *p,const char *name,const char *file,int line);
|
||||||
|
void _SHOWSTRING(const char *string,const char *name,const char *file,int line);
|
||||||
|
void _SHOWMSG(const char *msg,const char *file,int line);
|
||||||
|
void _ENTER(const char *file,int line,const char *function);
|
||||||
|
void _LEAVE(const char *file,int line,const char *function);
|
||||||
|
void _RETURN(const char *file,int line,const char *function,unsigned long result);
|
||||||
|
void _DPRINTF_HEADER(const char *file,int line);
|
||||||
|
void _DPRINTF(const char *format,...);
|
||||||
|
void _DLOG(const char *format,...);
|
||||||
|
int _SETDEBUGLEVEL(int level);
|
||||||
|
void _PUSHDEBUGLEVEL(int level);
|
||||||
|
void _POPDEBUGLEVEL(void);
|
||||||
|
int _GETDEBUGLEVEL(void);
|
||||||
|
void _SETPROGRAMNAME(char *name);
|
||||||
|
|
||||||
|
#if defined(__SASC)
|
||||||
|
#define ENTER() _ENTER(__FILE__,__LINE__,__FUNC__)
|
||||||
|
#define LEAVE() _LEAVE(__FILE__,__LINE__,__FUNC__)
|
||||||
|
#define RETURN(r) _RETURN(__FILE__,__LINE__,__FUNC__,(unsigned long)r)
|
||||||
|
#define SHOWVALUE(v) _SHOWVALUE((unsigned long)v,sizeof(v),#v,__FILE__,__LINE__)
|
||||||
|
#define SHOWPOINTER(p) _SHOWPOINTER(p,#p,__FILE__,__LINE__)
|
||||||
|
#define SHOWSTRING(s) _SHOWSTRING(s,#s,__FILE__,__LINE__)
|
||||||
|
#define SHOWMSG(s) _SHOWMSG(s,__FILE__,__LINE__)
|
||||||
|
#define D(s) do { _DPRINTF_HEADER(__FILE__,__LINE__); _DPRINTF s; } while(0)
|
||||||
|
#define PRINTHEADER() _DPRINTF_HEADER(__FILE__,__LINE__)
|
||||||
|
#define PRINTF(s) _DLOG s
|
||||||
|
#define LOG(s) do { _DPRINTF_HEADER(__FILE__,__LINE__); _DLOG("<%s()>:",__FUNC__); _DLOG s; } while(0)
|
||||||
|
#define SETDEBUGLEVEL(l) _SETDEBUGLEVEL(l)
|
||||||
|
#define PUSHDEBUGLEVEL(l) _PUSHDEBUGLEVEL(l)
|
||||||
|
#define POPDEBUGLEVEL() _POPDEBUGLEVEL()
|
||||||
|
#define SETPROGRAMNAME(n) _SETPROGRAMNAME(n)
|
||||||
|
#define GETDEBUGLEVEL() _GETDEBUGLEVEL()
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#define ENTER() _ENTER(__FILE__,__LINE__,__FUNCTION__)
|
||||||
|
#define LEAVE() _LEAVE(__FILE__,__LINE__,__FUNCTION__)
|
||||||
|
#define RETURN(r) _RETURN(__FILE__,__LINE__,__FUNCTION__,(unsigned long)r)
|
||||||
|
#define SHOWVALUE(v) _SHOWVALUE((unsigned long)v,sizeof(v),#v,__FILE__,__LINE__)
|
||||||
|
#define SHOWPOINTER(p) _SHOWPOINTER(p,#p,__FILE__,__LINE__)
|
||||||
|
#define SHOWSTRING(s) _SHOWSTRING(s,#s,__FILE__,__LINE__)
|
||||||
|
#define SHOWMSG(s) _SHOWMSG(s,__FILE__,__LINE__)
|
||||||
|
#define D(s) do { _DPRINTF_HEADER(__FILE__,__LINE__); _DPRINTF s; } while(0)
|
||||||
|
#define PRINTHEADER() _DPRINTF_HEADER(__FILE__,__LINE__)
|
||||||
|
#define PRINTF(s) _DLOG s
|
||||||
|
#define LOG(s) do { _DPRINTF_HEADER(__FILE__,__LINE__); _DLOG("<%s()>:",__FUNCTION__); _DLOG s; } while(0)
|
||||||
|
#define SETDEBUGLEVEL(l) _SETDEBUGLEVEL(l)
|
||||||
|
#define PUSHDEBUGLEVEL(l) _PUSHDEBUGLEVEL(l)
|
||||||
|
#define POPDEBUGLEVEL() _POPDEBUGLEVEL()
|
||||||
|
#define SETPROGRAMNAME(n) _SETPROGRAMNAME(n)
|
||||||
|
#define GETDEBUGLEVEL() _GETDEBUGLEVEL()
|
||||||
|
#else
|
||||||
|
#define __FUNC__ ""
|
||||||
|
#define ENTER() _ENTER(__FILE__,__LINE__,__FUNC__)
|
||||||
|
#define LEAVE() _LEAVE(__FILE__,__LINE__,__FUNC__)
|
||||||
|
#define RETURN(r) _RETURN(__FILE__,__LINE__,__FUNC__,(unsigned long)r)
|
||||||
|
#define SHOWVALUE(v) _SHOWVALUE((unsigned long)v,sizeof(v),#v,__FILE__,__LINE__)
|
||||||
|
#define SHOWPOINTER(p) _SHOWPOINTER(p,#p,__FILE__,__LINE__)
|
||||||
|
#define SHOWSTRING(s) _SHOWSTRING(s,#s,__FILE__,__LINE__)
|
||||||
|
#define SHOWMSG(s) _SHOWMSG(s,__FILE__,__LINE__)
|
||||||
|
#define D(s) do { _DPRINTF_HEADER(__FILE__,__LINE__); _DPRINTF s; } while(0)
|
||||||
|
#define PRINTHEADER() _DPRINTF_HEADER(__FILE__,__LINE__)
|
||||||
|
#define PRINTF(s) _DLOG s
|
||||||
|
#define LOG(s) do { _DPRINTF_HEADER(__FILE__,__LINE__); _DLOG("<%s()>:",__FUNC__); _DLOG s; } while(0)
|
||||||
|
#define SETDEBUGLEVEL(l) _SETDEBUGLEVEL(l)
|
||||||
|
#define PUSHDEBUGLEVEL(l) _PUSHDEBUGLEVEL(l)
|
||||||
|
#define POPDEBUGLEVEL() _POPDEBUGLEVEL()
|
||||||
|
#define SETPROGRAMNAME(n) _SETPROGRAMNAME(n)
|
||||||
|
#define GETDEBUGLEVEL() _GETDEBUGLEVEL()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef DEBUG
|
||||||
|
#define DEBUG 1
|
||||||
|
|
||||||
|
#define assert(expression) \
|
||||||
|
((void) \
|
||||||
|
((expression) ? 0 : \
|
||||||
|
( \
|
||||||
|
*(char *)0 = 0, /* Enforcer hit */ \
|
||||||
|
_SETDEBUGLEVEL(2), \
|
||||||
|
kprintf("[%s] " \
|
||||||
|
"%s:%ld: failed assertion '%s'\n", \
|
||||||
|
__program_name, \
|
||||||
|
__FILE__, \
|
||||||
|
__LINE__, \
|
||||||
|
#expression), \
|
||||||
|
abort(), \
|
||||||
|
0 \
|
||||||
|
) \
|
||||||
|
) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
|
#define assert(expression) ((void)0)
|
||||||
|
#else
|
||||||
|
#include <assert.h>
|
||||||
|
#endif /* NDEBUG */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#define ENTER() ((void)0)
|
||||||
|
#define LEAVE() ((void)0)
|
||||||
|
#define RETURN(r) ((void)0)
|
||||||
|
#define SHOWVALUE(v) ((void)0)
|
||||||
|
#define SHOWPOINTER(p) ((void)0)
|
||||||
|
#define SHOWSTRING(s) ((void)0)
|
||||||
|
#define SHOWMSG(s) ((void)0)
|
||||||
|
#define D(s) ((void)0)
|
||||||
|
#define PRINTHEADER() ((void)0)
|
||||||
|
#define PRINTF(s) ((void)0)
|
||||||
|
#define LOG(s) ((void)0)
|
||||||
|
#define SETDEBUGLEVEL(l) ((void)0)
|
||||||
|
#define PUSHDEBUGLEVEL(l) ((void)0)
|
||||||
|
#define POPDEBUGLEVEL() ((void)0)
|
||||||
|
#define SETPROGRAMNAME(n) ((void)0)
|
||||||
|
#define GETDEBUGLEVEL() (0)
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* _DEBUG_H */
|
||||||
38
library/debug.lib_rev.c
Normal file
38
library/debug.lib_rev.c
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug.lib_rev.c,v 1.1.1.1 2004-07-26 16:30:26 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug.lib_rev.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
char __debug_lib_version[] = VERSTAG;
|
||||||
6
library/debug.lib_rev.h
Normal file
6
library/debug.lib_rev.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#define VERSION 1
|
||||||
|
#define REVISION 169
|
||||||
|
#define DATE "8.8.2004"
|
||||||
|
#define VERS "debug.lib 1.169"
|
||||||
|
#define VSTRING "debug.lib 1.169 (8.8.2004)\r\n"
|
||||||
|
#define VERSTAG "\0$VER: debug.lib 1.169 (8.8.2004)"
|
||||||
1
library/debug.lib_rev.rev
Normal file
1
library/debug.lib_rev.rev
Normal file
@@ -0,0 +1 @@
|
|||||||
|
169
|
||||||
62
library/debug_cmpstrexec.c
Normal file
62
library/debug_cmpstrexec.c
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_cmpstrexec.c,v 1.1.1.1 2004-07-26 16:30:26 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
cmpstrexec(const char * source1,const char * source2)
|
||||||
|
{
|
||||||
|
LONG result = 0;
|
||||||
|
|
||||||
|
assert( source1 != NULL && source2 != NULL );
|
||||||
|
|
||||||
|
if(source1 != NULL && source2 != NULL)
|
||||||
|
{
|
||||||
|
while((*source1) == (*source2))
|
||||||
|
{
|
||||||
|
if((*source1) == '\0')
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
source1++;
|
||||||
|
source2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = (*source1) - (*source2);
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
151
library/debug_headers.h
Normal file
151
library/debug_headers.h
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_headers.h,v 1.1.1.1 2004-07-26 16:30:27 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _DEBUG_HEADERS_H
|
||||||
|
#define _DEBUG_HEADERS_H
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <exec/libraries.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(__SASC)
|
||||||
|
|
||||||
|
#include <clib/exec_protos.h>
|
||||||
|
/*#include <pragmas/exec_sysbase_pragmas.h>*/
|
||||||
|
#include <pragmas/exec_pragmas.h>
|
||||||
|
|
||||||
|
LONG RawMayGetChar(VOID);
|
||||||
|
VOID RawPutChar(UBYTE c);
|
||||||
|
|
||||||
|
#pragma libcall SysBase RawMayGetChar 1fe 00
|
||||||
|
#pragma libcall SysBase RawPutChar 204 001
|
||||||
|
|
||||||
|
#endif /* __SASC */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(__amigaos4__)
|
||||||
|
#include <exec/emulation.h>
|
||||||
|
#endif /* __amigaos4__ */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
|
||||||
|
#define __NOLIBBASE__
|
||||||
|
#include <proto/exec.h>
|
||||||
|
|
||||||
|
#ifndef __PPC__
|
||||||
|
|
||||||
|
#define RawMayGetChar() ({ \
|
||||||
|
UBYTE _RawMayGetChar__re = \
|
||||||
|
({ \
|
||||||
|
register struct Library * const __RawMayGetChar__bn __asm("a6") = SysBase;\
|
||||||
|
register UBYTE __RawMayGetChar__re __asm("d0"); \
|
||||||
|
__asm volatile ("jsr a6@(-510:W)" \
|
||||||
|
: "=r"(__RawMayGetChar__re) \
|
||||||
|
: "r"(__RawMayGetChar__bn) \
|
||||||
|
: "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \
|
||||||
|
__RawMayGetChar__re; \
|
||||||
|
}); \
|
||||||
|
_RawMayGetChar__re; \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define RawPutChar(c) ({ \
|
||||||
|
ULONG _RawPutChar_c = (c); \
|
||||||
|
{ \
|
||||||
|
register struct Library * const __RawPutChar__bn __asm("a6") = SysBase;\
|
||||||
|
register ULONG __RawPutChar_c __asm("d0") = (_RawPutChar_c); \
|
||||||
|
__asm volatile ("jsr a6@(-516:W)" \
|
||||||
|
: \
|
||||||
|
: "r"(__RawPutChar__bn), "r"(__RawPutChar_c) \
|
||||||
|
: "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \
|
||||||
|
} \
|
||||||
|
})
|
||||||
|
|
||||||
|
#endif /* __PPC___ */
|
||||||
|
|
||||||
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#define SysBase (*(struct Library **)4)
|
||||||
|
#define IExec ((struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface)
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "macros.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
extern LONG cmpstrexec(const char *source1, const char *source2);
|
||||||
|
extern LONG KCmpStr(const char *source1, const char *source2);
|
||||||
|
extern LONG KMayGetCh(VOID);
|
||||||
|
extern LONG KMayGetChar(VOID);
|
||||||
|
extern LONG kgetc(VOID);
|
||||||
|
extern LONG kgetchar(VOID);
|
||||||
|
extern LONG kgetch(VOID);
|
||||||
|
extern LONG KGetCh(VOID);
|
||||||
|
extern LONG KGetChar(VOID);
|
||||||
|
extern LONG kgetnum(VOID);
|
||||||
|
extern LONG KGetNum(void);
|
||||||
|
extern VOID KDoFmt(const char *format_string, APTR data_stream, APTR put_char_routine, APTR put_char_data);
|
||||||
|
extern VOID KPutFmt(const char *format, va_list arg);
|
||||||
|
extern VOID KVPrintF(const char * format, va_list arg);
|
||||||
|
extern VOID kvprintf(const char *format, va_list arg);
|
||||||
|
extern VOID kprintf(const char *format, ...);
|
||||||
|
extern VOID KPrintF(const char *format, ...);
|
||||||
|
extern VOID kputc(UBYTE c);
|
||||||
|
extern VOID kputchar(UBYTE c);
|
||||||
|
extern VOID kputch(UBYTE c);
|
||||||
|
extern VOID KPutCh(UBYTE c);
|
||||||
|
extern VOID KPutChar(UBYTE c);
|
||||||
|
extern VOID kputstr(const UBYTE *s);
|
||||||
|
extern VOID KPutS(const UBYTE *s);
|
||||||
|
extern VOID kputs(const UBYTE *s);
|
||||||
|
extern VOID KPutStr(const UBYTE *s);
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* _DEBUG_HEADERS_H */
|
||||||
46
library/debug_kcmpstr.c
Normal file
46
library/debug_kcmpstr.c
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kcmpstr.c,v 1.1.1.1 2004-07-26 16:30:27 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
KCmpStr(const char * source1,const char * source2)
|
||||||
|
{
|
||||||
|
LONG result;
|
||||||
|
|
||||||
|
result = cmpstrexec(source1,source2);
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
45
library/debug_kdofmt.c
Normal file
45
library/debug_kdofmt.c
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kdofmt.c,v 1.1.1.1 2004-07-26 16:30:27 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
KDoFmt(const char * format_string,APTR data_stream,APTR put_char_routine,APTR put_char_data)
|
||||||
|
{
|
||||||
|
assert( format_string != NULL );
|
||||||
|
|
||||||
|
if(format_string != NULL)
|
||||||
|
RawDoFmt((STRPTR)format_string,data_stream,(VOID (*)())put_char_routine,put_char_data);
|
||||||
|
}
|
||||||
48
library/debug_kgetc.c
Normal file
48
library/debug_kgetc.c
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kgetc.c,v 1.1.1.1 2004-07-26 16:30:27 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
kgetc(VOID)
|
||||||
|
{
|
||||||
|
LONG result;
|
||||||
|
|
||||||
|
do
|
||||||
|
result = KMayGetChar();
|
||||||
|
while(result < 0);
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
46
library/debug_kgetch1.c
Normal file
46
library/debug_kgetch1.c
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kgetch1.c,v 1.1.1.1 2004-07-26 16:30:27 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
kgetch(VOID)
|
||||||
|
{
|
||||||
|
LONG result;
|
||||||
|
|
||||||
|
result = kgetc();
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
46
library/debug_kgetch2.c
Normal file
46
library/debug_kgetch2.c
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kgetch2.c,v 1.1.1.1 2004-07-26 16:30:27 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
KGetCh(VOID)
|
||||||
|
{
|
||||||
|
LONG result;
|
||||||
|
|
||||||
|
result = kgetc();
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
46
library/debug_kgetchar1.c
Normal file
46
library/debug_kgetchar1.c
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kgetchar1.c,v 1.1.1.1 2004-07-26 16:30:27 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
kgetchar(VOID)
|
||||||
|
{
|
||||||
|
LONG result;
|
||||||
|
|
||||||
|
result = kgetc();
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
46
library/debug_kgetchar2.c
Normal file
46
library/debug_kgetchar2.c
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kgetchar2.c,v 1.1.1.1 2004-07-26 16:30:27 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
KGetChar(VOID)
|
||||||
|
{
|
||||||
|
LONG result;
|
||||||
|
|
||||||
|
result = kgetc();
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
110
library/debug_kgetnum1.c
Normal file
110
library/debug_kgetnum1.c
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kgetnum1.c,v 1.1.1.1 2004-07-26 16:30:27 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
kgetnum(VOID)
|
||||||
|
{
|
||||||
|
LONG sum = 0;
|
||||||
|
LONG result;
|
||||||
|
BOOL is_negative = FALSE;
|
||||||
|
LONG position = 0;
|
||||||
|
LONG c;
|
||||||
|
|
||||||
|
while(TRUE)
|
||||||
|
{
|
||||||
|
c = kgetc();
|
||||||
|
|
||||||
|
if(c == '-')
|
||||||
|
{
|
||||||
|
if(position == 0)
|
||||||
|
{
|
||||||
|
is_negative = TRUE;
|
||||||
|
|
||||||
|
kputc(c);
|
||||||
|
|
||||||
|
position++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (c == '\b')
|
||||||
|
{
|
||||||
|
if(position > 0)
|
||||||
|
{
|
||||||
|
position--;
|
||||||
|
if(position == 0)
|
||||||
|
{
|
||||||
|
is_negative = FALSE;
|
||||||
|
|
||||||
|
sum = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sum = sum / 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
kputc(c);
|
||||||
|
kputc(' ');
|
||||||
|
kputc(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (c == '\r')
|
||||||
|
{
|
||||||
|
kputc('\n');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if ('0' <= c && c <= '9')
|
||||||
|
{
|
||||||
|
LONG new_sum;
|
||||||
|
|
||||||
|
new_sum = sum * 10 + (c - '0');
|
||||||
|
if(new_sum >= sum)
|
||||||
|
{
|
||||||
|
sum = new_sum;
|
||||||
|
|
||||||
|
kputc(c);
|
||||||
|
|
||||||
|
position++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(is_negative)
|
||||||
|
result = (-sum);
|
||||||
|
else
|
||||||
|
result = sum;
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
46
library/debug_kgetnum2.c
Normal file
46
library/debug_kgetnum2.c
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kgetnum2.c,v 1.1.1.1 2004-07-26 16:30:28 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
KGetNum(void)
|
||||||
|
{
|
||||||
|
LONG result;
|
||||||
|
|
||||||
|
result = kgetnum();
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
46
library/debug_kmaygetch.c
Normal file
46
library/debug_kmaygetch.c
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kmaygetch.c,v 1.1.1.1 2004-07-26 16:30:28 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
KMayGetCh(VOID)
|
||||||
|
{
|
||||||
|
LONG result;
|
||||||
|
|
||||||
|
result = KMayGetChar();
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
55
library/debug_kmaygetchar.c
Normal file
55
library/debug_kmaygetchar.c
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kmaygetchar.c,v 1.1.1.1 2004-07-26 16:30:28 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
LONG
|
||||||
|
KMayGetChar(VOID)
|
||||||
|
{
|
||||||
|
LONG result;
|
||||||
|
|
||||||
|
#if defined(__amigaos4__)
|
||||||
|
{
|
||||||
|
/* Call RawMayGetChar() through the 68k LVO. */
|
||||||
|
result = EmulateTags(SysBase, ET_Offset, -510, TAG_DONE);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
result = RawMayGetChar();
|
||||||
|
}
|
||||||
|
#endif /* __amigaos4__ */
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
51
library/debug_kprintf1.c
Normal file
51
library/debug_kprintf1.c
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kprintf1.c,v 1.1.1.1 2004-07-26 16:30:28 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
kprintf(const char * format,...)
|
||||||
|
{
|
||||||
|
assert( format != NULL );
|
||||||
|
|
||||||
|
if(format != NULL)
|
||||||
|
{
|
||||||
|
va_list arg;
|
||||||
|
|
||||||
|
va_start(arg,format);
|
||||||
|
KPutFmt(format,arg);
|
||||||
|
va_end(arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
51
library/debug_kprintf2.c
Normal file
51
library/debug_kprintf2.c
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kprintf2.c,v 1.1.1.1 2004-07-26 16:30:28 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
KPrintF(const char * format,...)
|
||||||
|
{
|
||||||
|
assert( format != NULL );
|
||||||
|
|
||||||
|
if(format != NULL)
|
||||||
|
{
|
||||||
|
va_list arg;
|
||||||
|
|
||||||
|
va_start(arg,format);
|
||||||
|
KPutFmt(format,arg);
|
||||||
|
va_end(arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
51
library/debug_kputc.c
Normal file
51
library/debug_kputc.c
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kputc.c,v 1.1.1.1 2004-07-26 16:30:28 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
kputc(UBYTE c)
|
||||||
|
{
|
||||||
|
#if defined(__amigaos4__)
|
||||||
|
{
|
||||||
|
/* Call RawPutChar() through the 68k LVO. */
|
||||||
|
EmulateTags(SysBase, ET_Offset, -516, ET_RegisterD0, c, TAG_DONE);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
RawPutChar(c);
|
||||||
|
}
|
||||||
|
#endif /* __amigaos4__ */
|
||||||
|
}
|
||||||
42
library/debug_kputch1.c
Normal file
42
library/debug_kputch1.c
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kputch1.c,v 1.1.1.1 2004-07-26 16:30:28 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
kputch(UBYTE c)
|
||||||
|
{
|
||||||
|
kputc(c);
|
||||||
|
}
|
||||||
42
library/debug_kputch2.c
Normal file
42
library/debug_kputch2.c
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kputch2.c,v 1.1.1.1 2004-07-26 16:30:28 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
KPutCh(UBYTE c)
|
||||||
|
{
|
||||||
|
kputc(c);
|
||||||
|
}
|
||||||
42
library/debug_kputchar1.c
Normal file
42
library/debug_kputchar1.c
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kputchar1.c,v 1.1.1.1 2004-07-26 16:30:29 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
kputchar(UBYTE c)
|
||||||
|
{
|
||||||
|
kputc(c);
|
||||||
|
}
|
||||||
42
library/debug_kputchar2.c
Normal file
42
library/debug_kputchar2.c
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kputchar2.c,v 1.1.1.1 2004-07-26 16:30:29 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
KPutChar(UBYTE c)
|
||||||
|
{
|
||||||
|
kputc(c);
|
||||||
|
}
|
||||||
194
library/debug_kputfmt.c
Normal file
194
library/debug_kputfmt.c
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kputfmt.c,v 1.1.1.1 2004-07-26 16:30:29 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(__amigaos4__)
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* Count the number of parameters that need to be passed on the stack. If a
|
||||||
|
parameter table is provided, pick up the parameters and store them in
|
||||||
|
the table. The table layout follows the format string and can include
|
||||||
|
both 16 and 32 bit data. */
|
||||||
|
static size_t
|
||||||
|
process_var_args(char *format_string,va_list argument_list,unsigned short * table)
|
||||||
|
{
|
||||||
|
size_t num_args = 0;
|
||||||
|
char len;
|
||||||
|
char c;
|
||||||
|
|
||||||
|
while((c = (*format_string++)) != '\0')
|
||||||
|
{
|
||||||
|
if(c != '%')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Process the flags; only '-' is allowed here. */
|
||||||
|
if((*format_string) == '-')
|
||||||
|
format_string++;
|
||||||
|
|
||||||
|
/* Process the field width; this must be a string of digits. */
|
||||||
|
c = (*format_string);
|
||||||
|
while('0' <= c && c <= '9')
|
||||||
|
{
|
||||||
|
format_string++;
|
||||||
|
|
||||||
|
c = (*format_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Process the size limit field, if any. */
|
||||||
|
if((*format_string) == '.')
|
||||||
|
{
|
||||||
|
format_string++;
|
||||||
|
|
||||||
|
c = (*format_string);
|
||||||
|
while('0' <= c && c <= '9')
|
||||||
|
{
|
||||||
|
format_string++;
|
||||||
|
|
||||||
|
c = (*format_string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Take care of the parameter length, if any. */
|
||||||
|
len = (*format_string);
|
||||||
|
if(len == 'l')
|
||||||
|
format_string++;
|
||||||
|
|
||||||
|
c = (*format_string++);
|
||||||
|
if(c == '\0')
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Check if any of the following parameters might come from the
|
||||||
|
stack, and if so, convert them into the form expected by the
|
||||||
|
operating system. */
|
||||||
|
switch(c)
|
||||||
|
{
|
||||||
|
/* 32 bit pointers (BSTR or STRPTR) */
|
||||||
|
case 'b':
|
||||||
|
case 's':
|
||||||
|
|
||||||
|
if(table != NULL)
|
||||||
|
(*(unsigned long *)&table[num_args]) = (unsigned long)va_arg(argument_list,char *);
|
||||||
|
|
||||||
|
num_args += 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Single character */
|
||||||
|
case 'c':
|
||||||
|
|
||||||
|
/* NOTE: va_arg() is quietly assumed not to be able to expand 'char' type
|
||||||
|
parameters. They appear to default to 'int' and should show up as such
|
||||||
|
on the stack (or wherever they ended up). We therefore assume that they
|
||||||
|
should be picked up as type 'int' rather than as type 'char'. */
|
||||||
|
|
||||||
|
/* Numeric constant, which is assumed to be of type int. */
|
||||||
|
case 'd':
|
||||||
|
case 'u':
|
||||||
|
case 'x':
|
||||||
|
|
||||||
|
if(table != NULL)
|
||||||
|
{
|
||||||
|
if(len == 'l')
|
||||||
|
(*(unsigned long *)&table[num_args]) = (unsigned long)va_arg(argument_list,int);
|
||||||
|
else
|
||||||
|
table[num_args] = (unsigned short)va_arg(argument_list,int);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(len == 'l')
|
||||||
|
num_args += 2;
|
||||||
|
else
|
||||||
|
num_args++;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Anything else is taken as is... */
|
||||||
|
default:
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(num_args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* __amigaos4__ */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
static VOID ASM
|
||||||
|
raw_put_char(REG(d0,UBYTE c))
|
||||||
|
{
|
||||||
|
kputc(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
KPutFmt(const char * format_string,va_list argument_list)
|
||||||
|
{
|
||||||
|
assert( format_string != NULL );
|
||||||
|
|
||||||
|
if(format_string != NULL)
|
||||||
|
{
|
||||||
|
#if defined(__amigaos4__)
|
||||||
|
{
|
||||||
|
size_t num_args;
|
||||||
|
|
||||||
|
/* The following assumes that GCC extensions are available. */
|
||||||
|
|
||||||
|
num_args = process_var_args((char *)format_string,argument_list,NULL);
|
||||||
|
if(num_args > 0)
|
||||||
|
{
|
||||||
|
unsigned short table[num_args];
|
||||||
|
|
||||||
|
(void)process_var_args((char *)format_string,argument_list,table);
|
||||||
|
|
||||||
|
KDoFmt(format_string,(APTR)table,(APTR)raw_put_char,NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KDoFmt(format_string,NULL,(APTR)raw_put_char,NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
KDoFmt(format_string,(APTR)argument_list,(APTR)raw_put_char,NULL);
|
||||||
|
}
|
||||||
|
#endif /* __amigaos4__ */
|
||||||
|
}
|
||||||
|
}
|
||||||
44
library/debug_kputs1.c
Normal file
44
library/debug_kputs1.c
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kputs1.c,v 1.1.1.1 2004-07-26 16:30:29 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
KPutS(const UBYTE * s)
|
||||||
|
{
|
||||||
|
assert( s != NULL );
|
||||||
|
|
||||||
|
kputstr(s);
|
||||||
|
}
|
||||||
44
library/debug_kputs2.c
Normal file
44
library/debug_kputs2.c
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kputs2.c,v 1.1.1.1 2004-07-26 16:30:29 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
kputs(const UBYTE * s)
|
||||||
|
{
|
||||||
|
assert( s != NULL );
|
||||||
|
|
||||||
|
kputstr(s);
|
||||||
|
}
|
||||||
50
library/debug_kputstr1.c
Normal file
50
library/debug_kputstr1.c
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kputstr1.c,v 1.1.1.1 2004-07-26 16:30:30 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
kputstr(const UBYTE * s)
|
||||||
|
{
|
||||||
|
assert( s != NULL );
|
||||||
|
|
||||||
|
if(s != NULL)
|
||||||
|
{
|
||||||
|
UBYTE c;
|
||||||
|
|
||||||
|
while((c = (*s++)) != '\0')
|
||||||
|
kputc(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
44
library/debug_kputstr2.c
Normal file
44
library/debug_kputstr2.c
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kputstr2.c,v 1.1.1.1 2004-07-26 16:30:30 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
KPutStr(const UBYTE * s)
|
||||||
|
{
|
||||||
|
assert( s != NULL );
|
||||||
|
|
||||||
|
kputstr(s);
|
||||||
|
}
|
||||||
45
library/debug_kvprintf1.c
Normal file
45
library/debug_kvprintf1.c
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kvprintf1.c,v 1.1.1.1 2004-07-26 16:30:30 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
kvprintf(const char * format,va_list arg)
|
||||||
|
{
|
||||||
|
assert( format != NULL );
|
||||||
|
|
||||||
|
if(format != NULL)
|
||||||
|
KPutFmt(format,arg);
|
||||||
|
}
|
||||||
45
library/debug_kvprintf2.c
Normal file
45
library/debug_kvprintf2.c
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_kvprintf2.c,v 1.1.1.1 2004-07-26 16:30:30 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "debug_headers.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
KVPrintF(const char * format,va_list arg)
|
||||||
|
{
|
||||||
|
assert( format != NULL );
|
||||||
|
|
||||||
|
if(format != NULL)
|
||||||
|
KPutFmt(format,arg);
|
||||||
|
}
|
||||||
37
library/debug_level.c
Normal file
37
library/debug_level.c
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* $Id: debug_level.c,v 1.1.1.1 2004-07-26 16:30:30 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=8
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* By default, show and test only assertions. */
|
||||||
|
int __debug_level = 0;
|
||||||
112
library/dirent_closedir.c
Normal file
112
library/dirent_closedir.c
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
* $Id: dirent_closedir.c,v 1.2 2004-08-07 09:15:32 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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_MEM_DEBUG_H
|
||||||
|
#include "stdlib_mem_debug.h"
|
||||||
|
#endif /* _STDLIB_MEM_DEBUG_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _DIRENT_HEADERS_H
|
||||||
|
#include "dirent_headers.h"
|
||||||
|
#endif /* _DIRENT_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* The following is not part of the ISO 'C' (1994) standard. */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
|
closedir(DIR * directory_pointer)
|
||||||
|
{
|
||||||
|
struct DirectoryHandle * dh;
|
||||||
|
struct Node * node;
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
SHOWPOINTER(directory_pointer);
|
||||||
|
|
||||||
|
if(__check_abort_enabled)
|
||||||
|
__check_abort();
|
||||||
|
|
||||||
|
if(directory_pointer == NULL)
|
||||||
|
{
|
||||||
|
errno = EBADF;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
{
|
||||||
|
BOOL directory_pointer_is_valid = FALSE;
|
||||||
|
|
||||||
|
for(dh = (struct DirectoryHandle *)__directory_list.mlh_Head ;
|
||||||
|
dh->dh_MinNode.mln_Succ != NULL ;
|
||||||
|
dh = (struct DirectoryHandle *)dh->dh_MinNode.mln_Succ)
|
||||||
|
{
|
||||||
|
if(dh == (struct DirectoryHandle *)directory_pointer)
|
||||||
|
{
|
||||||
|
directory_pointer_is_valid = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(NOT directory_pointer_is_valid)
|
||||||
|
{
|
||||||
|
errno = EBADF;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* NDEBUG */
|
||||||
|
|
||||||
|
dh = (struct DirectoryHandle *)directory_pointer;
|
||||||
|
|
||||||
|
Remove((struct Node *)dh);
|
||||||
|
|
||||||
|
while((node = RemHead(&dh->dh_VolumeList)) != NULL)
|
||||||
|
free(node);
|
||||||
|
|
||||||
|
PROFILE_OFF();
|
||||||
|
UnLock(dh->dh_DirLock);
|
||||||
|
PROFILE_ON();
|
||||||
|
|
||||||
|
free(dh);
|
||||||
|
|
||||||
|
result = 0;
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
RETURN(result);
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
68
library/dirent_data.c
Normal file
68
library/dirent_data.c
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* $Id: dirent_data.c,v 1.3 2004-08-07 10:24:04 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _DIRENT_HEADERS_H
|
||||||
|
#include "dirent_headers.h"
|
||||||
|
#endif /* _DIRENT_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* Directories being scanned whose locks need to be freed when shutting down. */
|
||||||
|
struct MinList __directory_list;
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
CLIB_CONSTRUCTOR(__dirent_init)
|
||||||
|
{
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
NewList((struct List *)&__directory_list);
|
||||||
|
|
||||||
|
RETURN(OK);
|
||||||
|
CONSTRUCTOR_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
CLIB_DESTRUCTOR(__dirent_exit)
|
||||||
|
{
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
if(__directory_list.mlh_Head != NULL)
|
||||||
|
{
|
||||||
|
while(NOT IsListEmpty((struct List *)&__directory_list))
|
||||||
|
closedir((DIR *)__directory_list.mlh_Head);
|
||||||
|
}
|
||||||
|
|
||||||
|
LEAVE();
|
||||||
|
}
|
||||||
63
library/dirent_headers.h
Normal file
63
library/dirent_headers.h
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* $Id: dirent_headers.h,v 1.1.1.1 2004-07-26 16:30:30 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _DIRENT_HEADERS_H
|
||||||
|
#define _DIRENT_HEADERS_H
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _STDIO_HEADERS_H
|
||||||
|
#include "stdio_headers.h"
|
||||||
|
#endif /* _STDIO_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
struct DirectoryHandle
|
||||||
|
{
|
||||||
|
struct MinNode dh_MinNode;
|
||||||
|
BPTR dh_DirLock;
|
||||||
|
struct FileInfoBlock dh_FileInfo;
|
||||||
|
struct dirent dh_DirectoryEntry;
|
||||||
|
int dh_Position;
|
||||||
|
struct Node * dh_VolumeNode;
|
||||||
|
struct List dh_VolumeList;
|
||||||
|
BOOL dh_ScanVolumeList;
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
extern struct MinList __directory_list;
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* _DIRENT_HEADERS_H */
|
||||||
269
library/dirent_opendir.c
Normal file
269
library/dirent_opendir.c
Normal file
@@ -0,0 +1,269 @@
|
|||||||
|
/*
|
||||||
|
* $Id: dirent_opendir.c,v 1.2 2004-08-07 09:15:32 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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_NULL_POINTER_CHECK_H
|
||||||
|
#include "stdlib_null_pointer_check.h"
|
||||||
|
#endif /* _STDLIB_NULL_POINTER_CHECK_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _STDLIB_MEM_DEBUG_H
|
||||||
|
#include "stdlib_mem_debug.h"
|
||||||
|
#endif /* _STDLIB_MEM_DEBUG_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _DIRENT_HEADERS_H
|
||||||
|
#include "dirent_headers.h"
|
||||||
|
#endif /* _DIRENT_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* The following is not part of the ISO 'C' (1994) standard. */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(UNIX_PATH_SEMANTICS)
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
static struct Node *
|
||||||
|
find_by_name(struct List * list,const char * name)
|
||||||
|
{
|
||||||
|
struct Node * result = NULL;
|
||||||
|
struct Node * node;
|
||||||
|
|
||||||
|
for(node = list->lh_Head ; node->ln_Succ != NULL ; node = node->ln_Succ)
|
||||||
|
{
|
||||||
|
if(strcasecmp(node->ln_Name,name) == 0)
|
||||||
|
{
|
||||||
|
result = node;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* UNIX_PATH_SEMANTICS */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
DIR *
|
||||||
|
opendir(const char * path_name)
|
||||||
|
{
|
||||||
|
#if defined(UNIX_PATH_SEMANTICS)
|
||||||
|
struct name_translation_info path_name_nti;
|
||||||
|
#endif /* UNIX_PATH_SEMANTICS */
|
||||||
|
struct DirectoryHandle * dh = NULL;
|
||||||
|
DIR * result = NULL;
|
||||||
|
struct Node * node;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
SHOWSTRING(path_name);
|
||||||
|
|
||||||
|
assert( path_name != NULL );
|
||||||
|
|
||||||
|
if(__check_abort_enabled)
|
||||||
|
__check_abort();
|
||||||
|
|
||||||
|
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||||
|
{
|
||||||
|
if(path_name == NULL)
|
||||||
|
{
|
||||||
|
SHOWMSG("invalid parameter");
|
||||||
|
|
||||||
|
errno = EFAULT;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||||
|
|
||||||
|
dh = malloc(sizeof(*dh));
|
||||||
|
if(dh == NULL)
|
||||||
|
{
|
||||||
|
SHOWMSG("memory allocation failed");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(dh,0,sizeof(*dh));
|
||||||
|
|
||||||
|
NewList(&dh->dh_VolumeList);
|
||||||
|
|
||||||
|
#if defined(UNIX_PATH_SEMANTICS)
|
||||||
|
{
|
||||||
|
if(__unix_path_semantics)
|
||||||
|
{
|
||||||
|
if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
SHOWSTRING(path_name);
|
||||||
|
|
||||||
|
if(path_name_nti.is_root)
|
||||||
|
{
|
||||||
|
struct DosList * dol;
|
||||||
|
UBYTE * name;
|
||||||
|
|
||||||
|
SHOWMSG("collecting volume names");
|
||||||
|
|
||||||
|
dh->dh_ScanVolumeList = TRUE;
|
||||||
|
|
||||||
|
PROFILE_OFF();
|
||||||
|
dol = LockDosList(LDF_VOLUMES|LDF_READ);
|
||||||
|
PROFILE_ON();
|
||||||
|
|
||||||
|
while((dol = NextDosEntry(dol,LDF_VOLUMES|LDF_READ)) != NULL)
|
||||||
|
{
|
||||||
|
name = BADDR(dol->dol_Name);
|
||||||
|
if(name != NULL && name[0] > 0)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
len = name[0];
|
||||||
|
|
||||||
|
node = malloc(sizeof(*node) + len + 2);
|
||||||
|
if(node == NULL)
|
||||||
|
{
|
||||||
|
UnLockDosList(LDF_VOLUMES|LDF_READ);
|
||||||
|
|
||||||
|
errno = ENOMEM;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
node->ln_Name = (char *)(node + 1);
|
||||||
|
|
||||||
|
memmove(node->ln_Name,&name[1],len);
|
||||||
|
node->ln_Name[len++] = ':';
|
||||||
|
node->ln_Name[len] = '\0';
|
||||||
|
|
||||||
|
/* Check if the name is already on the list. Mind you,
|
||||||
|
this is not the most sophisticated algorithm but then
|
||||||
|
the number of volumes should be small. */
|
||||||
|
if(find_by_name(&dh->dh_VolumeList,node->ln_Name) != NULL)
|
||||||
|
{
|
||||||
|
free(node);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
D(("adding '%s'",node->ln_Name));
|
||||||
|
|
||||||
|
AddTail(&dh->dh_VolumeList,node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UnLockDosList(LDF_VOLUMES|LDF_READ);
|
||||||
|
|
||||||
|
/* Bail out if we cannot present anything. */
|
||||||
|
if(IsListEmpty(&dh->dh_VolumeList))
|
||||||
|
{
|
||||||
|
errno = ENOMEM;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* UNIX_PATH_SEMANTICS */
|
||||||
|
|
||||||
|
if(NOT dh->dh_ScanVolumeList)
|
||||||
|
{
|
||||||
|
LONG status;
|
||||||
|
|
||||||
|
SHOWMSG("we are supposed to scan a directory");
|
||||||
|
SHOWSTRING(path_name);
|
||||||
|
|
||||||
|
PROFILE_OFF();
|
||||||
|
dh->dh_DirLock = Lock((STRPTR)path_name,SHARED_LOCK);
|
||||||
|
PROFILE_ON();
|
||||||
|
|
||||||
|
if(dh->dh_DirLock == ZERO)
|
||||||
|
{
|
||||||
|
SHOWMSG("couldn't get a lock on it");
|
||||||
|
|
||||||
|
__translate_access_io_error_to_errno(IoErr(),&errno);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert( (((ULONG)&dh->dh_FileInfo) & 3) == 0 );
|
||||||
|
|
||||||
|
PROFILE_OFF();
|
||||||
|
status = Examine(dh->dh_DirLock,&dh->dh_FileInfo);
|
||||||
|
PROFILE_ON();
|
||||||
|
|
||||||
|
if(status == DOSFALSE)
|
||||||
|
{
|
||||||
|
SHOWMSG("couldn't examine it");
|
||||||
|
|
||||||
|
__translate_io_error_to_errno(IoErr(),&errno);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dh->dh_FileInfo.fib_DirEntryType < 0)
|
||||||
|
{
|
||||||
|
SHOWMSG("this isn't a directory");
|
||||||
|
|
||||||
|
errno = ENOTDIR;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SHOWMSG("OK, done");
|
||||||
|
|
||||||
|
assert( __directory_list.mlh_Head != NULL );
|
||||||
|
|
||||||
|
AddTail((struct List *)&__directory_list,(struct Node *)dh);
|
||||||
|
|
||||||
|
result = (DIR *)dh;
|
||||||
|
dh = NULL;
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
if(dh != NULL)
|
||||||
|
{
|
||||||
|
SHOWMSG("ouch. cleaning up");
|
||||||
|
|
||||||
|
while((node = RemHead(&dh->dh_VolumeList)) != NULL)
|
||||||
|
free(node);
|
||||||
|
|
||||||
|
PROFILE_OFF();
|
||||||
|
UnLock(dh->dh_DirLock);
|
||||||
|
PROFILE_ON();
|
||||||
|
|
||||||
|
free(dh);
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN(result);
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
227
library/dirent_readdir.c
Normal file
227
library/dirent_readdir.c
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
/*
|
||||||
|
* $Id: dirent_readdir.c,v 1.2 2004-08-07 09:15:32 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _DIRENT_HEADERS_H
|
||||||
|
#include "dirent_headers.h"
|
||||||
|
#endif /* _DIRENT_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* The following is not part of the ISO 'C' (1994) standard. */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
struct dirent *
|
||||||
|
readdir(DIR * directory_pointer)
|
||||||
|
{
|
||||||
|
struct dirent * result = NULL;
|
||||||
|
struct DirectoryHandle * dh;
|
||||||
|
BPTR parent_directory = ZERO;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
SHOWPOINTER(directory_pointer);
|
||||||
|
|
||||||
|
if(__check_abort_enabled)
|
||||||
|
__check_abort();
|
||||||
|
|
||||||
|
PROFILE_OFF();
|
||||||
|
|
||||||
|
if(directory_pointer == NULL)
|
||||||
|
{
|
||||||
|
SHOWMSG("ouch. invalid parameter");
|
||||||
|
|
||||||
|
errno = EBADF;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
dh = (struct DirectoryHandle *)directory_pointer;
|
||||||
|
|
||||||
|
#if defined(UNIX_PATH_SEMANTICS)
|
||||||
|
{
|
||||||
|
if(__unix_path_semantics && dh->dh_ScanVolumeList)
|
||||||
|
{
|
||||||
|
SHOWMSG("we are scanning the volume list");
|
||||||
|
|
||||||
|
if(dh->dh_Position == 0)
|
||||||
|
{
|
||||||
|
SHOWMSG("returning the .");
|
||||||
|
|
||||||
|
dh->dh_Position++;
|
||||||
|
|
||||||
|
dh->dh_DirectoryEntry.d_ino = 0;
|
||||||
|
strcpy(dh->dh_DirectoryEntry.d_name,".");
|
||||||
|
|
||||||
|
result = &dh->dh_DirectoryEntry;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
D_S(struct FileInfoBlock,fib);
|
||||||
|
struct MsgPort * port;
|
||||||
|
UBYTE * bcpl_name;
|
||||||
|
BPTR dir_lock;
|
||||||
|
UBYTE name[8];
|
||||||
|
|
||||||
|
if(dh->dh_VolumeNode == NULL && NOT IsListEmpty(&dh->dh_VolumeList))
|
||||||
|
dh->dh_VolumeNode = dh->dh_VolumeList.lh_Head;
|
||||||
|
|
||||||
|
bcpl_name = (STRPTR)((((ULONG)&name[0]) + 3UL) & ~3UL);
|
||||||
|
strcpy(bcpl_name,"\1:"); /* BSTR for ":" */
|
||||||
|
|
||||||
|
while(result == NULL && dh->dh_VolumeNode != NULL && dh->dh_VolumeNode->ln_Succ != NULL)
|
||||||
|
{
|
||||||
|
if(IsFileSystem(dh->dh_VolumeNode->ln_Name))
|
||||||
|
{
|
||||||
|
port = DeviceProc(dh->dh_VolumeNode->ln_Name);
|
||||||
|
if(port != NULL)
|
||||||
|
{
|
||||||
|
dir_lock = DoPkt(port,ACTION_LOCATE_OBJECT,ZERO,MKBADDR(bcpl_name),SHARED_LOCK, 0,0);
|
||||||
|
if(dir_lock != ZERO)
|
||||||
|
{
|
||||||
|
if(Examine(dir_lock,fib))
|
||||||
|
{
|
||||||
|
assert( sizeof(dh->dh_DirectoryEntry.d_name) >= sizeof(fib->fib_FileName) );
|
||||||
|
|
||||||
|
strcpy(dh->dh_DirectoryEntry.d_name,fib->fib_FileName);
|
||||||
|
|
||||||
|
dh->dh_DirectoryEntry.d_ino = fib->fib_DiskKey;
|
||||||
|
|
||||||
|
result = &dh->dh_DirectoryEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnLock(dir_lock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dh->dh_VolumeNode = dh->dh_VolumeNode->ln_Succ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* UNIX_PATH_SEMANTICS */
|
||||||
|
|
||||||
|
if(NOT dh->dh_ScanVolumeList)
|
||||||
|
{
|
||||||
|
#if defined(UNIX_PATH_SEMANTICS)
|
||||||
|
{
|
||||||
|
if(__unix_path_semantics)
|
||||||
|
{
|
||||||
|
if(dh->dh_Position == 0)
|
||||||
|
{
|
||||||
|
SHOWMSG("returning .");
|
||||||
|
|
||||||
|
dh->dh_Position++;
|
||||||
|
|
||||||
|
dh->dh_DirectoryEntry.d_ino = dh->dh_FileInfo.fib_DiskKey;
|
||||||
|
|
||||||
|
strcpy(dh->dh_DirectoryEntry.d_name,".");
|
||||||
|
|
||||||
|
result = &dh->dh_DirectoryEntry;
|
||||||
|
}
|
||||||
|
else if (dh->dh_Position == 1)
|
||||||
|
{
|
||||||
|
D_S(struct FileInfoBlock,fib);
|
||||||
|
|
||||||
|
dh->dh_Position++;
|
||||||
|
|
||||||
|
parent_directory = ParentDir(dh->dh_DirLock);
|
||||||
|
if(parent_directory != ZERO)
|
||||||
|
{
|
||||||
|
if(CANNOT Examine(parent_directory,fib))
|
||||||
|
{
|
||||||
|
__translate_io_error_to_errno(IoErr(),&errno);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* This is the virtual root directory's key. */
|
||||||
|
fib->fib_DiskKey = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SHOWMSG("returning ..");
|
||||||
|
|
||||||
|
dh->dh_DirectoryEntry.d_ino = fib->fib_DiskKey;
|
||||||
|
|
||||||
|
strcpy(dh->dh_DirectoryEntry.d_name,"..");
|
||||||
|
|
||||||
|
result = &dh->dh_DirectoryEntry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* UNIX_PATH_SEMANTICS */
|
||||||
|
|
||||||
|
if(result == NULL)
|
||||||
|
{
|
||||||
|
assert( (((ULONG)&dh->dh_FileInfo) & 3) == 0 );
|
||||||
|
|
||||||
|
if(ExNext(dh->dh_DirLock,&dh->dh_FileInfo))
|
||||||
|
{
|
||||||
|
dh->dh_DirectoryEntry.d_ino = dh->dh_FileInfo.fib_DiskKey;
|
||||||
|
|
||||||
|
assert( sizeof(dh->dh_DirectoryEntry.d_name) >= sizeof(dh->dh_FileInfo.fib_FileName) );
|
||||||
|
|
||||||
|
strcpy(dh->dh_DirectoryEntry.d_name,dh->dh_FileInfo.fib_FileName);
|
||||||
|
|
||||||
|
result = &dh->dh_DirectoryEntry;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(IoErr() != ERROR_NO_MORE_ENTRIES)
|
||||||
|
{
|
||||||
|
SHOWMSG("error scanning directory");
|
||||||
|
|
||||||
|
__translate_io_error_to_errno(IoErr(),&errno);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
SHOWMSG("that was the end of the line");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(result != NULL)
|
||||||
|
D(("next entry to return is '%s'",result->d_name));
|
||||||
|
else
|
||||||
|
SHOWMSG("end of directory reached");
|
||||||
|
|
||||||
|
out:
|
||||||
|
|
||||||
|
UnLock(parent_directory);
|
||||||
|
|
||||||
|
PROFILE_ON();
|
||||||
|
|
||||||
|
RETURN(result);
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
87
library/dirent_rewinddir.c
Normal file
87
library/dirent_rewinddir.c
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* $Id: dirent_rewinddir.c,v 1.2 2004-08-07 09:15:32 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2004 by Olaf Barthel <olsen@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 _DIRENT_HEADERS_H
|
||||||
|
#include "dirent_headers.h"
|
||||||
|
#endif /* _DIRENT_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* The following is not part of the ISO 'C' (1994) standard. */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
rewinddir(DIR * directory_pointer)
|
||||||
|
{
|
||||||
|
ENTER();
|
||||||
|
|
||||||
|
SHOWPOINTER(directory_pointer);
|
||||||
|
|
||||||
|
if(__check_abort_enabled)
|
||||||
|
__check_abort();
|
||||||
|
|
||||||
|
PROFILE_OFF();
|
||||||
|
|
||||||
|
if(directory_pointer != NULL)
|
||||||
|
{
|
||||||
|
struct DirectoryHandle * dh;
|
||||||
|
|
||||||
|
dh = (struct DirectoryHandle *)directory_pointer;
|
||||||
|
|
||||||
|
dh->dh_Position = 0;
|
||||||
|
|
||||||
|
if(dh->dh_ScanVolumeList)
|
||||||
|
{
|
||||||
|
SHOWMSG("returning to first volume");
|
||||||
|
|
||||||
|
dh->dh_VolumeNode = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SHOWMSG("calling Examine() again");
|
||||||
|
|
||||||
|
assert( (((ULONG)&dh->dh_FileInfo) & 3) == 0 );
|
||||||
|
|
||||||
|
if(CANNOT Examine(dh->dh_DirLock,&dh->dh_FileInfo))
|
||||||
|
{
|
||||||
|
SHOWMSG("ouch. that didn't work");
|
||||||
|
__translate_io_error_to_errno(IoErr(),&errno);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PROFILE_ON();
|
||||||
|
|
||||||
|
LEAVE();
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user