From d56e2c3a6211807a4b589fab764b869b7f3f4982 Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Mon, 4 Jul 2005 09:39:01 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create tag 'LIB_V1_1'. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/tags/LIB_V1_1@15001 87f5fb63-7c3d-0410-a384-fd976d0f7a62 --- CVSROOT/checkoutlist | 13 - CVSROOT/commitinfo | 15 - CVSROOT/config | 21 - CVSROOT/cvswrappers | 19 - CVSROOT/editinfo | 21 - CVSROOT/loginfo | 27 - CVSROOT/modules | 26 - CVSROOT/notify | 12 - CVSROOT/rcsinfo | 13 - CVSROOT/taginfo | 20 - CVSROOT/verifymsg | 21 - documentation/BUILDING.html | 30 - documentation/GCC-68K.html | 67 - documentation/README.html | 304 -- documentation/specs | 64 - library/GNUmakefile.68k | 1245 -------- library/GNUmakefile.os4 | 1223 -------- library/TODO | 19 - library/amiga.lib_rev.c | 38 - library/amiga.lib_rev.h | 6 - library/amiga.lib_rev.rev | 1 - library/amiga_acrypt.c | 106 - library/amiga_addtof.c | 83 - library/amiga_argarraydone.c | 71 - library/amiga_argarrayinit.c | 99 - library/amiga_argint.c | 60 - library/amiga_argstring.c | 61 - library/amiga_beginio.c | 120 - library/amiga_callhook.c | 67 - library/amiga_callhooka.asm | 80 - library/amiga_callhooka.c | 93 - library/amiga_coercemethod.c | 93 - library/amiga_createextio.c | 68 - library/amiga_createport.c | 75 - library/amiga_createstdio.c | 68 - library/amiga_createtask.c | 242 -- library/amiga_deleteextio.c | 60 - library/amiga_deleteport.c | 62 - library/amiga_deletestdio.c | 58 - library/amiga_deletetask.c | 74 - library/amiga_domethod.c | 100 - library/amiga_dosupermethod.c | 93 - library/amiga_dotimer.c | 147 - library/amiga_fastrand.c | 52 - library/amiga_freeievents.c | 62 - library/amiga_hookentry.asm | 51 - library/amiga_hookentry.c | 61 - library/amiga_hotkey.c | 78 - library/amiga_invertstring.c | 208 -- library/amiga_newlist.c | 60 - library/amiga_rangerand.c | 80 - library/amiga_remtof.c | 57 - library/amiga_rexxvars.c | 203 -- library/amiga_setsuperattrs.c | 101 - library/amiga_timedelay.c | 54 - library/amiga_waitbeam.c | 60 - library/build_archive_amiga | 31 - library/build_archive_unix.sh | 27 - library/c.lib_rev.c | 38 - library/c.lib_rev.h | 6 - library/c.lib_rev.rev | 1 - library/changes | 4067 ------------------------- library/complex_carg.c | 52 - library/complex_cargf.c | 52 - library/complex_cargl.c | 52 - library/complex_cimag.c | 52 - library/complex_cimagf.c | 52 - library/complex_cimagl.c | 52 - library/complex_conj.c | 52 - library/complex_conjf.c | 52 - library/complex_conjl.c | 52 - library/complex_creal.c | 52 - library/complex_crealf.c | 52 - library/complex_creall.c | 52 - library/complex_headers.h | 68 - library/crt0.S | 27 - library/crtbegin.c | 60 - library/crtend.c | 19 - library/ctype_headers.h | 68 - library/ctype_isalnum.c | 74 - library/ctype_isalpha.c | 73 - library/ctype_isascii.c | 56 - library/ctype_isblank.c | 52 - library/ctype_iscntrl.c | 72 - library/ctype_isdigit.c | 72 - library/ctype_isgraph.c | 72 - library/ctype_islower.c | 72 - library/ctype_isprint.c | 72 - library/ctype_ispunct.c | 75 - library/ctype_isspace.c | 77 - library/ctype_isupper.c | 72 - library/ctype_isxdigit.c | 74 - library/ctype_table.c | 178 -- library/ctype_tolower.c | 68 - library/ctype_toupper.c | 68 - library/debug.c | 342 --- library/debug.h | 199 -- library/debug.lib_rev.c | 38 - library/debug.lib_rev.h | 6 - library/debug.lib_rev.rev | 1 - library/debug_cmpstrexec.c | 62 - library/debug_headers.h | 158 - library/debug_kcmpstr.c | 46 - library/debug_kdofmt.c | 45 - library/debug_kgetc.c | 48 - library/debug_kgetch1.c | 46 - library/debug_kgetch2.c | 46 - library/debug_kgetchar1.c | 46 - library/debug_kgetchar2.c | 46 - library/debug_kgetnum1.c | 110 - library/debug_kgetnum2.c | 46 - library/debug_kmaygetch.c | 46 - library/debug_kmaygetchar.c | 55 - library/debug_kprintf1.c | 51 - library/debug_kprintf2.c | 51 - library/debug_kputc.c | 51 - library/debug_kputch1.c | 42 - library/debug_kputch2.c | 42 - library/debug_kputchar1.c | 42 - library/debug_kputchar2.c | 42 - library/debug_kputfmt.c | 194 -- library/debug_kputs1.c | 44 - library/debug_kputs2.c | 44 - library/debug_kputstr1.c | 50 - library/debug_kputstr2.c | 44 - library/debug_kvprintf1.c | 45 - library/debug_kvprintf2.c | 45 - library/debug_level.c | 37 - library/dirent_closedir.c | 215 -- library/dirent_headers.h | 104 - library/dirent_opendir.c | 280 -- library/dirent_readdir.c | 231 -- library/dirent_rewinddir.c | 87 - library/errno_data.c | 40 - library/fcntl_close.c | 87 - library/fcntl_creat.c | 81 - library/fcntl_fcntl.c | 284 -- library/fcntl_get_default_file.c | 69 - library/fcntl_headers.h | 57 - library/fcntl_lock.c | 62 - library/fcntl_lseek.c | 109 - library/fcntl_open.c | 476 --- library/fcntl_read.c | 130 - library/fcntl_write.c | 130 - library/ftw_ftw.c | 222 -- library/ftw_headers.h | 66 - library/ftw_nftw.c | 317 -- library/getopt_getopt_long.c | 408 --- library/include/assert.h | 82 - library/include/complex.h | 185 -- library/include/ctype.h | 123 - library/include/dirent.h | 88 - library/include/dos.h | 373 --- library/include/errno.h | 170 -- library/include/fcntl.h | 124 - library/include/float.h | 77 - library/include/ftw.h | 102 - library/include/getopt.h | 83 - library/include/grp.h | 71 - library/include/inttypes.h | 318 -- library/include/iso646.h | 53 - library/include/libgen.h | 60 - library/include/limits.h | 172 -- library/include/locale.h | 115 - library/include/math.h | 314 -- library/include/pwd.h | 74 - library/include/setjmp.h | 85 - library/include/signal.h | 114 - library/include/stdarg.h | 98 - library/include/stdbool.h | 81 - library/include/stddef.h | 71 - library/include/stdint.h | 196 -- library/include/stdio.h | 452 --- library/include/stdlib.h | 222 -- library/include/string.h | 138 - library/include/strings.h | 78 - library/include/sys/amigaos-va.h | 81 - library/include/sys/clib2_stdc.h | 63 - library/include/sys/mount.h | 121 - library/include/sys/stat.h | 147 - library/include/sys/time.h | 144 - library/include/sys/types.h | 70 - library/include/sys/uio.h | 84 - library/include/sys/utsname.h | 74 - library/include/termios.h | 189 -- library/include/time.h | 115 - library/include/unistd.h | 298 -- library/include/utime.h | 73 - library/include/wchar.h | 185 -- library/include/wctype.h | 94 - library/inttypes_headers.h | 49 - library/inttypes_imaxabs.c | 51 - library/inttypes_imaxdiv.c | 51 - library/inttypes_strtoimax.c | 192 -- library/inttypes_strtoumax.c | 189 -- library/inttypes_wcstoimax.c | 51 - library/inttypes_wcstoumax.c | 51 - library/libgen_basename.c | 97 - library/libgen_dirname.c | 98 - library/locale_headers.h | 124 - library/locale_init_exit.c | 269 -- library/locale_localeconv.c | 84 - library/locale_open_locale.c | 40 - library/locale_setlocale.c | 164 - library/m.lib_rev.c | 38 - library/m.lib_rev.h | 6 - library/m.lib_rev.rev | 1 - library/m881.lib_rev.c | 38 - library/m881.lib_rev.h | 6 - library/m881.lib_rev.rev | 1 - library/macros.h | 170 -- library/make_ctype_table.c | 297 -- library/math_acos.c | 238 -- library/math_acosf.c | 118 - library/math_acosh.c | 84 - library/math_acoshf.c | 86 - library/math_adddf3.c | 75 - library/math_addsf3.c | 56 - library/math_asin.c | 249 -- library/math_asinf.c | 121 - library/math_asinh.c | 83 - library/math_asinhf.c | 86 - library/math_atan.c | 273 -- library/math_atan2.c | 333 -- library/math_atan2f.c | 141 - library/math_atanf.c | 136 - library/math_atanh.c | 53 - library/math_atanhf.c | 53 - library/math_cbrt.c | 115 - library/math_cbrtf.c | 104 - library/math_ceil.c | 250 -- library/math_ceilf.c | 89 - library/math_copysign.c | 67 - library/math_copysignf.c | 67 - library/math_cos.c | 192 -- library/math_cosf.c | 88 - library/math_cosh.c | 207 -- library/math_coshf.c | 100 - library/math_divdf3.c | 75 - library/math_divsf3.c | 56 - library/math_eqdf2.c | 75 - library/math_eqsf2.c | 56 - library/math_erf.c | 182 -- library/math_erfc.c | 192 -- library/math_erfcf.c | 195 -- library/math_erff.c | 186 -- library/math_exp.c | 252 -- library/math_exp2.c | 52 - library/math_exp2f.c | 52 - library/math_expf.c | 136 - library/math_expm1.c | 163 - library/math_expm1f.c | 163 - library/math_extendsfdf2.c | 75 - library/math_fabs.c | 191 -- library/math_fabsf.c | 142 - library/math_fdim.c | 59 - library/math_fdimf.c | 59 - library/math_fixdfsi.c | 75 - library/math_fixsfsi.c | 56 - library/math_fixunsdfsi.c | 61 - library/math_fixunssfsi.c | 61 - library/math_floatsidf.c | 75 - library/math_floatsisf.c | 56 - library/math_floor.c | 250 -- library/math_floorf.c | 78 - library/math_fma.c | 53 - library/math_fmaf.c | 53 - library/math_fmax.c | 73 - library/math_fmaxf.c | 73 - library/math_fmin.c | 73 - library/math_fminf.c | 73 - library/math_fmod.c | 296 -- library/math_fmodf.c | 93 - library/math_fp_support.h | 88 - library/math_fpclassify.c | 153 - library/math_frexp.c | 218 -- library/math_frexpf.c | 80 - library/math_gedf2.c | 75 - library/math_gesf2.c | 56 - library/math_gtdf2.c | 75 - library/math_gtsf2.c | 56 - library/math_headers.h | 236 -- library/math_huge_val.c | 44 - library/math_huge_valf.c | 44 - library/math_hypot.c | 171 -- library/math_hypotf.c | 96 - library/math_ilogb.c | 77 - library/math_ilogbf.c | 76 - library/math_inf.c | 62 - library/math_inff.c | 61 - library/math_init_exit.c | 219 -- library/math_isfinite.c | 89 - library/math_isunordered.c | 117 - library/math_kernel_cos.c | 90 - library/math_kernel_cosf.c | 94 - library/math_kernel_expm1.c | 162 - library/math_kernel_rem_pio2.c | 351 --- library/math_kernel_scalbn.c | 88 - library/math_kernel_sin.c | 82 - library/math_kernel_sinf.c | 83 - library/math_kernel_tan.c | 141 - library/math_kernel_tanf.c | 131 - library/math_ldexp.c | 175 -- library/math_ldexpf.c | 66 - library/math_ledf2.c | 75 - library/math_lesf2.c | 56 - library/math_lgamma.c | 253 -- library/math_lgammaf.c | 266 -- library/math_log.c | 264 -- library/math_log10.c | 206 -- library/math_log10f.c | 92 - library/math_log1p.c | 133 - library/math_log1pf.c | 137 - library/math_log2.c | 52 - library/math_log2f.c | 52 - library/math_logb.c | 133 - library/math_logbf.c | 72 - library/math_logf.c | 123 - library/math_lrint.c | 53 - library/math_lrintf.c | 53 - library/math_lround.c | 53 - library/math_lroundf.c | 53 - library/math_ltdf2.c | 75 - library/math_ltsf2.c | 56 - library/math_modf.c | 170 -- library/math_modff.c | 136 - library/math_muldf3.c | 75 - library/math_mulsf3.c | 56 - library/math_nan.c | 63 - library/math_nanf.c | 62 - library/math_nearbyint.c | 53 - library/math_nearbyintf.c | 53 - library/math_nedf2.c | 75 - library/math_negdf2.c | 75 - library/math_negsf2.c | 56 - library/math_nesf2.c | 56 - library/math_nextafter.c | 105 - library/math_nextafterf.c | 102 - library/math_pow.c | 467 --- library/math_powf.c | 283 -- library/math_rem_pio2f.c | 389 --- library/math_remainder.c | 99 - library/math_remainderf.c | 101 - library/math_remquo.c | 53 - library/math_remquof.c | 53 - library/math_rint.c | 136 - library/math_rintf.c | 129 - library/math_round.c | 53 - library/math_roundf.c | 53 - library/math_scalbn.c | 89 - library/math_scalbnf.c | 98 - library/math_signbit.c | 79 - library/math_sin.c | 186 -- library/math_sinf.c | 86 - library/math_sinh.c | 198 -- library/math_sinhf.c | 97 - library/math_sqrt.c | 263 -- library/math_sqrtf.c | 126 - library/math_subdf3.c | 75 - library/math_subsf3.c | 56 - library/math_tan.c | 179 -- library/math_tanf.c | 81 - library/math_tanh.c | 192 -- library/math_tanhf.c | 93 - library/math_tgamma.c | 53 - library/math_tgammaf.c | 53 - library/math_trunc.c | 53 - library/math_truncdfsf2.c | 75 - library/math_truncf.c | 53 - library/mount_convertinfo.c | 161 - library/mount_fstatfs.c | 142 - library/mount_headers.h | 65 - library/mount_statfs.c | 156 - library/ncrt0.S | 116 - library/net.lib_rev.c | 38 - library/net.lib_rev.h | 6 - library/net.lib_rev.rev | 1 - library/nrcrt0.S | 182 -- library/profile__mcount.c | 106 - library/profile_gmon.c | 288 -- library/profile_gmon.h | 81 - library/profile_mcount.S | 36 - library/profile_profil.c | 127 - library/releasenotes | 10 - library/sas_cxamemcpy.asm | 46 - library/sas_cxamemset.asm | 89 - library/sas_cxferr.c | 19 - library/sas_cxv.asm | 141 - library/sas_cxv45.asm | 143 - library/sas_cxv54.asm | 114 - library/sas_profile.c | 348 --- library/signal_checkabort.c | 49 - library/signal_data.c | 40 - library/signal_headers.h | 99 - library/signal_kill.c | 96 - library/signal_raise.c | 146 - library/signal_sigaddset.c | 77 - library/signal_sigblock.c | 59 - library/signal_sigemptyset.c | 77 - library/signal_sigmask.c | 62 - library/signal_signal.c | 66 - library/signal_sigprocmask.c | 101 - library/signal_sigsetmask.c | 59 - library/smakefile | 948 ------ library/socket_accept.c | 157 - library/socket_bind.c | 101 - library/socket_connect.c | 101 - library/socket_get_descriptor.c | 72 - library/socket_gethostbyaddr.c | 91 - library/socket_gethostbyname.c | 89 - library/socket_gethostid.c | 66 - library/socket_gethostname.c | 90 - library/socket_getnetbyaddr.c | 68 - library/socket_getnetbyname.c | 89 - library/socket_getpeername.c | 101 - library/socket_getprotobyname.c | 87 - library/socket_getprotobynumber.c | 66 - library/socket_getservbyname.c | 87 - library/socket_getservbyport.c | 87 - library/socket_getsockname.c | 101 - library/socket_getsockopt.c | 103 - library/socket_headers.h | 1081 ------- library/socket_hook_entry.c | 224 -- library/socket_hstrerror.c | 137 - library/socket_inet_addr.c | 89 - library/socket_inet_aton.c | 201 -- library/socket_inet_lnaof.c | 66 - library/socket_inet_makeaddr.c | 66 - library/socket_inet_netof.c | 66 - library/socket_inet_network.c | 87 - library/socket_inet_ntoa.c | 72 - library/socket_init_exit.c | 360 --- library/socket_ioctl.c | 123 - library/socket_isdaemon.c | 48 - library/socket_listen.c | 81 - library/socket_recv.c | 103 - library/socket_recvfrom.c | 104 - library/socket_recvmsg.c | 101 - library/socket_select.c | 1022 ------- library/socket_send.c | 103 - library/socket_sendmsg.c | 101 - library/socket_sendto.c | 104 - library/socket_setsockopt.c | 103 - library/socket_shutdown.c | 81 - library/socket_socket.c | 122 - library/stack.lib_rev.c | 38 - library/stack.lib_rev.h | 6 - library/stack.lib_rev.rev | 1 - library/startup.c | 48 - library/stat_chmod.c | 155 - library/stat_convertfileinfo.c | 155 - library/stat_fchmod.c | 179 -- library/stat_fstat.c | 113 - library/stat_headers.h | 65 - library/stat_lstat.c | 302 -- library/stat_mkdir.c | 167 - library/stat_rmdir.c | 162 - library/stat_stat.c | 172 -- library/stat_umask.c | 106 - library/stdio_asprintf.c | 84 - library/stdio_clearerr.c | 86 - library/stdio_ctermid.c | 51 - library/stdio_dropiobreadbuffer.c | 121 - library/stdio_duplicate_fd.c | 62 - library/stdio_examine_fh.c | 70 - library/stdio_fclose.c | 155 - library/stdio_fdhookentry.c | 652 ---- library/stdio_feof.c | 93 - library/stdio_ferror.c | 92 - library/stdio_fflush.c | 108 - library/stdio_fgetc.c | 166 - library/stdio_fgetpos.c | 94 - library/stdio_fgets.c | 139 - library/stdio_file_init.c | 388 --- library/stdio_filliobreadbuffer.c | 97 - library/stdio_findvacantfdentry.c | 94 - library/stdio_findvacantiobentry.c | 91 - library/stdio_flockfile.c | 97 - library/stdio_flush.c | 104 - library/stdio_flush_all_files.c | 71 - library/stdio_flushiobwritebuffer.c | 98 - library/stdio_fopen.c | 103 - library/stdio_fprintf.c | 80 - library/stdio_fputc.c | 165 - library/stdio_fputs.c | 114 - library/stdio_fread.c | 153 - library/stdio_freopen.c | 98 - library/stdio_fscanf.c | 82 - library/stdio_fseek.c | 209 -- library/stdio_fseeko.c | 62 - library/stdio_fsetpos.c | 89 - library/stdio_ftell.c | 141 - library/stdio_ftello.c | 62 - library/stdio_ftrylockfile.c | 101 - library/stdio_funlockfile.c | 97 - library/stdio_fwrite.c | 176 -- library/stdio_get_file_descriptor.c | 110 - library/stdio_getc.c | 72 - library/stdio_getc_unlocked.c | 72 - library/stdio_getchar.c | 52 - library/stdio_getchar_unlocked.c | 72 - library/stdio_gets.c | 127 - library/stdio_grow_file.c | 169 - library/stdio_growfdtable.c | 110 - library/stdio_growiobtable.c | 110 - library/stdio_headers.h | 527 ---- library/stdio_init_exit.c | 147 - library/stdio_initializefd.c | 57 - library/stdio_initializeiob.c | 64 - library/stdio_iobhookentry.c | 96 - library/stdio_lock.c | 97 - library/stdio_locksemaphorename.c | 40 - library/stdio_nostdio.c | 40 - library/stdio_openiob.c | 212 -- library/stdio_parent_of_fh.c | 68 - library/stdio_perror.c | 57 - library/stdio_popen.c | 360 --- library/stdio_printf.c | 79 - library/stdio_protos.h | 230 -- library/stdio_putc.c | 72 - library/stdio_putc_unlocked.c | 72 - library/stdio_putchar.c | 52 - library/stdio_putchar_unlocked.c | 72 - library/stdio_puts.c | 116 - library/stdio_record_locking.c | 1254 -------- library/stdio_remove.c | 100 - library/stdio_remove_fd_alias.c | 93 - library/stdio_rename.c | 156 - library/stdio_rewind.c | 55 - library/stdio_scanf.c | 81 - library/stdio_setbuf.c | 79 - library/stdio_setvbuf.c | 200 -- library/stdio_snprintf.c | 84 - library/stdio_sprintf.c | 80 - library/stdio_sscanf.c | 79 - library/stdio_sscanf_hook_entry.c | 91 - library/stdio_tmpfile.c | 119 - library/stdio_tmpnam.c | 121 - library/stdio_translateioerror.c | 118 - library/stdio_ungetc.c | 145 - library/stdio_unlockfile.c | 46 - library/stdio_vasprintf.c | 139 - library/stdio_vasprintf_hook_entry.c | 120 - library/stdio_vfprintf.c | 1702 ----------- library/stdio_vfscanf.c | 1923 ------------ library/stdio_vprintf.c | 77 - library/stdio_vscanf.c | 78 - library/stdio_vsnprintf.c | 121 - library/stdio_vsnprintf_hook_entry.c | 86 - library/stdio_vsprintf.c | 83 - library/stdio_vsprintf_hook_entry.c | 74 - library/stdio_vsscanf.c | 92 - library/stdlib_abort.c | 65 - library/stdlib_abs.c | 48 - library/stdlib_alloca.c | 187 -- library/stdlib_arg.c | 346 --- library/stdlib_assertion_failure.c | 208 -- library/stdlib_atexit.c | 144 - library/stdlib_atof.c | 76 - library/stdlib_atoi.c | 68 - library/stdlib_atol.c | 68 - library/stdlib_atoll.c | 76 - library/stdlib_bsearch.c | 105 - library/stdlib_calloc.c | 93 - library/stdlib_checkdetach.c | 40 - library/stdlib_constructor.c | 48 - library/stdlib_constructor.h | 144 - library/stdlib_constructor_begin.c | 344 --- library/stdlib_default_pool_size.c | 40 - library/stdlib_default_puddle_size.c | 40 - library/stdlib_destructor.c | 48 - library/stdlib_detach.c | 40 - library/stdlib_disablerequesters.c | 40 - library/stdlib_div.c | 51 - library/stdlib_divmodsi3.c | 79 - library/stdlib_divsi3.c | 69 - library/stdlib_divsi4.c | 77 - library/stdlib_dosbase.c | 50 - library/stdlib_exit.c | 78 - library/stdlib_free.c | 524 ---- library/stdlib_gcc_help.h | 50 - library/stdlib_get_errno.c | 44 - library/stdlib_getdefstacksize.c | 50 - library/stdlib_getenv.c | 89 - library/stdlib_getsp.asm | 45 - library/stdlib_getsp.c | 88 - library/stdlib_headers.h | 206 -- library/stdlib_isresident.c | 44 - library/stdlib_labs.c | 48 - library/stdlib_ldiv.c | 51 - library/stdlib_lib_main.c | 234 -- library/stdlib_lib_startup.c | 44 - library/stdlib_llabs.c | 48 - library/stdlib_lldiv.c | 51 - library/stdlib_localebase.h | 88 - library/stdlib_machine_test.c | 68 - library/stdlib_main.c | 590 ---- library/stdlib_malloc.c | 420 --- library/stdlib_math.c | 44 - library/stdlib_mblen.c | 45 - library/stdlib_mbstowcs.c | 45 - library/stdlib_mbtowc.c | 45 - library/stdlib_memory.h | 236 -- library/stdlib_mkdtemp.c | 95 - library/stdlib_mkstemp.c | 91 - library/stdlib_mktemp.c | 244 -- library/stdlib_modsi3.c | 76 - library/stdlib_mulsi3.c | 79 - library/stdlib_never_free.c | 40 - library/stdlib_null_pointer_check.h | 47 - library/stdlib_osliberror.c | 34 - library/stdlib_oslibversion.c | 34 - library/stdlib_priority.c | 36 - library/stdlib_process_name.c | 34 - library/stdlib_profile.h | 74 - library/stdlib_profile_monitoring.c | 94 - library/stdlib_profile_monitoring.h | 71 - library/stdlib_program_name.c | 111 - library/stdlib_protos.h | 205 -- library/stdlib_putenv.c | 82 - library/stdlib_qsort.c | 291 -- library/stdlib_rand.c | 52 - library/stdlib_rand_r.c | 67 - library/stdlib_realloc.c | 210 -- library/stdlib_red_black.c | 424 --- library/stdlib_semaphore.c | 86 - library/stdlib_set_errno.c | 44 - library/stdlib_set_process_window.c | 60 - library/stdlib_setenv.c | 255 -- library/stdlib_setjmp.asm | 98 - library/stdlib_setjmp.c | 414 --- library/stdlib_setjmp.i | 70 - library/stdlib_shell_escape.c | 67 - library/stdlib_showerror.c | 265 -- library/stdlib_srand.c | 44 - library/stdlib_stack_usage.c | 114 - library/stdlib_stackargbytes.c | 40 - library/stdlib_stackcheck.c | 142 - library/stdlib_stackextension.c | 649 ---- library/stdlib_stackminframe.c | 40 - library/stdlib_stackoverflow.c | 84 - library/stdlib_stacksafezone.c | 40 - library/stdlib_stacksize.c | 84 - library/stdlib_stdio_window_spec.c | 34 - library/stdlib_strtod.c | 381 --- library/stdlib_strtof.c | 381 --- library/stdlib_strtol.c | 196 -- library/stdlib_strtoll.c | 204 -- library/stdlib_strtoul.c | 193 -- library/stdlib_strtoull.c | 201 -- library/stdlib_swapstack.asm | 67 - library/stdlib_swapstack.c | 117 - library/stdlib_sysbase.c | 54 - library/stdlib_system.c | 199 -- library/stdlib_termination_message.c | 64 - library/stdlib_threshold.c | 40 - library/stdlib_udivmodsi3.c | 79 - library/stdlib_udivsi3.c | 68 - library/stdlib_udivsi4.c | 76 - library/stdlib_umodsi3.c | 74 - library/stdlib_unsetenv.c | 102 - library/stdlib_utilitybase.c | 54 - library/stdlib_utilitybase.h | 88 - library/stdlib_wcstombs.c | 45 - library/stdlib_wctomb.c | 45 - library/string_bcmp.c | 55 - library/string_bcopy.c | 50 - library/string_bzero.c | 50 - library/string_headers.h | 86 - library/string_index.c | 52 - library/string_memchr.c | 219 -- library/string_memcmp.c | 207 -- library/string_memcpy.c | 380 --- library/string_memmove.c | 617 ---- library/string_memset.c | 169 - library/string_rindex.c | 52 - library/string_strcat.c | 72 - library/string_strchr.c | 84 - library/string_strcmp.c | 80 - library/string_strcoll.c | 86 - library/string_strcpy.c | 72 - library/string_strcspn.c | 79 - library/string_strdup.c | 105 - library/string_strerror.c | 198 -- library/string_strlcat.c | 140 - library/string_strlcpy.c | 130 - library/string_strlen.c | 72 - library/string_strncat.c | 91 - library/string_strncmp.c | 90 - library/string_strncpy.c | 85 - library/string_strpbrk.c | 80 - library/string_strrchr.c | 89 - library/string_strspn.c | 79 - library/string_strstr.c | 102 - library/string_strtok.c | 59 - library/string_strtok_r.c | 112 - library/string_strxfrm.c | 118 - library/strings_ffs.c | 71 - library/strings_headers.h | 57 - library/strings_strcasecmp.c | 85 - library/strings_strncasecmp.c | 94 - library/termios_cfgetispeed.c | 61 - library/termios_cfgetospeed.c | 61 - library/termios_cfmakeraw.c | 66 - library/termios_cfsetispeed.c | 97 - library/termios_cfsetospeed.c | 96 - library/termios_console_fdhookentry.c | 654 ---- library/termios_headers.h | 74 - library/termios_openserial.c | 55 - library/termios_tcdrain.c | 100 - library/termios_tcflow.c | 65 - library/termios_tcflush.c | 125 - library/termios_tcgetattr.c | 174 -- library/termios_tcsendbreak.c | 108 - library/termios_tcsetattr.c | 156 - library/time_asctime.c | 59 - library/time_asctime_r.c | 202 -- library/time_clock.c | 112 - library/time_convert_datestamp.c | 64 - library/time_convert_time.c | 76 - library/time_converttime.c | 87 - library/time_ctime.c | 73 - library/time_ctime_r.c | 72 - library/time_data.c | 92 - library/time_days_per_date.c | 56 - library/time_difftime.c | 56 - library/time_gettimeofday.c | 122 - library/time_gmtime.c | 58 - library/time_gmtime_r.c | 71 - library/time_headers.h | 149 - library/time_localtime.c | 63 - library/time_localtime_r.c | 90 - library/time_mktime.c | 204 -- library/time_numbertostring.c | 96 - library/time_strftime.c | 674 ---- library/time_time.c | 63 - library/time_weekday.c | 86 - library/uio_headers.h | 57 - library/uio_readv.c | 149 - library/uio_writev.c | 153 - library/unistd_access.c | 231 -- library/unistd_chdir.c | 185 -- library/unistd_chdir_exit.c | 80 - library/unistd_chown.c | 171 -- library/unistd_currentpathname.c | 40 - library/unistd_dup.c | 48 - library/unistd_dup2.c | 129 - library/unistd_fchown.c | 187 -- library/unistd_fdatasync.c | 83 - library/unistd_fdopen.c | 111 - library/unistd_fileno.c | 100 - library/unistd_fsync.c | 82 - library/unistd_ftruncate.c | 207 -- library/unistd_getcwd.c | 224 -- library/unistd_getopt.c | 163 - library/unistd_getpid.c | 85 - library/unistd_headers.h | 101 - library/unistd_init_exit.c | 95 - library/unistd_isatty.c | 77 - library/unistd_lchown.c | 84 - library/unistd_link.c | 140 - library/unistd_readlink.c | 180 -- library/unistd_realpath.c | 151 - library/unistd_restorepathname.c | 47 - library/unistd_setcurrentpath.c | 71 - library/unistd_sleep.c | 56 - library/unistd_strip_double_slash.c | 95 - library/unistd_symlink.c | 101 - library/unistd_sync_fd.c | 91 - library/unistd_time_delay.c | 142 - library/unistd_timer.c | 153 - library/unistd_translatea2u.c | 281 -- library/unistd_translaterel.c | 103 - library/unistd_translateu2a.c | 553 ---- library/unistd_truncate.c | 101 - library/unistd_ttyname.c | 73 - library/unistd_ttyname_r.c | 81 - library/unistd_unix_path_semantics.c | 40 - library/unistd_unlink.c | 192 -- library/unistd_usleep.c | 54 - library/unistd_wildcard_expand.c | 519 ---- library/unix.lib_rev.c | 38 - library/unix.lib_rev.h | 6 - library/unix.lib_rev.rev | 1 - library/usergroup_crypt.c | 98 - library/usergroup_data.c | 51 - library/usergroup_endgrent.c | 69 - library/usergroup_endpwent.c | 69 - library/usergroup_getegid.c | 79 - library/usergroup_geteuid.c | 79 - library/usergroup_getgid.c | 79 - library/usergroup_getgrent.c | 72 - library/usergroup_getgrgid.c | 66 - library/usergroup_getgrnam.c | 89 - library/usergroup_getgroups.c | 97 - library/usergroup_getpass.c | 91 - library/usergroup_getpwent.c | 66 - library/usergroup_getpwnam.c | 89 - library/usergroup_getpwuid.c | 68 - library/usergroup_getuid.c | 73 - library/usergroup_headers.h | 794 ----- library/usergroup_init_exit.c | 154 - library/usergroup_initgroups.c | 90 - library/usergroup_rootmode.c | 48 - library/usergroup_setegid.c | 66 - library/usergroup_seteuid.c | 66 - library/usergroup_setgid.c | 77 - library/usergroup_setgrent.c | 63 - library/usergroup_setgroups.c | 97 - library/usergroup_setpwent.c | 63 - library/usergroup_setregid.c | 82 - library/usergroup_setreuid.c | 82 - library/usergroup_setsid.c | 66 - library/usergroup_setuid.c | 77 - library/utime_headers.h | 59 - library/utime_utime.c | 123 - library/utsname_uname.c | 167 - library/wchar_btowc.c | 45 - library/wchar_fgetwc.c | 45 - library/wchar_fgetws.c | 45 - library/wchar_fputwc.c | 45 - library/wchar_fputws.c | 45 - library/wchar_fwide.c | 45 - library/wchar_fwprintf.c | 45 - library/wchar_fwscanf.c | 45 - library/wchar_getwc.c | 45 - library/wchar_getwchar.c | 45 - library/wchar_headers.h | 49 - library/wchar_mbrlen.c | 45 - library/wchar_mbsinit.c | 45 - library/wchar_mbsrtowcs.c | 45 - library/wchar_putwc.c | 45 - library/wchar_putwchar.c | 45 - library/wchar_swprintf.c | 45 - library/wchar_swscanf.c | 45 - library/wchar_ungetwc.c | 45 - library/wchar_vfwprintf.c | 45 - library/wchar_vswprintf.c | 45 - library/wchar_vwprintf.c | 45 - library/wchar_wcrtomb.c | 45 - library/wchar_wcscat.c | 45 - library/wchar_wcschr.c | 45 - library/wchar_wcscmp.c | 45 - library/wchar_wcscpy.c | 45 - library/wchar_wcsftime.c | 45 - library/wchar_wcslen.c | 45 - library/wchar_wcsncat.c | 45 - library/wchar_wcsncmp.c | 45 - library/wchar_wcsncpy.c | 45 - library/wchar_wcspbrk.c | 45 - library/wchar_wcsrtombs.c | 45 - library/wchar_wcsspn.c | 45 - library/wchar_wcstod.c | 49 - library/wchar_wcstok.c | 45 - library/wchar_wcstol.c | 45 - library/wchar_wcstoll.c | 45 - library/wchar_wcstoul.c | 45 - library/wchar_wcstoull.c | 45 - library/wchar_wcsxfrm.c | 45 - library/wchar_wmemchr.c | 45 - library/wchar_wmemcmp.c | 45 - library/wchar_wmemcpy.c | 45 - library/wchar_wmemmove.c | 45 - library/wchar_wmemset.c | 45 - library/wchar_wprintf.c | 45 - library/wchar_wscanf.c | 45 - library/wchar_wscoll.c | 45 - library/wctype_headers.h | 43 - library/wctype_iswalnum.c | 45 - library/wctype_iswalpha.c | 45 - library/wctype_iswblank.c | 45 - library/wctype_iswcntrl.c | 45 - library/wctype_iswctype.c | 45 - library/wctype_iswdigit.c | 45 - library/wctype_iswgraph.c | 45 - library/wctype_iswlower.c | 45 - library/wctype_iswprint.c | 45 - library/wctype_iswpunc.c | 45 - library/wctype_iswspace.c | 45 - library/wctype_iswupper.c | 45 - library/wctype_iswxdigit.c | 45 - library/wctype_towctrans.c | 45 - library/wctype_towlower.c | 45 - library/wctype_towupper.c | 45 - library/wctype_wctrans.c | 45 - library/wctype_wctype.c | 45 - test_programs/GNUmakefile.68k | 118 - test_programs/GNUmakefile.os4 | 102 - test_programs/README | 5 - test_programs/clib-bug.c | 74 - test_programs/fgets_test.c | 41 - test_programs/fstat_stdout_test.c | 36 - test_programs/iotest.c | 44 - test_programs/printf_g_test.c | 12 - test_programs/printf_test.c | 238 -- test_programs/simple.c | 13 - test_programs/simple_sprintf.c | 99 - test_programs/smakefile | 162 - test_programs/sprintf_test.c | 25 - test_programs/sscanf_test.c | 135 - test_programs/stack_extension_test.c | 31 - test_programs/stack_size_test.c | 15 - test_programs/strtok_test.c | 35 - test_programs/test.c | 282 -- test_programs/translate_test.c | 39 - test_programs/uname.c | 56 - 906 files changed, 108791 deletions(-) delete mode 100644 CVSROOT/checkoutlist delete mode 100644 CVSROOT/commitinfo delete mode 100644 CVSROOT/config delete mode 100644 CVSROOT/cvswrappers delete mode 100644 CVSROOT/editinfo delete mode 100644 CVSROOT/loginfo delete mode 100644 CVSROOT/modules delete mode 100644 CVSROOT/notify delete mode 100644 CVSROOT/rcsinfo delete mode 100644 CVSROOT/taginfo delete mode 100644 CVSROOT/verifymsg delete mode 100644 documentation/BUILDING.html delete mode 100644 documentation/GCC-68K.html delete mode 100644 documentation/README.html delete mode 100644 documentation/specs delete mode 100644 library/GNUmakefile.68k delete mode 100644 library/GNUmakefile.os4 delete mode 100755 library/TODO delete mode 100644 library/amiga.lib_rev.c delete mode 100644 library/amiga.lib_rev.h delete mode 100644 library/amiga.lib_rev.rev delete mode 100644 library/amiga_acrypt.c delete mode 100644 library/amiga_addtof.c delete mode 100644 library/amiga_argarraydone.c delete mode 100644 library/amiga_argarrayinit.c delete mode 100644 library/amiga_argint.c delete mode 100644 library/amiga_argstring.c delete mode 100644 library/amiga_beginio.c delete mode 100644 library/amiga_callhook.c delete mode 100644 library/amiga_callhooka.asm delete mode 100644 library/amiga_callhooka.c delete mode 100644 library/amiga_coercemethod.c delete mode 100644 library/amiga_createextio.c delete mode 100644 library/amiga_createport.c delete mode 100644 library/amiga_createstdio.c delete mode 100644 library/amiga_createtask.c delete mode 100644 library/amiga_deleteextio.c delete mode 100644 library/amiga_deleteport.c delete mode 100644 library/amiga_deletestdio.c delete mode 100644 library/amiga_deletetask.c delete mode 100644 library/amiga_domethod.c delete mode 100644 library/amiga_dosupermethod.c delete mode 100644 library/amiga_dotimer.c delete mode 100644 library/amiga_fastrand.c delete mode 100644 library/amiga_freeievents.c delete mode 100644 library/amiga_hookentry.asm delete mode 100644 library/amiga_hookentry.c delete mode 100644 library/amiga_hotkey.c delete mode 100644 library/amiga_invertstring.c delete mode 100644 library/amiga_newlist.c delete mode 100644 library/amiga_rangerand.c delete mode 100644 library/amiga_remtof.c delete mode 100644 library/amiga_rexxvars.c delete mode 100644 library/amiga_setsuperattrs.c delete mode 100644 library/amiga_timedelay.c delete mode 100644 library/amiga_waitbeam.c delete mode 100755 library/build_archive_amiga delete mode 100755 library/build_archive_unix.sh delete mode 100644 library/c.lib_rev.c delete mode 100644 library/c.lib_rev.h delete mode 100644 library/c.lib_rev.rev delete mode 100644 library/changes delete mode 100644 library/complex_carg.c delete mode 100644 library/complex_cargf.c delete mode 100644 library/complex_cargl.c delete mode 100644 library/complex_cimag.c delete mode 100644 library/complex_cimagf.c delete mode 100644 library/complex_cimagl.c delete mode 100644 library/complex_conj.c delete mode 100644 library/complex_conjf.c delete mode 100644 library/complex_conjl.c delete mode 100644 library/complex_creal.c delete mode 100644 library/complex_crealf.c delete mode 100644 library/complex_creall.c delete mode 100755 library/complex_headers.h delete mode 100644 library/crt0.S delete mode 100644 library/crtbegin.c delete mode 100644 library/crtend.c delete mode 100644 library/ctype_headers.h delete mode 100644 library/ctype_isalnum.c delete mode 100644 library/ctype_isalpha.c delete mode 100644 library/ctype_isascii.c delete mode 100644 library/ctype_isblank.c delete mode 100644 library/ctype_iscntrl.c delete mode 100644 library/ctype_isdigit.c delete mode 100644 library/ctype_isgraph.c delete mode 100644 library/ctype_islower.c delete mode 100644 library/ctype_isprint.c delete mode 100644 library/ctype_ispunct.c delete mode 100644 library/ctype_isspace.c delete mode 100644 library/ctype_isupper.c delete mode 100644 library/ctype_isxdigit.c delete mode 100644 library/ctype_table.c delete mode 100644 library/ctype_tolower.c delete mode 100644 library/ctype_toupper.c delete mode 100644 library/debug.c delete mode 100644 library/debug.h delete mode 100644 library/debug.lib_rev.c delete mode 100644 library/debug.lib_rev.h delete mode 100644 library/debug.lib_rev.rev delete mode 100644 library/debug_cmpstrexec.c delete mode 100644 library/debug_headers.h delete mode 100644 library/debug_kcmpstr.c delete mode 100644 library/debug_kdofmt.c delete mode 100644 library/debug_kgetc.c delete mode 100644 library/debug_kgetch1.c delete mode 100644 library/debug_kgetch2.c delete mode 100644 library/debug_kgetchar1.c delete mode 100644 library/debug_kgetchar2.c delete mode 100644 library/debug_kgetnum1.c delete mode 100644 library/debug_kgetnum2.c delete mode 100644 library/debug_kmaygetch.c delete mode 100644 library/debug_kmaygetchar.c delete mode 100644 library/debug_kprintf1.c delete mode 100644 library/debug_kprintf2.c delete mode 100644 library/debug_kputc.c delete mode 100644 library/debug_kputch1.c delete mode 100644 library/debug_kputch2.c delete mode 100644 library/debug_kputchar1.c delete mode 100644 library/debug_kputchar2.c delete mode 100644 library/debug_kputfmt.c delete mode 100644 library/debug_kputs1.c delete mode 100644 library/debug_kputs2.c delete mode 100644 library/debug_kputstr1.c delete mode 100644 library/debug_kputstr2.c delete mode 100644 library/debug_kvprintf1.c delete mode 100644 library/debug_kvprintf2.c delete mode 100644 library/debug_level.c delete mode 100644 library/dirent_closedir.c delete mode 100644 library/dirent_headers.h delete mode 100644 library/dirent_opendir.c delete mode 100644 library/dirent_readdir.c delete mode 100644 library/dirent_rewinddir.c delete mode 100644 library/errno_data.c delete mode 100644 library/fcntl_close.c delete mode 100644 library/fcntl_creat.c delete mode 100644 library/fcntl_fcntl.c delete mode 100644 library/fcntl_get_default_file.c delete mode 100644 library/fcntl_headers.h delete mode 100644 library/fcntl_lock.c delete mode 100644 library/fcntl_lseek.c delete mode 100644 library/fcntl_open.c delete mode 100644 library/fcntl_read.c delete mode 100644 library/fcntl_write.c delete mode 100644 library/ftw_ftw.c delete mode 100644 library/ftw_headers.h delete mode 100644 library/ftw_nftw.c delete mode 100644 library/getopt_getopt_long.c delete mode 100644 library/include/assert.h delete mode 100644 library/include/complex.h delete mode 100644 library/include/ctype.h delete mode 100644 library/include/dirent.h delete mode 100644 library/include/dos.h delete mode 100644 library/include/errno.h delete mode 100644 library/include/fcntl.h delete mode 100644 library/include/float.h delete mode 100644 library/include/ftw.h delete mode 100644 library/include/getopt.h delete mode 100644 library/include/grp.h delete mode 100644 library/include/inttypes.h delete mode 100644 library/include/iso646.h delete mode 100644 library/include/libgen.h delete mode 100644 library/include/limits.h delete mode 100644 library/include/locale.h delete mode 100644 library/include/math.h delete mode 100644 library/include/pwd.h delete mode 100644 library/include/setjmp.h delete mode 100644 library/include/signal.h delete mode 100644 library/include/stdarg.h delete mode 100644 library/include/stdbool.h delete mode 100644 library/include/stddef.h delete mode 100644 library/include/stdint.h delete mode 100644 library/include/stdio.h delete mode 100644 library/include/stdlib.h delete mode 100644 library/include/string.h delete mode 100644 library/include/strings.h delete mode 100644 library/include/sys/amigaos-va.h delete mode 100644 library/include/sys/clib2_stdc.h delete mode 100644 library/include/sys/mount.h delete mode 100644 library/include/sys/stat.h delete mode 100644 library/include/sys/time.h delete mode 100644 library/include/sys/types.h delete mode 100644 library/include/sys/uio.h delete mode 100644 library/include/sys/utsname.h delete mode 100644 library/include/termios.h delete mode 100644 library/include/time.h delete mode 100644 library/include/unistd.h delete mode 100644 library/include/utime.h delete mode 100644 library/include/wchar.h delete mode 100644 library/include/wctype.h delete mode 100644 library/inttypes_headers.h delete mode 100644 library/inttypes_imaxabs.c delete mode 100644 library/inttypes_imaxdiv.c delete mode 100644 library/inttypes_strtoimax.c delete mode 100644 library/inttypes_strtoumax.c delete mode 100644 library/inttypes_wcstoimax.c delete mode 100644 library/inttypes_wcstoumax.c delete mode 100644 library/libgen_basename.c delete mode 100644 library/libgen_dirname.c delete mode 100644 library/locale_headers.h delete mode 100644 library/locale_init_exit.c delete mode 100644 library/locale_localeconv.c delete mode 100644 library/locale_open_locale.c delete mode 100644 library/locale_setlocale.c delete mode 100644 library/m.lib_rev.c delete mode 100644 library/m.lib_rev.h delete mode 100644 library/m.lib_rev.rev delete mode 100644 library/m881.lib_rev.c delete mode 100644 library/m881.lib_rev.h delete mode 100644 library/m881.lib_rev.rev delete mode 100644 library/macros.h delete mode 100644 library/make_ctype_table.c delete mode 100644 library/math_acos.c delete mode 100644 library/math_acosf.c delete mode 100644 library/math_acosh.c delete mode 100644 library/math_acoshf.c delete mode 100644 library/math_adddf3.c delete mode 100644 library/math_addsf3.c delete mode 100644 library/math_asin.c delete mode 100644 library/math_asinf.c delete mode 100644 library/math_asinh.c delete mode 100644 library/math_asinhf.c delete mode 100644 library/math_atan.c delete mode 100644 library/math_atan2.c delete mode 100644 library/math_atan2f.c delete mode 100644 library/math_atanf.c delete mode 100644 library/math_atanh.c delete mode 100644 library/math_atanhf.c delete mode 100644 library/math_cbrt.c delete mode 100644 library/math_cbrtf.c delete mode 100644 library/math_ceil.c delete mode 100644 library/math_ceilf.c delete mode 100644 library/math_copysign.c delete mode 100644 library/math_copysignf.c delete mode 100644 library/math_cos.c delete mode 100644 library/math_cosf.c delete mode 100644 library/math_cosh.c delete mode 100644 library/math_coshf.c delete mode 100644 library/math_divdf3.c delete mode 100644 library/math_divsf3.c delete mode 100644 library/math_eqdf2.c delete mode 100644 library/math_eqsf2.c delete mode 100644 library/math_erf.c delete mode 100644 library/math_erfc.c delete mode 100644 library/math_erfcf.c delete mode 100644 library/math_erff.c delete mode 100644 library/math_exp.c delete mode 100644 library/math_exp2.c delete mode 100644 library/math_exp2f.c delete mode 100644 library/math_expf.c delete mode 100644 library/math_expm1.c delete mode 100644 library/math_expm1f.c delete mode 100644 library/math_extendsfdf2.c delete mode 100644 library/math_fabs.c delete mode 100644 library/math_fabsf.c delete mode 100644 library/math_fdim.c delete mode 100644 library/math_fdimf.c delete mode 100644 library/math_fixdfsi.c delete mode 100644 library/math_fixsfsi.c delete mode 100644 library/math_fixunsdfsi.c delete mode 100644 library/math_fixunssfsi.c delete mode 100644 library/math_floatsidf.c delete mode 100644 library/math_floatsisf.c delete mode 100644 library/math_floor.c delete mode 100644 library/math_floorf.c delete mode 100644 library/math_fma.c delete mode 100644 library/math_fmaf.c delete mode 100644 library/math_fmax.c delete mode 100644 library/math_fmaxf.c delete mode 100644 library/math_fmin.c delete mode 100644 library/math_fminf.c delete mode 100644 library/math_fmod.c delete mode 100644 library/math_fmodf.c delete mode 100644 library/math_fp_support.h delete mode 100644 library/math_fpclassify.c delete mode 100644 library/math_frexp.c delete mode 100644 library/math_frexpf.c delete mode 100644 library/math_gedf2.c delete mode 100644 library/math_gesf2.c delete mode 100644 library/math_gtdf2.c delete mode 100644 library/math_gtsf2.c delete mode 100644 library/math_headers.h delete mode 100644 library/math_huge_val.c delete mode 100644 library/math_huge_valf.c delete mode 100644 library/math_hypot.c delete mode 100644 library/math_hypotf.c delete mode 100644 library/math_ilogb.c delete mode 100644 library/math_ilogbf.c delete mode 100644 library/math_inf.c delete mode 100644 library/math_inff.c delete mode 100644 library/math_init_exit.c delete mode 100644 library/math_isfinite.c delete mode 100644 library/math_isunordered.c delete mode 100644 library/math_kernel_cos.c delete mode 100644 library/math_kernel_cosf.c delete mode 100644 library/math_kernel_expm1.c delete mode 100644 library/math_kernel_rem_pio2.c delete mode 100644 library/math_kernel_scalbn.c delete mode 100644 library/math_kernel_sin.c delete mode 100644 library/math_kernel_sinf.c delete mode 100644 library/math_kernel_tan.c delete mode 100644 library/math_kernel_tanf.c delete mode 100644 library/math_ldexp.c delete mode 100644 library/math_ldexpf.c delete mode 100644 library/math_ledf2.c delete mode 100644 library/math_lesf2.c delete mode 100644 library/math_lgamma.c delete mode 100644 library/math_lgammaf.c delete mode 100644 library/math_log.c delete mode 100644 library/math_log10.c delete mode 100644 library/math_log10f.c delete mode 100644 library/math_log1p.c delete mode 100644 library/math_log1pf.c delete mode 100644 library/math_log2.c delete mode 100644 library/math_log2f.c delete mode 100644 library/math_logb.c delete mode 100644 library/math_logbf.c delete mode 100644 library/math_logf.c delete mode 100755 library/math_lrint.c delete mode 100755 library/math_lrintf.c delete mode 100644 library/math_lround.c delete mode 100755 library/math_lroundf.c delete mode 100644 library/math_ltdf2.c delete mode 100644 library/math_ltsf2.c delete mode 100644 library/math_modf.c delete mode 100644 library/math_modff.c delete mode 100644 library/math_muldf3.c delete mode 100644 library/math_mulsf3.c delete mode 100644 library/math_nan.c delete mode 100644 library/math_nanf.c delete mode 100644 library/math_nearbyint.c delete mode 100644 library/math_nearbyintf.c delete mode 100644 library/math_nedf2.c delete mode 100644 library/math_negdf2.c delete mode 100644 library/math_negsf2.c delete mode 100644 library/math_nesf2.c delete mode 100644 library/math_nextafter.c delete mode 100644 library/math_nextafterf.c delete mode 100644 library/math_pow.c delete mode 100644 library/math_powf.c delete mode 100755 library/math_rem_pio2f.c delete mode 100644 library/math_remainder.c delete mode 100644 library/math_remainderf.c delete mode 100644 library/math_remquo.c delete mode 100644 library/math_remquof.c delete mode 100755 library/math_rint.c delete mode 100755 library/math_rintf.c delete mode 100644 library/math_round.c delete mode 100644 library/math_roundf.c delete mode 100644 library/math_scalbn.c delete mode 100644 library/math_scalbnf.c delete mode 100644 library/math_signbit.c delete mode 100644 library/math_sin.c delete mode 100644 library/math_sinf.c delete mode 100644 library/math_sinh.c delete mode 100644 library/math_sinhf.c delete mode 100644 library/math_sqrt.c delete mode 100644 library/math_sqrtf.c delete mode 100644 library/math_subdf3.c delete mode 100644 library/math_subsf3.c delete mode 100644 library/math_tan.c delete mode 100644 library/math_tanf.c delete mode 100644 library/math_tanh.c delete mode 100644 library/math_tanhf.c delete mode 100644 library/math_tgamma.c delete mode 100644 library/math_tgammaf.c delete mode 100644 library/math_trunc.c delete mode 100644 library/math_truncdfsf2.c delete mode 100644 library/math_truncf.c delete mode 100644 library/mount_convertinfo.c delete mode 100644 library/mount_fstatfs.c delete mode 100644 library/mount_headers.h delete mode 100644 library/mount_statfs.c delete mode 100644 library/ncrt0.S delete mode 100644 library/net.lib_rev.c delete mode 100644 library/net.lib_rev.h delete mode 100644 library/net.lib_rev.rev delete mode 100644 library/nrcrt0.S delete mode 100644 library/profile__mcount.c delete mode 100644 library/profile_gmon.c delete mode 100644 library/profile_gmon.h delete mode 100644 library/profile_mcount.S delete mode 100644 library/profile_profil.c delete mode 100644 library/releasenotes delete mode 100644 library/sas_cxamemcpy.asm delete mode 100644 library/sas_cxamemset.asm delete mode 100644 library/sas_cxferr.c delete mode 100644 library/sas_cxv.asm delete mode 100644 library/sas_cxv45.asm delete mode 100644 library/sas_cxv54.asm delete mode 100644 library/sas_profile.c delete mode 100644 library/signal_checkabort.c delete mode 100644 library/signal_data.c delete mode 100644 library/signal_headers.h delete mode 100644 library/signal_kill.c delete mode 100644 library/signal_raise.c delete mode 100644 library/signal_sigaddset.c delete mode 100644 library/signal_sigblock.c delete mode 100644 library/signal_sigemptyset.c delete mode 100644 library/signal_sigmask.c delete mode 100644 library/signal_signal.c delete mode 100644 library/signal_sigprocmask.c delete mode 100644 library/signal_sigsetmask.c delete mode 100644 library/smakefile delete mode 100644 library/socket_accept.c delete mode 100644 library/socket_bind.c delete mode 100644 library/socket_connect.c delete mode 100644 library/socket_get_descriptor.c delete mode 100644 library/socket_gethostbyaddr.c delete mode 100644 library/socket_gethostbyname.c delete mode 100644 library/socket_gethostid.c delete mode 100644 library/socket_gethostname.c delete mode 100644 library/socket_getnetbyaddr.c delete mode 100644 library/socket_getnetbyname.c delete mode 100644 library/socket_getpeername.c delete mode 100644 library/socket_getprotobyname.c delete mode 100644 library/socket_getprotobynumber.c delete mode 100644 library/socket_getservbyname.c delete mode 100644 library/socket_getservbyport.c delete mode 100644 library/socket_getsockname.c delete mode 100644 library/socket_getsockopt.c delete mode 100644 library/socket_headers.h delete mode 100644 library/socket_hook_entry.c delete mode 100644 library/socket_hstrerror.c delete mode 100644 library/socket_inet_addr.c delete mode 100644 library/socket_inet_aton.c delete mode 100644 library/socket_inet_lnaof.c delete mode 100644 library/socket_inet_makeaddr.c delete mode 100644 library/socket_inet_netof.c delete mode 100644 library/socket_inet_network.c delete mode 100644 library/socket_inet_ntoa.c delete mode 100644 library/socket_init_exit.c delete mode 100644 library/socket_ioctl.c delete mode 100644 library/socket_isdaemon.c delete mode 100644 library/socket_listen.c delete mode 100644 library/socket_recv.c delete mode 100644 library/socket_recvfrom.c delete mode 100644 library/socket_recvmsg.c delete mode 100644 library/socket_select.c delete mode 100644 library/socket_send.c delete mode 100644 library/socket_sendmsg.c delete mode 100644 library/socket_sendto.c delete mode 100644 library/socket_setsockopt.c delete mode 100644 library/socket_shutdown.c delete mode 100644 library/socket_socket.c delete mode 100644 library/stack.lib_rev.c delete mode 100644 library/stack.lib_rev.h delete mode 100644 library/stack.lib_rev.rev delete mode 100644 library/startup.c delete mode 100644 library/stat_chmod.c delete mode 100644 library/stat_convertfileinfo.c delete mode 100644 library/stat_fchmod.c delete mode 100644 library/stat_fstat.c delete mode 100644 library/stat_headers.h delete mode 100644 library/stat_lstat.c delete mode 100644 library/stat_mkdir.c delete mode 100644 library/stat_rmdir.c delete mode 100644 library/stat_stat.c delete mode 100644 library/stat_umask.c delete mode 100644 library/stdio_asprintf.c delete mode 100644 library/stdio_clearerr.c delete mode 100755 library/stdio_ctermid.c delete mode 100644 library/stdio_dropiobreadbuffer.c delete mode 100644 library/stdio_duplicate_fd.c delete mode 100644 library/stdio_examine_fh.c delete mode 100644 library/stdio_fclose.c delete mode 100644 library/stdio_fdhookentry.c delete mode 100644 library/stdio_feof.c delete mode 100644 library/stdio_ferror.c delete mode 100644 library/stdio_fflush.c delete mode 100644 library/stdio_fgetc.c delete mode 100644 library/stdio_fgetpos.c delete mode 100644 library/stdio_fgets.c delete mode 100644 library/stdio_file_init.c delete mode 100644 library/stdio_filliobreadbuffer.c delete mode 100644 library/stdio_findvacantfdentry.c delete mode 100644 library/stdio_findvacantiobentry.c delete mode 100644 library/stdio_flockfile.c delete mode 100644 library/stdio_flush.c delete mode 100644 library/stdio_flush_all_files.c delete mode 100644 library/stdio_flushiobwritebuffer.c delete mode 100644 library/stdio_fopen.c delete mode 100644 library/stdio_fprintf.c delete mode 100644 library/stdio_fputc.c delete mode 100644 library/stdio_fputs.c delete mode 100644 library/stdio_fread.c delete mode 100644 library/stdio_freopen.c delete mode 100644 library/stdio_fscanf.c delete mode 100644 library/stdio_fseek.c delete mode 100644 library/stdio_fseeko.c delete mode 100644 library/stdio_fsetpos.c delete mode 100644 library/stdio_ftell.c delete mode 100755 library/stdio_ftello.c delete mode 100644 library/stdio_ftrylockfile.c delete mode 100644 library/stdio_funlockfile.c delete mode 100644 library/stdio_fwrite.c delete mode 100644 library/stdio_get_file_descriptor.c delete mode 100644 library/stdio_getc.c delete mode 100644 library/stdio_getc_unlocked.c delete mode 100644 library/stdio_getchar.c delete mode 100644 library/stdio_getchar_unlocked.c delete mode 100644 library/stdio_gets.c delete mode 100644 library/stdio_grow_file.c delete mode 100644 library/stdio_growfdtable.c delete mode 100644 library/stdio_growiobtable.c delete mode 100644 library/stdio_headers.h delete mode 100644 library/stdio_init_exit.c delete mode 100644 library/stdio_initializefd.c delete mode 100644 library/stdio_initializeiob.c delete mode 100644 library/stdio_iobhookentry.c delete mode 100644 library/stdio_lock.c delete mode 100644 library/stdio_locksemaphorename.c delete mode 100644 library/stdio_nostdio.c delete mode 100644 library/stdio_openiob.c delete mode 100644 library/stdio_parent_of_fh.c delete mode 100644 library/stdio_perror.c delete mode 100644 library/stdio_popen.c delete mode 100644 library/stdio_printf.c delete mode 100644 library/stdio_protos.h delete mode 100644 library/stdio_putc.c delete mode 100644 library/stdio_putc_unlocked.c delete mode 100644 library/stdio_putchar.c delete mode 100644 library/stdio_putchar_unlocked.c delete mode 100644 library/stdio_puts.c delete mode 100644 library/stdio_record_locking.c delete mode 100644 library/stdio_remove.c delete mode 100644 library/stdio_remove_fd_alias.c delete mode 100644 library/stdio_rename.c delete mode 100644 library/stdio_rewind.c delete mode 100644 library/stdio_scanf.c delete mode 100644 library/stdio_setbuf.c delete mode 100644 library/stdio_setvbuf.c delete mode 100644 library/stdio_snprintf.c delete mode 100644 library/stdio_sprintf.c delete mode 100644 library/stdio_sscanf.c delete mode 100644 library/stdio_sscanf_hook_entry.c delete mode 100644 library/stdio_tmpfile.c delete mode 100644 library/stdio_tmpnam.c delete mode 100644 library/stdio_translateioerror.c delete mode 100644 library/stdio_ungetc.c delete mode 100644 library/stdio_unlockfile.c delete mode 100644 library/stdio_vasprintf.c delete mode 100644 library/stdio_vasprintf_hook_entry.c delete mode 100644 library/stdio_vfprintf.c delete mode 100644 library/stdio_vfscanf.c delete mode 100644 library/stdio_vprintf.c delete mode 100644 library/stdio_vscanf.c delete mode 100644 library/stdio_vsnprintf.c delete mode 100644 library/stdio_vsnprintf_hook_entry.c delete mode 100644 library/stdio_vsprintf.c delete mode 100644 library/stdio_vsprintf_hook_entry.c delete mode 100644 library/stdio_vsscanf.c delete mode 100644 library/stdlib_abort.c delete mode 100644 library/stdlib_abs.c delete mode 100644 library/stdlib_alloca.c delete mode 100644 library/stdlib_arg.c delete mode 100644 library/stdlib_assertion_failure.c delete mode 100644 library/stdlib_atexit.c delete mode 100644 library/stdlib_atof.c delete mode 100644 library/stdlib_atoi.c delete mode 100644 library/stdlib_atol.c delete mode 100644 library/stdlib_atoll.c delete mode 100644 library/stdlib_bsearch.c delete mode 100644 library/stdlib_calloc.c delete mode 100644 library/stdlib_checkdetach.c delete mode 100644 library/stdlib_constructor.c delete mode 100644 library/stdlib_constructor.h delete mode 100644 library/stdlib_constructor_begin.c delete mode 100644 library/stdlib_default_pool_size.c delete mode 100644 library/stdlib_default_puddle_size.c delete mode 100644 library/stdlib_destructor.c delete mode 100644 library/stdlib_detach.c delete mode 100644 library/stdlib_disablerequesters.c delete mode 100644 library/stdlib_div.c delete mode 100644 library/stdlib_divmodsi3.c delete mode 100644 library/stdlib_divsi3.c delete mode 100644 library/stdlib_divsi4.c delete mode 100644 library/stdlib_dosbase.c delete mode 100644 library/stdlib_exit.c delete mode 100644 library/stdlib_free.c delete mode 100644 library/stdlib_gcc_help.h delete mode 100644 library/stdlib_get_errno.c delete mode 100644 library/stdlib_getdefstacksize.c delete mode 100644 library/stdlib_getenv.c delete mode 100644 library/stdlib_getsp.asm delete mode 100644 library/stdlib_getsp.c delete mode 100644 library/stdlib_headers.h delete mode 100644 library/stdlib_isresident.c delete mode 100644 library/stdlib_labs.c delete mode 100644 library/stdlib_ldiv.c delete mode 100755 library/stdlib_lib_main.c delete mode 100644 library/stdlib_lib_startup.c delete mode 100644 library/stdlib_llabs.c delete mode 100644 library/stdlib_lldiv.c delete mode 100644 library/stdlib_localebase.h delete mode 100644 library/stdlib_machine_test.c delete mode 100644 library/stdlib_main.c delete mode 100644 library/stdlib_malloc.c delete mode 100644 library/stdlib_math.c delete mode 100644 library/stdlib_mblen.c delete mode 100644 library/stdlib_mbstowcs.c delete mode 100644 library/stdlib_mbtowc.c delete mode 100644 library/stdlib_memory.h delete mode 100644 library/stdlib_mkdtemp.c delete mode 100644 library/stdlib_mkstemp.c delete mode 100644 library/stdlib_mktemp.c delete mode 100644 library/stdlib_modsi3.c delete mode 100644 library/stdlib_mulsi3.c delete mode 100644 library/stdlib_never_free.c delete mode 100644 library/stdlib_null_pointer_check.h delete mode 100644 library/stdlib_osliberror.c delete mode 100644 library/stdlib_oslibversion.c delete mode 100644 library/stdlib_priority.c delete mode 100644 library/stdlib_process_name.c delete mode 100644 library/stdlib_profile.h delete mode 100644 library/stdlib_profile_monitoring.c delete mode 100644 library/stdlib_profile_monitoring.h delete mode 100755 library/stdlib_program_name.c delete mode 100644 library/stdlib_protos.h delete mode 100644 library/stdlib_putenv.c delete mode 100644 library/stdlib_qsort.c delete mode 100644 library/stdlib_rand.c delete mode 100644 library/stdlib_rand_r.c delete mode 100644 library/stdlib_realloc.c delete mode 100644 library/stdlib_red_black.c delete mode 100644 library/stdlib_semaphore.c delete mode 100644 library/stdlib_set_errno.c delete mode 100644 library/stdlib_set_process_window.c delete mode 100644 library/stdlib_setenv.c delete mode 100644 library/stdlib_setjmp.asm delete mode 100644 library/stdlib_setjmp.c delete mode 100644 library/stdlib_setjmp.i delete mode 100644 library/stdlib_shell_escape.c delete mode 100644 library/stdlib_showerror.c delete mode 100644 library/stdlib_srand.c delete mode 100644 library/stdlib_stack_usage.c delete mode 100644 library/stdlib_stackargbytes.c delete mode 100644 library/stdlib_stackcheck.c delete mode 100644 library/stdlib_stackextension.c delete mode 100644 library/stdlib_stackminframe.c delete mode 100644 library/stdlib_stackoverflow.c delete mode 100644 library/stdlib_stacksafezone.c delete mode 100644 library/stdlib_stacksize.c delete mode 100644 library/stdlib_stdio_window_spec.c delete mode 100644 library/stdlib_strtod.c delete mode 100644 library/stdlib_strtof.c delete mode 100644 library/stdlib_strtol.c delete mode 100644 library/stdlib_strtoll.c delete mode 100644 library/stdlib_strtoul.c delete mode 100644 library/stdlib_strtoull.c delete mode 100644 library/stdlib_swapstack.asm delete mode 100644 library/stdlib_swapstack.c delete mode 100644 library/stdlib_sysbase.c delete mode 100644 library/stdlib_system.c delete mode 100644 library/stdlib_termination_message.c delete mode 100644 library/stdlib_threshold.c delete mode 100644 library/stdlib_udivmodsi3.c delete mode 100644 library/stdlib_udivsi3.c delete mode 100644 library/stdlib_udivsi4.c delete mode 100644 library/stdlib_umodsi3.c delete mode 100644 library/stdlib_unsetenv.c delete mode 100644 library/stdlib_utilitybase.c delete mode 100644 library/stdlib_utilitybase.h delete mode 100644 library/stdlib_wcstombs.c delete mode 100644 library/stdlib_wctomb.c delete mode 100644 library/string_bcmp.c delete mode 100644 library/string_bcopy.c delete mode 100644 library/string_bzero.c delete mode 100644 library/string_headers.h delete mode 100644 library/string_index.c delete mode 100644 library/string_memchr.c delete mode 100644 library/string_memcmp.c delete mode 100644 library/string_memcpy.c delete mode 100644 library/string_memmove.c delete mode 100644 library/string_memset.c delete mode 100644 library/string_rindex.c delete mode 100644 library/string_strcat.c delete mode 100644 library/string_strchr.c delete mode 100644 library/string_strcmp.c delete mode 100644 library/string_strcoll.c delete mode 100644 library/string_strcpy.c delete mode 100644 library/string_strcspn.c delete mode 100644 library/string_strdup.c delete mode 100644 library/string_strerror.c delete mode 100644 library/string_strlcat.c delete mode 100644 library/string_strlcpy.c delete mode 100644 library/string_strlen.c delete mode 100644 library/string_strncat.c delete mode 100644 library/string_strncmp.c delete mode 100644 library/string_strncpy.c delete mode 100644 library/string_strpbrk.c delete mode 100644 library/string_strrchr.c delete mode 100644 library/string_strspn.c delete mode 100644 library/string_strstr.c delete mode 100644 library/string_strtok.c delete mode 100644 library/string_strtok_r.c delete mode 100644 library/string_strxfrm.c delete mode 100644 library/strings_ffs.c delete mode 100644 library/strings_headers.h delete mode 100644 library/strings_strcasecmp.c delete mode 100644 library/strings_strncasecmp.c delete mode 100755 library/termios_cfgetispeed.c delete mode 100755 library/termios_cfgetospeed.c delete mode 100755 library/termios_cfmakeraw.c delete mode 100755 library/termios_cfsetispeed.c delete mode 100755 library/termios_cfsetospeed.c delete mode 100755 library/termios_console_fdhookentry.c delete mode 100755 library/termios_headers.h delete mode 100755 library/termios_openserial.c delete mode 100755 library/termios_tcdrain.c delete mode 100755 library/termios_tcflow.c delete mode 100755 library/termios_tcflush.c delete mode 100755 library/termios_tcgetattr.c delete mode 100755 library/termios_tcsendbreak.c delete mode 100755 library/termios_tcsetattr.c delete mode 100644 library/time_asctime.c delete mode 100644 library/time_asctime_r.c delete mode 100644 library/time_clock.c delete mode 100644 library/time_convert_datestamp.c delete mode 100644 library/time_convert_time.c delete mode 100644 library/time_converttime.c delete mode 100644 library/time_ctime.c delete mode 100644 library/time_ctime_r.c delete mode 100644 library/time_data.c delete mode 100644 library/time_days_per_date.c delete mode 100644 library/time_difftime.c delete mode 100644 library/time_gettimeofday.c delete mode 100644 library/time_gmtime.c delete mode 100644 library/time_gmtime_r.c delete mode 100644 library/time_headers.h delete mode 100644 library/time_localtime.c delete mode 100644 library/time_localtime_r.c delete mode 100644 library/time_mktime.c delete mode 100644 library/time_numbertostring.c delete mode 100644 library/time_strftime.c delete mode 100644 library/time_time.c delete mode 100644 library/time_weekday.c delete mode 100644 library/uio_headers.h delete mode 100644 library/uio_readv.c delete mode 100644 library/uio_writev.c delete mode 100644 library/unistd_access.c delete mode 100644 library/unistd_chdir.c delete mode 100644 library/unistd_chdir_exit.c delete mode 100644 library/unistd_chown.c delete mode 100644 library/unistd_currentpathname.c delete mode 100644 library/unistd_dup.c delete mode 100644 library/unistd_dup2.c delete mode 100644 library/unistd_fchown.c delete mode 100644 library/unistd_fdatasync.c delete mode 100644 library/unistd_fdopen.c delete mode 100644 library/unistd_fileno.c delete mode 100644 library/unistd_fsync.c delete mode 100644 library/unistd_ftruncate.c delete mode 100644 library/unistd_getcwd.c delete mode 100644 library/unistd_getopt.c delete mode 100644 library/unistd_getpid.c delete mode 100644 library/unistd_headers.h delete mode 100644 library/unistd_init_exit.c delete mode 100644 library/unistd_isatty.c delete mode 100644 library/unistd_lchown.c delete mode 100644 library/unistd_link.c delete mode 100644 library/unistd_readlink.c delete mode 100644 library/unistd_realpath.c delete mode 100644 library/unistd_restorepathname.c delete mode 100644 library/unistd_setcurrentpath.c delete mode 100644 library/unistd_sleep.c delete mode 100644 library/unistd_strip_double_slash.c delete mode 100644 library/unistd_symlink.c delete mode 100644 library/unistd_sync_fd.c delete mode 100644 library/unistd_time_delay.c delete mode 100644 library/unistd_timer.c delete mode 100644 library/unistd_translatea2u.c delete mode 100644 library/unistd_translaterel.c delete mode 100644 library/unistd_translateu2a.c delete mode 100644 library/unistd_truncate.c delete mode 100755 library/unistd_ttyname.c delete mode 100755 library/unistd_ttyname_r.c delete mode 100644 library/unistd_unix_path_semantics.c delete mode 100644 library/unistd_unlink.c delete mode 100644 library/unistd_usleep.c delete mode 100644 library/unistd_wildcard_expand.c delete mode 100644 library/unix.lib_rev.c delete mode 100644 library/unix.lib_rev.h delete mode 100644 library/unix.lib_rev.rev delete mode 100644 library/usergroup_crypt.c delete mode 100644 library/usergroup_data.c delete mode 100644 library/usergroup_endgrent.c delete mode 100644 library/usergroup_endpwent.c delete mode 100644 library/usergroup_getegid.c delete mode 100644 library/usergroup_geteuid.c delete mode 100644 library/usergroup_getgid.c delete mode 100644 library/usergroup_getgrent.c delete mode 100644 library/usergroup_getgrgid.c delete mode 100644 library/usergroup_getgrnam.c delete mode 100644 library/usergroup_getgroups.c delete mode 100644 library/usergroup_getpass.c delete mode 100644 library/usergroup_getpwent.c delete mode 100644 library/usergroup_getpwnam.c delete mode 100644 library/usergroup_getpwuid.c delete mode 100644 library/usergroup_getuid.c delete mode 100644 library/usergroup_headers.h delete mode 100644 library/usergroup_init_exit.c delete mode 100644 library/usergroup_initgroups.c delete mode 100644 library/usergroup_rootmode.c delete mode 100644 library/usergroup_setegid.c delete mode 100644 library/usergroup_seteuid.c delete mode 100644 library/usergroup_setgid.c delete mode 100644 library/usergroup_setgrent.c delete mode 100644 library/usergroup_setgroups.c delete mode 100644 library/usergroup_setpwent.c delete mode 100644 library/usergroup_setregid.c delete mode 100644 library/usergroup_setreuid.c delete mode 100644 library/usergroup_setsid.c delete mode 100644 library/usergroup_setuid.c delete mode 100644 library/utime_headers.h delete mode 100644 library/utime_utime.c delete mode 100644 library/utsname_uname.c delete mode 100644 library/wchar_btowc.c delete mode 100644 library/wchar_fgetwc.c delete mode 100644 library/wchar_fgetws.c delete mode 100644 library/wchar_fputwc.c delete mode 100644 library/wchar_fputws.c delete mode 100644 library/wchar_fwide.c delete mode 100644 library/wchar_fwprintf.c delete mode 100644 library/wchar_fwscanf.c delete mode 100644 library/wchar_getwc.c delete mode 100644 library/wchar_getwchar.c delete mode 100644 library/wchar_headers.h delete mode 100644 library/wchar_mbrlen.c delete mode 100644 library/wchar_mbsinit.c delete mode 100644 library/wchar_mbsrtowcs.c delete mode 100644 library/wchar_putwc.c delete mode 100644 library/wchar_putwchar.c delete mode 100644 library/wchar_swprintf.c delete mode 100644 library/wchar_swscanf.c delete mode 100644 library/wchar_ungetwc.c delete mode 100644 library/wchar_vfwprintf.c delete mode 100644 library/wchar_vswprintf.c delete mode 100644 library/wchar_vwprintf.c delete mode 100644 library/wchar_wcrtomb.c delete mode 100644 library/wchar_wcscat.c delete mode 100644 library/wchar_wcschr.c delete mode 100644 library/wchar_wcscmp.c delete mode 100644 library/wchar_wcscpy.c delete mode 100644 library/wchar_wcsftime.c delete mode 100644 library/wchar_wcslen.c delete mode 100644 library/wchar_wcsncat.c delete mode 100644 library/wchar_wcsncmp.c delete mode 100644 library/wchar_wcsncpy.c delete mode 100644 library/wchar_wcspbrk.c delete mode 100644 library/wchar_wcsrtombs.c delete mode 100644 library/wchar_wcsspn.c delete mode 100644 library/wchar_wcstod.c delete mode 100644 library/wchar_wcstok.c delete mode 100644 library/wchar_wcstol.c delete mode 100644 library/wchar_wcstoll.c delete mode 100644 library/wchar_wcstoul.c delete mode 100644 library/wchar_wcstoull.c delete mode 100644 library/wchar_wcsxfrm.c delete mode 100644 library/wchar_wmemchr.c delete mode 100644 library/wchar_wmemcmp.c delete mode 100644 library/wchar_wmemcpy.c delete mode 100644 library/wchar_wmemmove.c delete mode 100644 library/wchar_wmemset.c delete mode 100644 library/wchar_wprintf.c delete mode 100644 library/wchar_wscanf.c delete mode 100644 library/wchar_wscoll.c delete mode 100644 library/wctype_headers.h delete mode 100644 library/wctype_iswalnum.c delete mode 100644 library/wctype_iswalpha.c delete mode 100644 library/wctype_iswblank.c delete mode 100644 library/wctype_iswcntrl.c delete mode 100644 library/wctype_iswctype.c delete mode 100644 library/wctype_iswdigit.c delete mode 100644 library/wctype_iswgraph.c delete mode 100644 library/wctype_iswlower.c delete mode 100644 library/wctype_iswprint.c delete mode 100644 library/wctype_iswpunc.c delete mode 100644 library/wctype_iswspace.c delete mode 100644 library/wctype_iswupper.c delete mode 100644 library/wctype_iswxdigit.c delete mode 100644 library/wctype_towctrans.c delete mode 100644 library/wctype_towlower.c delete mode 100644 library/wctype_towupper.c delete mode 100644 library/wctype_wctrans.c delete mode 100644 library/wctype_wctype.c delete mode 100644 test_programs/GNUmakefile.68k delete mode 100644 test_programs/GNUmakefile.os4 delete mode 100644 test_programs/README delete mode 100644 test_programs/clib-bug.c delete mode 100644 test_programs/fgets_test.c delete mode 100644 test_programs/fstat_stdout_test.c delete mode 100644 test_programs/iotest.c delete mode 100644 test_programs/printf_g_test.c delete mode 100644 test_programs/printf_test.c delete mode 100644 test_programs/simple.c delete mode 100644 test_programs/simple_sprintf.c delete mode 100644 test_programs/smakefile delete mode 100644 test_programs/sprintf_test.c delete mode 100644 test_programs/sscanf_test.c delete mode 100644 test_programs/stack_extension_test.c delete mode 100644 test_programs/stack_size_test.c delete mode 100644 test_programs/strtok_test.c delete mode 100644 test_programs/test.c delete mode 100644 test_programs/translate_test.c delete mode 100644 test_programs/uname.c diff --git a/CVSROOT/checkoutlist b/CVSROOT/checkoutlist deleted file mode 100644 index 2921bff..0000000 --- a/CVSROOT/checkoutlist +++ /dev/null @@ -1,13 +0,0 @@ -# The "checkoutlist" file is used to support additional version controlled -# administrative files in $CVSROOT/CVSROOT, such as template files. -# -# The first entry on a line is a filename which will be checked out from -# the corresponding RCS file in the $CVSROOT/CVSROOT directory. -# The remainder of the line is an error message to use if the file cannot -# be checked out. -# -# File format: -# -# [][] -# -# comment lines begin with '#' diff --git a/CVSROOT/commitinfo b/CVSROOT/commitinfo deleted file mode 100644 index b19e7b7..0000000 --- a/CVSROOT/commitinfo +++ /dev/null @@ -1,15 +0,0 @@ -# The "commitinfo" file is used to control pre-commit checks. -# The filter on the right is invoked with the repository and a list -# of files to check. A non-zero exit of the filter program will -# cause the commit to be aborted. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being committed to, relative -# to the $CVSROOT. For the first match that is found, then the remainder -# of the line is the name of the filter to run. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". diff --git a/CVSROOT/config b/CVSROOT/config deleted file mode 100644 index 92c150b..0000000 --- a/CVSROOT/config +++ /dev/null @@ -1,21 +0,0 @@ -# Set this to "no" if pserver shouldn't check system users/passwords -#SystemAuth=no - -# Put CVS lock files in this directory rather than directly in the repository. -#LockDir=/var/lock/cvs - -# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top -# level of the new working directory when using the `cvs checkout' -# command. -#TopLevelAdmin=no - -# Set `LogHistory' to `all' or `TOEFWUPCGMAR' to log all transactions to the -# history file, or a subset as needed (ie `TMAR' logs all write operations) -#LogHistory=TOEFWUPCGMAR - -# Set `RereadLogAfterVerify' to `always' (the default) to allow the verifymsg -# script to change the log message. Set it to `stat' to force CVS to verify# that the file has changed before reading it (this can take up to an extra -# second per directory being committed, so it is not recommended for large -# repositories. Set it to `never' (the previous CVS behavior) to prevent -# verifymsg scripts from changing the log message. -#RereadLogAfterVerify=always diff --git a/CVSROOT/cvswrappers b/CVSROOT/cvswrappers deleted file mode 100644 index e989b75..0000000 --- a/CVSROOT/cvswrappers +++ /dev/null @@ -1,19 +0,0 @@ -# This file affects handling of files based on their names. -# -# The -m option specifies whether CVS attempts to merge files. -# -# The -k option specifies keyword expansion (e.g. -kb for binary). -# -# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers) -# -# wildcard [option value][option value]... -# -# where option is one of -# -f from cvs filter value: path to filter -# -t to cvs filter value: path to filter -# -m update methodology value: MERGE or COPY -# -k expansion mode value: b, o, kkv, &c -# -# and value is a single-quote delimited value. -# For example: -#*.gif -k 'b' diff --git a/CVSROOT/editinfo b/CVSROOT/editinfo deleted file mode 100644 index d78886c..0000000 --- a/CVSROOT/editinfo +++ /dev/null @@ -1,21 +0,0 @@ -# The "editinfo" file is used to allow verification of logging -# information. It works best when a template (as specified in the -# rcsinfo file) is provided for the logging procedure. Given a -# template with locations for, a bug-id number, a list of people who -# reviewed the code before it can be checked in, and an external -# process to catalog the differences that were code reviewed, the -# following test can be applied to the code: -# -# Making sure that the entered bug-id number is correct. -# Validating that the code that was reviewed is indeed the code being -# checked in (using the bug-id number or a seperate review -# number to identify this particular code set.). -# -# If any of the above test failed, then the commit would be aborted. -# -# Actions such as mailing a copy of the report to each reviewer are -# better handled by an entry in the loginfo file. -# -# One thing that should be noted is the the ALL keyword is not -# supported. There can be only one entry that matches a given -# repository. diff --git a/CVSROOT/loginfo b/CVSROOT/loginfo deleted file mode 100644 index 537607d..0000000 --- a/CVSROOT/loginfo +++ /dev/null @@ -1,27 +0,0 @@ -# The "loginfo" file controls where "cvs commit" log information -# is sent. The first entry on a line is a regular expression which must match -# the directory that the change is being made to, relative to the -# $CVSROOT. If a match is found, then the remainder of the line is a filter -# program that should expect log information on its standard input. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name ALL appears as a regular expression it is always used -# in addition to the first matching regex or DEFAULT. -# -# You may specify a format string as part of the -# filter. The string is composed of a `%' followed -# by a single format character, or followed by a set of format -# characters surrounded by `{' and `}' as separators. The format -# characters are: -# -# s = file name -# V = old version number (pre-checkin) -# v = new version number (post-checkin) -# t = tag or branch name -# -# For example: -#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog -# or -#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog diff --git a/CVSROOT/modules b/CVSROOT/modules deleted file mode 100644 index cb9e9ef..0000000 --- a/CVSROOT/modules +++ /dev/null @@ -1,26 +0,0 @@ -# Three different line formats are valid: -# key -a aliases... -# key [options] directory -# key [options] directory files... -# -# Where "options" are composed of: -# -i prog Run "prog" on "cvs commit" from top-level of module. -# -o prog Run "prog" on "cvs checkout" of module. -# -e prog Run "prog" on "cvs export" of module. -# -t prog Run "prog" on "cvs rtag" of module. -# -u prog Run "prog" on "cvs update" of module. -# -d dir Place module in directory "dir" instead of module name. -# -l Top-level directory only -- do not recurse. -# -# NOTE: If you change any of the "Run" options above, you'll have to -# release and re-checkout any working directories of these modules. -# -# And "directory" is a path to a directory relative to $CVSROOT. -# -# The "-a" option specifies an alias. An alias is interpreted as if -# everything on the right of the "-a" had been typed on the command line. -# -# You can encode a module within a module by using the special '&' -# character to interpose another module into the current module. This -# can be useful for creating a module that consists of many directories -# spread out over the entire source repository. diff --git a/CVSROOT/notify b/CVSROOT/notify deleted file mode 100644 index 74ae6f9..0000000 --- a/CVSROOT/notify +++ /dev/null @@ -1,12 +0,0 @@ -# The "notify" file controls where notifications from watches set by -# "cvs watch add" or "cvs edit" are sent. The first entry on a line is -# a regular expression which is tested against the directory that the -# change is being made to, relative to the $CVSROOT. If it matches, -# then the remainder of the line is a filter program that should contain -# one occurrence of %s for the user to notify, and information on its -# standard input. -# -# "ALL" or "DEFAULT" can be used in place of the regular expression. -# -# For example: -#ALL mail -s "CVS notification" %s diff --git a/CVSROOT/rcsinfo b/CVSROOT/rcsinfo deleted file mode 100644 index 49e59f4..0000000 --- a/CVSROOT/rcsinfo +++ /dev/null @@ -1,13 +0,0 @@ -# The "rcsinfo" file is used to control templates with which the editor -# is invoked on commit and import. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being made to, relative to the -# $CVSROOT. For the first match that is found, then the remainder of the -# line is the name of the file that contains the template. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". diff --git a/CVSROOT/taginfo b/CVSROOT/taginfo deleted file mode 100644 index 274a46d..0000000 --- a/CVSROOT/taginfo +++ /dev/null @@ -1,20 +0,0 @@ -# The "taginfo" file is used to control pre-tag checks. -# The filter on the right is invoked with the following arguments: -# -# $1 -- tagname -# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d -# $3 -- repository -# $4-> file revision [file revision ...] -# -# A non-zero exit of the filter program will cause the tag to be aborted. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being committed to, relative -# to the $CVSROOT. For the first match that is found, then the remainder -# of the line is the name of the filter to run. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". diff --git a/CVSROOT/verifymsg b/CVSROOT/verifymsg deleted file mode 100644 index 86f747c..0000000 --- a/CVSROOT/verifymsg +++ /dev/null @@ -1,21 +0,0 @@ -# The "verifymsg" file is used to allow verification of logging -# information. It works best when a template (as specified in the -# rcsinfo file) is provided for the logging procedure. Given a -# template with locations for, a bug-id number, a list of people who -# reviewed the code before it can be checked in, and an external -# process to catalog the differences that were code reviewed, the -# following test can be applied to the code: -# -# Making sure that the entered bug-id number is correct. -# Validating that the code that was reviewed is indeed the code being -# checked in (using the bug-id number or a seperate review -# number to identify this particular code set.). -# -# If any of the above test failed, then the commit would be aborted. -# -# Actions such as mailing a copy of the report to each reviewer are -# better handled by an entry in the loginfo file. -# -# One thing that should be noted is the the ALL keyword is not -# supported. There can be only one entry that matches a given -# repository. diff --git a/documentation/BUILDING.html b/documentation/BUILDING.html deleted file mode 100644 index 7138427..0000000 --- a/documentation/BUILDING.html +++ /dev/null @@ -1,30 +0,0 @@ - - - -Notes on building the library - - -

Notes on building the library

- -

In order to build the library, you need a 'C' compiler (obvious, isn't it?) and -a set of header files for the networking API definitions. The networking header -files go into a directory netinclude which has to sit in the same directory as -the source code and the include directory you find in there. I'm not currently -supplying these header files here. Drop me a line, and I'll take care of that.

- -

The SAS/C flavour (smakefile) should get the library built using the "large data" -model. This rules out the use of residentable programs as the startup code I'm -using is very primitive (startup.o) and doesn't tinker with A4 relative data -addressing (and how this may be set up).

- -

There are two makefiles for GCC, each a different flavour. There is GNUmakefile.68k, -which will build the library for GCC on the 68k platform ("classic" Amiga). This -builds all variants of the library, for large data, small data, resident, whatever -model. It's a lot of work and I don't recommend you do this on a plain 68k machine. -It will literally (!) take hours. The other makefile flavour is for AmigaOS4 using -the PowerPC hosted GCC system (GNUmakefile.os4). This builds only the large data -version of the library, but this is usually all you need. Small data support is -currently not implemented but might follow in the future.

- - - diff --git a/documentation/GCC-68K.html b/documentation/GCC-68K.html deleted file mode 100644 index 43d0200..0000000 --- a/documentation/GCC-68K.html +++ /dev/null @@ -1,67 +0,0 @@ - - - -Notes on using the library with Amiga GCC (68k) - - -

Notes on using the library with Amiga GCC (68k)

- -

You can use the 68k build of clib2 with the existing Amiga 68k ports of the -GNU 'C' compiler. In order to do so, you need to modify the specs file which -controls how the compiler(s) and the linker interact, and where the linker -will look for the program startup code and library files. Also, you will need -to copy the header files, startup code and library files to the locations -where the 'C' compiler and linker expects them.

- -

Please read the following description before you follow the instructions. The -changes suggested may have unexpected side-effects!

- -

I have provided a working specs file with this documentation file. To switch -over an existing Amiga 68k port of GCC to use clib2, you would proceed as -follows:

- -
    -
  • Locate the directory within which GCC is installed. For example, this -could be within a directory to which the name ADE:, GG: or GCC: -is assigned. For the sake of simplicity, the following notes assume -that the assignment name is GCC: - -
  • Make backup copies of the following directories and files: -
      -
    1. GCC:lib/gcc-lib/amigaos/2.95.3/specs
      - -

      (NOTE: Check the directory called GCC:lib/gcc-lib/amigaos -first; the "2.95.3" quoted above refers to the version, -revision and patch number of the GCC installed and your -version number may differ!)

      - -
    2. GCC:include -
    3. GCC:lib - -
    - -
  • Now you can proceed to install clib2; just copy the include and lib -directories over, like this: -
      -
    1. Copy include GCC:include all quiet -
    2. Copy lib GCC:lib all quiet -
    - -
  • Finally, replace the specs file with the one provided: -
      - -
    1. Copy specs GCC:lib/gcc-lib/amigaos/2.95.3/specs
      - -

      (NOTE: Check the directory called GCC:lib/gcc-lib/amigaos -first; the "2.95.3" quoted above refers to the version, -revision and patch number of the GCC installed and your -version number may differ!)

      -
    -
- -

Once you have completed these steps you should be able to build programs using -the 68k build of clib2 and you currently installed GCC. Note that these -changes may have the effect of rendering your C++ compiler unusable, so make -sure that you've made backup copies of all files and directories first!

- - diff --git a/documentation/README.html b/documentation/README.html deleted file mode 100644 index 16ae3ed..0000000 --- a/documentation/README.html +++ /dev/null @@ -1,304 +0,0 @@ - - - -An ISO 'C' (1994) compliant runtime library for the Amiga - - -

An ISO 'C' (1994) compliant runtime library for the Amiga

- -

1. What is this?

- -

This is my attempt to get Samba 2.2.x ported to the Amiga. My first Amiga -port required SAS/C and a number of strange tricks had to be pulled to get -it to support the kind of environment Samba needed. But with the -introduction of Samba 2.2.x many of those tricks did not work any more, -which is why I decided to attack the problem at the root, namely the -runtime library.

- -

Because it was no longer possible to build Samba with SAS/C on the new -Amiga platform, the idea came up to move development to the GNU 'C' -compiler. This turned out to be a challenge due to its somewhat -underdeveloped runtime library and header files. Eventually, I decided to -rewrite that library from scratch.

- - -

2. What does it do?

- -

Using 'C' - A reference manual (4th edition) as a reference I wrote a set of -header files, then proceeded to implement each single function referenced in -them. With few exceptions in the area of wide character support, the result -should be a feature complete implementation of the ISO 'C' (1994) runtime -library.

- -

Because Samba needs a few POSIX-like routines to be supported, the library -functionality is complemented by a set of routines described in Advanced -programming in the Unix environent.

- -

This is not a portable implementation of the library in the sense that you -could move it from one 'C' compiler on one operating system to another. -This is an Amiga specific implementation.

- -

The library supports floating point math, which, for the 68k platform, is -limited to IEEE single and double precision or M68881 inline math. There is no -support for the fast floating point (FFP) format or exclusive IEEE single -precision. You either get double precision (IEEE math) or extended precision -(M68881 inline math). What it is that you get is determined at compile time. -Use the IEEE_FLOATING_POINT_SUPPORT preprocessor symbol to activate IEEE math -code and the M68881_FLOATING_POINT_SUPPORT symbol for M68881 inline math.

- -

For the PowerPC platform, the library uses code borrowed from fdlibm 5.3, -which is a portable library of arithmetic functions developed by Sun -Microsystems which, for example, is also used within the Java platform.

- -

Not unlike SAS/C, you can configure a minimum stack size the program is to use -when it starts up. This is controlled via the __stack_size variable (see -stdlib_main.c).

- -

I added some amiga.lib and debug.lib functionality to the library, but don't -count on it to be complete.

- -

2.1 Thread-safety

- -

The library code is supposed to be thread-safe if built with the __THREAD_SAFE -preprocesssor symbold defined. Note that 'thread-safe' does not mean -'reentrant'. Multiple callers for certain library functions are permitted, but -not for all of them. For example, mkdtemp() is not thread-safe, and neither is -rand() or localtime(). But as per POSIX 1003.1c-1995 there are thread-safe -variants of rand() and localtime() called rand_r(), localtime_r(), and others. -The use of the socket I/O functions is still problematic because the -underlying bsdsocket.library API is not supposed to be used by any process -other than the one that opened it. Also yet unsolved is the issue of reading -error codes from the errno variable which currently always contains the -error code left by the last caller.

- - -

3. What does it not do?

- -

This library is a departure from the typical 'C' runtime environments of the -past which had to run on all AmigaOS releases, down to Kickstart 1.1. This -very library was designed to take advantage of the routines available since -Kickstart 2.04 was introduced and virtually nobody ever put to use. This helps -to cut the code size, and it also helps to keep bugs out of the library by -falling back onto well-tested implementations. However, the catch is that the -code won't run under Kickstart 1.3 and below. But then these operating system -releases have been obsolete for more than a decade, and you can always go back -to a compiler environment which supports them.

- -

There is very little support for amiga.lib functionality. There is NewList(), -HookEntry(), CallHook(), CallHookA(), the DoMethod() family, the RexxVars -family, but that's all. If you need more, you would have to implement it -yourself. Put another way, if you absolutely need functionality that is only -found in amiga.lib, you really shouldn't need in in the first place.

- - -

4. Where does the source code come from?

- -

I originally thought that it might be helpful to piece this library together -from various sources, such as the BSD libc. Turned out that this code was so -'portable' that it became much more complex than it ought to be. Also, some -side-effects were present which considerably changed the behaviour of the -library. For example, the BSD libc uses bcopy() as an alias for memcpy(), and -unlike memcpy() is documented to, bcopy() supports overlapping copies.

- -

Eventually, I wrote virtually all the code myself, borrowing algorithmic ideas -from the BSD libc and the Manx Aztec 'C' runtime library. Because I don't know -much about the environment GCC expects, I borrowed code snippets from libnix, -which was written by Matthias Fleischer and Gunther Nikl. This in particular -concerns the integer and floating point math support, the setjmp/longjmp -routines and the startup code. The M68881 inline math code comes from the -<math-68881.h> file written by Matthew Self (self@bayes.arc.nasa.gov).

- - -

5. Limitations and caveats

- -

There is hardly any documentation on the code I wrote. In part this is due to -the fact that the code itself is very simple in design. It should speak for -itself. However, to make a usable runtime library you have to have a user -documentation as in man pages or autodocs. We will eventually have to have -autodocs for this library.

- -

The code is currently plastered with assertions and debug code. It is -therefore much larger than it ought to be and runs much slower than it ought -to be. For example, the malloc() routine will set the contents of the memory -allocated to a 'dirty' bit pattern which is likely to break software which -makes assumptions about its contents. Likewise, the free() routine will trash -the memory to deallocate with a different 'dirty' bit pattern to turn up reuse -of memory after deallocation. All these debugging features can be disabled by -defining the NDEBUG preprocessor symbol at compile time (see <assert.h>).

- -

The exception handling in the math code is not particularly effective. For one -part this is due to the fact that there is no exception handler installed by -the runtime library when it starts up which could catch and process the error -conditions the CPU or FPU generates. The idea was to provide for a portable -runtime library with little to no assembly language involved. To make the -exception handling complete, such code would be necessary.

- -

The library currently builds under SAS/C, but because the 'normal' program -startup code is not utilized, the base relative (A4) addressing does not work. -If you are going to test it, use the data=faronly option to compile the -library and the programs.

- -

Different build makefiles are supplied for use with GCC. There is -GNUmakefile.68k for the 68k platform and GNUmakefile.os4 for the AmigaOS4 -PowerPC version.

- -

5.1 Floating point math and functions (scanf(), printf(), etc.)

- -

The plain libc.a, which your software would be linked against by default, does not contain -any floating point support code. This means, for example, that printf("%f",...) will not produce -the desired output and that scanf("%f",...) may not read any data at all. If your -program needs functions such as these or atod() then you must link against libm.a or -the equivalent.

- -

To link the floating point support code with your software, use the -lm compiler option. Careful! -The order in which you specify the libraries to link against is important here. Thus, gcc -o test test.c -lm -lc -would correctly link the program test against the proper floating point math library, but -gcc -o test test.c -lc -lm would not.

- -

5.2 The thread-safe library

- -

Thread-safety does not imply that you can have multiple callers -access and close the same file. There is no resource tracking to that degree -yet. All that the thread-safety tries to afford you is not to get into big trouble -if simultaneous and overlapping accesses to files, memory allocation and other -resources are taking place.

- -

Also take care with file I/O involving the stdin/stdout/stderr -streams; read/write operations on these streams will be mapped to the Input()/Output()/ErrorOutput() -file handles of the process performing these operations. Since only this small set of -operations is mapped, functions such as fcntl() or select() will not -work on the stdin/stdout/stderr streams and the corresponding -file descriptors STDIN_FILENO/STDOUT_FILENO/STDERR_FILENO. -It is therefore strongly recommended to use the thread-safe library only for applications -which can cope with the limitations described above.

- -

5.3 Using gmon (PowerPC only)

- -

To use profiling, two steps are required. First of all, your program must be compiled with -the gcc command line option -pg. This instructs the compiler to generate special -profiling code in the prologue and epilogue of each function. Additionally, the program -must be linked with libprofile.a. To do this, either manually add --lprofile to the linker command line, or modify the specs file as follows. -Find the lines that look like this (it may actually differ silghtily from your specs file, -but the important thing is that the line before the line to be modified reads lib:): -

-lib:
---start-group -lc --end-group
-
-You will have to modify this to look like this: -
-lib:
-%{pg: -lprofile} --start-group -lc --end-group
-
-Normally, the specs file is located at the compilers installation directory. For cross-compilers, -this is /usr/local/amiga/lib/gcc/ppc-amigaos/compiler-version/specs. For a native compiler, -it's in gcc:lib/gcc/ppc-amigaos/compiler-version/specs. Most likely, your compiler will already have this added to it's specs file.

- -

Profiling makes use of a special PowerPC facility called the Performance Monitor. It -allows to "mark" tasks and count only during while a marked task is running. This allows -performance analysis to be made independant of the actual system load. The Performace Monitor -is available on all PowerPC models supported by AmigaOS 4 except for the 603e, and -embedded versions of the PowerPC like the 405 and 440 series. Consult the manual -of the appropriate chip for more information.

- -

6. Conventions and design issues

- -

You will have noticed the 330+ files in this directory. This is not the best -way to organize a runtime library, but at least all the bits and pieces are in -plain sight. Each file stands for the one or two routines it contains. The -name indicates what routine(s) that might be. Each file name is prefixed by -the name of the header file in which the corresponding routine is defined. So, -for example, you will find that unistd_lchown.c contains the definition of -the lchown() routine, which has its prototype defined in the <unistd.h> header -file.

- -

Internal function and variables which need to be visible across several -modules have names prefixed with two underscores, as in __stdio_init().

- -

All routines attempt to do error checking on their parameters. They will -either drop into an assert() or set an errno value and refuse to go any -further. This cuts performance but should help to catch the simple bugs quite -easily (NULL pointers).

- -

Just like any halfway sane Amiga 'C' runtime library, this one performs its ^C -checking in the I/O routines. Typically once upon entry and in every iteration -of the loop there might be it will quickly poll the ^C signal and drop into -raise(SIGINT) in case the signal is set. This is just about the safest method -to solve the problem and should be much more robust than the ixemul approach -of 'interrupt anywhere - crash anywhere' using the task switch/launch hooks to -test for signals.

- -

By default all library routines follow the ISO 'C' conventions in that where -implementation defined behaviour is permitted, the AmigaOS rules are followed. -For example, unlink() will by default operate like DeleteFile() and rename() -will return with an error code set if the name of the file/directory to be -renamed would collide with an existing directory entry. However, your program -can set a global variable __unix_semantics which will cause some routines to -perform like their Unix counterparts. This is necessary for Samba to work but -not a generally desirable feature. You have some Unix-like behaviour, but the -environment itself is not completely Unix- or POSIX-compliant. And it -shouldn't be. Don't make the mistake of trying to mold the environment into a -POSIX emulation. It doesn't work; AmigaOS is not Unix.

- - -

7. The startup code

- -

There are three program startup files provided. The most simplistic is in -startup.c which I use for SAS/C. It just invokes the setup routine which -eventually calls main() and drops straight into exit().

- -

The ncrt0.S file was adapted from the libnix startup code which sets up the -base relative data area, if necessary (the SMALL_DATA preprocessor symbol must -be defined).

- -

The nrcrt0.S file was adapted from libnix startup code, too, and sets up the -base relative data area for programs to be made resident. Note that the -geta4() stub is missing here; it wouldn't work in a resident program anyway.

- -

The ncrt0.S and nrcrt0.S files are considerably smaller and less complex than -the libnix code they are based on. This is because in this library design all -the more complex tasks are performed in the stdlib_main.c file rather than in -assembly language.

- - -

8. Documentation

- -

Well, you're reading it. There isn't anything much yet. You can consult the book -'C' - A reference manual and you could look at the -Open Group's Single Unix -Specification.

- - -

9. Legal status

- -

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

- -

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

- -
-====================================================
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-
-Developed at SunPro, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-====================================================
-
- -

10. Contacting the author

- -

The basic work was done by Olaf Barthel during two weeks in July 2002. You -can reach me at:

- -

Olaf Barthel
- Gneisenaustr. 43
- D-31275 Lehrte

- -

Or via e-mail:

- -

olsen@sourcery.han.de

- - diff --git a/documentation/specs b/documentation/specs deleted file mode 100644 index 6bafdb4..0000000 --- a/documentation/specs +++ /dev/null @@ -1,64 +0,0 @@ -*asm: - %{m68000:-mc68010} %{mc68000:-mc68010} %{m68020:-mc68020} %{mc68020:-mc68020} %{m68030:-mc68030} %{m68040:-mc68040} %{m68060:-mc68060} %{m68020-40:-mc68020} %{m68020-60:-mc68020} %{!mc68000:%{!m68000:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68060:%{!m68020-40:%{!m68020-60:-mc68010}}}}}}}}} %{msmall-code:-sc} - -*asm_final: - - -*cpp: -%{m68881:-D__HAVE_68881__} %{!ansi:%{m68020:-Dmc68020} %{mc68020:-Dmc68020} %{m68020-40:-Dmc68020} %{m68020-60:-Dmc68020} %{m68030:-Dmc68030} %{m68040:-Dmc68040} %{m68060:-Dmc68060}} %{m68020:-D__mc68020__ -D__mc68020} %{mc68020:-D__mc68020__ -D__mc68020} %{m68020-40:-D__mc68020__ -D__mc68020} %{m68020-60:-D__mc68020__ -D__mc68020} %{m68030:-D__mc68030__ -D__mc68030} %{m68040:-D__mc68040__ -D__mc68040} %{m68060:-D__mc68060__ -D__mc68060} - -*cc1: -%{resident:-fbaserel} %{resident32:-fbaserel32} %{msmall-code:-fno-function-cse} - -*cc1plus: - - -*endfile: - - -*link: -%{fbaserel:%{!resident:-m amiga_bss -fl libb}} %{resident:-m amiga_bss -amiga-datadata-reloc -fl libb} %{fbaserel32:%{!resident32:-m amiga_bss -fl libb32}} %{resident32:-m amiga_bss -amiga-datadata-reloc -fl libb32} %{g:-amiga-debug-hunk} %{m68020:-fl libm020} %{mc68020:-fl libm020} %{m68030:-fl libm020} %{m68040:-fl libm020} %{m68060:-fl libm020} %{m68020-40:-fl libm020} %{m68020-60:-fl libm020} - -*lib: -%{mstackextend:-lstack} -lc -lamiga -ldebug -lgcc -lc - -*libgcc: - - -*startfile: -%{resident32:nr32crt0.o%s}%{!resident32:%{fbaserel32:nb32crt0.o%s}%{!fbaserel32:%{resident:nrcrt0.o%s}%{!resident:%{fbaserel:nbcrt0.o%s}%{!fbaserel:ncrt0.o%s}}}} - -*switches_need_spaces: - - -*signed_char: -%{funsigned-char:-D__CHAR_UNSIGNED__} - -*predefines: --Dmc68000 -Damiga -Damigaos -DMCH_AMIGA -DAMIGA -D__chip=__attribute__((__chip__)) -D__saveds=__attribute__((__saveds__)) -D__interrupt=__attribute__((__interrupt__)) -D__stackext=__attribute__((__stackext__)) -D__regargs=__attribute__((__regparm__)) -D__stdargs=__attribute__((__stkparm__)) -D__aligned=__attribute__((__aligned__(4))) -Asystem(amigaos) -Acpu(m68k) -Amachine(m68k) - -*cross_compile: -0 - -*version: -2.95.3 - -*multilib: -. ; - -*multilib_defaults: - - -*multilib_extra: - - -*multilib_matches: - - -*linker: -collect2 - -*link_command: -%{!fsyntax-only: %{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:} %{L*} %D %o %{!nostdlib:%{!nodefaultlibs:%G %L %G}} %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} - }}}}}} - diff --git a/library/GNUmakefile.68k b/library/GNUmakefile.68k deleted file mode 100644 index 62642fd..0000000 --- a/library/GNUmakefile.68k +++ /dev/null @@ -1,1245 +0,0 @@ -# -# $Id: GNUmakefile.68k,v 1.65 2005-07-03 10:36:46 obarthel Exp $ -# -# :ts=8 -# - -############################################################################## - -CC = gcc -AR = ar -q -RANLIB = ranlib -COPY = copy clone buf=0 -DELETE = delete all quiet -MAKEDIR = makedir -MAKE = $(MAKE_COMMAND) -f GNUmakefile.68k - -############################################################################## - -ifeq (,$(TYPE)) -LIBC_OBJS = libc_objs -LIBUNIX_OBJS = libunix_objs -LIBM_OBJS = libm_objs -LIBM881_OBJS = libm881_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 -LIBM881_OBJS = $(TYPE)/libm881_objs -LIBSTACK_OBJS = $(TYPE)/libstack_objs -LIBNET_OBJS = $(TYPE)/libnet_objs -LIBDEBUG_OBJS = $(TYPE)/libdebug_objs -LIBAMIGA_OBJS = $(TYPE)/libamiga_objs -endif - -############################################################################## - -.c.o: - @echo "Compiling $<" - @$(CC) -c $(CFLAGS) $< - -$(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) -DIEEE_FLOATING_POINT_SUPPORT $< - -$(LIBM881_OBJS)/%.o : %.c - @echo "Compiling $< [$(TYPE):m881]" - @$(CC) -o $(LIBM881_OBJS)/$*.o -c $(CFLAGS) -DM68881_FLOATING_POINT_SUPPORT -m68881 $< - -$(LIBSTACK_OBJS)/%.o : %.c - @echo "Compiling $< [$(TYPE):stack]" - @$(CC) -o $(LIBSTACK_OBJS)/$*.o -c $(CFLAGS) -DSTACK_EXTENSION $< - -$(LIBNET_OBJS)/%.o : %.c - @echo "Compiling $< [$(TYPE):net]" - @$(CC) -o $(LIBNET_OBJS)/$*.o -c $(CFLAGS) -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_020,$(TYPE)) -CODE_TYPE := -m68020-60 -CODE_FLAGS := -fbaserel -DSMALL_DATA -DM68020 -endif - -ifeq (small_data,$(TYPE)) -CODE_TYPE := -m68000 -CODE_FLAGS := -fbaserel -DSMALL_DATA -endif - -ifeq (small_data32,$(TYPE)) -CODE_TYPE := -m68020-60 -CODE_FLAGS := -fbaserel32 -DSMALL_DATA32 -DM68020 -endif - -ifeq (large_data_020,$(TYPE)) -CODE_TYPE := -m68020-60 -CODE_FLAGS := -DM68020 -endif - -ifeq (large_data,$(TYPE)) -CODE_TYPE := -m68000 -CODE_FLAGS := -endif - -############################################################################## - -WARNINGS = \ - -Wall -W -Wpointer-arith -Wsign-compare -Wmissing-prototypes \ - -Wundef -Wbad-function-cast -Wmissing-declarations -Wunused - -# -Wconversion -Wshadow - -INCLUDES = -Iinclude -I. -Inetinclude -#OPTIONS = -fno-builtin -fno-common -DDEBUG - OPTIONS = -fno-builtin -fno-common -DNDEBUG -#OPTIONS = -fno-builtin -fno-common -D__MEM_DEBUG -#OPTIONS = -fno-builtin -fno-common -DDEBUG -D__MEM_DEBUG -DNO_INLINE_STDARG - OPTIMIZE = -O -fomit-frame-pointer -fstrength-reduce -finline-functions -#OPTIMIZE = -O2 -fomit-frame-pointer -#DEBUG = -g - -CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_FLAGS) $(CODE_TYPE) $(INCLUDES) - -############################################################################## - -C_LIB = \ - c.lib_rev.o \ - ctype_isalnum.o \ - ctype_isalpha.o \ - ctype_isascii.o \ - ctype_isblank.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_table.o \ - ctype_tolower.o \ - ctype_toupper.o \ - dirent_closedir.o \ - dirent_opendir.o \ - dirent_readdir.o \ - dirent_rewinddir.o \ - errno_data.o \ - fcntl_close.o \ - fcntl_creat.o \ - fcntl_fcntl.o \ - fcntl_get_default_file.o \ - fcntl_lock.o \ - fcntl_lseek.o \ - fcntl_open.o \ - fcntl_read.o \ - fcntl_write.o \ - ftw_ftw.o \ - ftw_nftw.o \ - inttypes_imaxdiv.o \ - inttypes_imaxabs.o \ - inttypes_strtoimax.o \ - inttypes_strtoumax.o \ - libgen_basename.o \ - libgen_dirname.o \ - locale_init_exit.o \ - locale_localeconv.o \ - locale_open_locale.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_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_dropiobreadbuffer.o \ - stdio_duplicate_fd.o \ - stdio_examine_fh.o \ - stdio_fclose.o \ - stdio_fdhookentry.o \ - stdio_feof.o \ - stdio_ferror.o \ - stdio_fflush.o \ - stdio_fgetc.o \ - stdio_fgetpos.o \ - stdio_fgets.o \ - stdio_filliobreadbuffer.o \ - stdio_findvacantfdentry.o \ - stdio_findvacantiobentry.o \ - stdio_flockfile.o \ - stdio_flush.o \ - stdio_flush_all_files.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_fseeko.o \ - stdio_fsetpos.o \ - stdio_ftell.o \ - stdio_ftello.o \ - stdio_ftrylockfile.o \ - stdio_funlockfile.o \ - stdio_fwrite.o \ - stdio_getc.o \ - stdio_getc_unlocked.o \ - stdio_getchar.o \ - stdio_getchar_unlocked.o \ - stdio_gets.o \ - stdio_get_file_descriptor.o \ - stdio_growfdtable.o \ - stdio_growiobtable.o \ - stdio_grow_file.o \ - stdio_initializefd.o \ - stdio_initializeiob.o \ - stdio_init_exit.o \ - stdio_file_init.o \ - stdio_iobhookentry.o \ - stdio_lock.o \ - stdio_locksemaphorename.o \ - stdio_nostdio.o \ - stdio_openiob.o \ - stdio_parent_of_fh.o \ - stdio_perror.o \ - stdio_popen.o \ - stdio_printf.o \ - stdio_putc.o \ - stdio_putc_unlocked.o \ - stdio_putchar.o \ - stdio_putchar_unlocked.o \ - stdio_puts.o \ - stdio_remove.o \ - stdio_remove_fd_alias.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_unlockfile.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 \ - stdio_vsscanf.o \ - stdio_vscanf.o \ - stdlib_abort.o \ - stdlib_abs.o \ - stdlib_alloca.o \ - stdlib_assertion_failure.o \ - stdlib_atexit.o \ - stdlib_atoi.o \ - stdlib_atol.o \ - stdlib_atoll.o \ - stdlib_bsearch.o \ - stdlib_calloc.o \ - stdlib_checkdetach.o \ - stdlib_constructor.o \ - stdlib_constructor_begin.o \ - stdlib_default_pool_size.o \ - stdlib_default_puddle_size.o \ - stdlib_destructor.o \ - stdlib_detach.o \ - stdlib_disablerequesters.o \ - stdlib_div.o \ - stdlib_divsi3.o \ - stdlib_divsi4.o \ - stdlib_dosbase.o \ - stdlib_exit.o \ - stdlib_free.o \ - stdlib_getdefstacksize.o \ - stdlib_getenv.o \ - stdlib_getsp.o \ - stdlib_get_errno.o \ - stdlib_isresident.o \ - stdlib_labs.o \ - stdlib_llabs.o \ - stdlib_ldiv.o \ - stdlib_lldiv.o \ - stdlib_lib_main.o \ - stdlib_lib_startup.o \ - stdlib_machine_test.o \ - stdlib_main.o \ - stdlib_malloc.o \ - stdlib_math.o \ - stdlib_mkdtemp.o \ - stdlib_mkstemp.o \ - stdlib_mktemp.o \ - stdlib_modsi3.o \ - stdlib_mulsi3.o \ - stdlib_never_free.o \ - stdlib_osliberror.o \ - stdlib_oslibversion.o \ - stdlib_priority.o \ - stdlib_process_name.o \ - stdlib_program_name.o \ - stdlib_putenv.o \ - stdlib_qsort.o \ - stdlib_rand.o \ - stdlib_rand_r.o \ - stdlib_realloc.o \ - stdlib_red_black.o \ - stdlib_semaphore.o \ - stdlib_setenv.o \ - stdlib_setjmp.o \ - stdlib_set_errno.o \ - stdlib_set_process_window.o \ - stdlib_shell_escape.o \ - stdlib_showerror.o \ - stdlib_srand.o \ - stdlib_stackargbytes.o \ - stdlib_stackcheck.o \ - stdlib_stackoverflow.o \ - stdlib_stacksafezone.o \ - stdlib_stacksize.o \ - stdlib_stack_usage.o \ - stdlib_arg.o \ - stdlib_stdio_window_spec.o \ - stdlib_strtol.o \ - stdlib_strtoll.o \ - stdlib_strtoul.o \ - stdlib_strtoull.o \ - stdlib_swapstack.o \ - stdlib_sysbase.o \ - stdlib_system.o \ - stdlib_termination_message.o \ - stdlib_threshold.o \ - stdlib_utilitybase.o \ - stdlib_udivsi3.o \ - stdlib_udivsi4.o \ - stdlib_umodsi3.o \ - stdlib_unsetenv.o \ - strings_ffs.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_strlcat.o \ - string_strlcpy.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_strtok_r.o \ - string_strxfrm.o \ - time_asctime.o \ - time_asctime_r.o \ - time_clock.o \ - time_converttime.o \ - time_convert_datestamp.o \ - time_convert_time.o \ - time_ctime.o \ - time_ctime_r.o \ - time_data.o \ - time_days_per_date.o \ - time_gettimeofday.o \ - time_gmtime.o \ - time_gmtime_r.o \ - time_localtime.o \ - time_localtime_r.o \ - time_mktime.o \ - time_numbertostring.o \ - time_strftime.o \ - time_time.o \ - time_weekday.o \ - uio_readv.o \ - uio_writev.o \ - unistd_access.o \ - unistd_chdir.o \ - unistd_chdir_exit.o \ - unistd_chown.o \ - unistd_currentpathname.o \ - unistd_dup.o \ - unistd_dup2.o \ - unistd_fchown.o \ - unistd_fdatasync.o \ - unistd_fdopen.o \ - unistd_fileno.o \ - unistd_fsync.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_sync_fd.o \ - unistd_timer.o \ - unistd_time_delay.o \ - unistd_truncate.o \ - unistd_unlink.o \ - unistd_usleep.o \ - utime_utime.o \ - utsname_uname.o - -UNIX_LIB = \ - unix.lib_rev.o \ - dirent_closedir.o \ - dirent_rewinddir.o \ - dirent_opendir.o \ - dirent_readdir.o \ - fcntl_creat.o \ - fcntl_fcntl.o \ - fcntl_open.o \ - fcntl_get_default_file.o \ - getopt_getopt_long.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_ctermid.o \ - stdio_fdhookentry.o \ - stdio_fflush.o \ - stdio_fopen.o \ - stdio_init_exit.o \ - stdio_file_init.o \ - stdio_locksemaphorename.o \ - stdio_openiob.o \ - stdio_popen.o \ - stdio_record_locking.o \ - stdio_remove.o \ - stdio_rename.o \ - stdlib_arg.o \ - stdlib_main.o \ - stdlib_mkdtemp.o \ - stdlib_mkstemp.o \ - stdlib_mktemp.o \ - stdlib_system.o \ - termios_cfgetispeed.o \ - termios_cfgetospeed.o \ - termios_cfmakeraw.o \ - termios_cfsetispeed.o \ - termios_cfsetospeed.o \ - termios_console_fdhookentry.o \ - termios_tcdrain.o \ - termios_tcflow.o \ - termios_tcflush.o \ - termios_tcgetattr.o \ - termios_tcsendbreak.o \ - termios_tcsetattr.o \ - uio_readv.o \ - uio_writev.o \ - unistd_access.o \ - unistd_chdir.o \ - unistd_chdir_exit.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_ttyname.o \ - unistd_ttyname_r.o \ - unistd_unix_path_semantics.o \ - unistd_unlink.o \ - unistd_wildcard_expand.o \ - utime_utime.o - -MATH_LIB = \ - complex_carg.o \ - complex_cargf.o \ - complex_cargl.o \ - complex_cimag.o \ - complex_cimagf.o \ - complex_cimagl.o \ - complex_conj.o \ - complex_conjf.o \ - complex_conjl.o \ - complex_creal.o \ - complex_crealf.o \ - complex_creall.o \ - math_acos.o \ - math_acosf.o \ - math_acosh.o \ - math_acoshf.o \ - math_asin.o \ - math_asinf.o \ - math_asinh.o \ - math_asinhf.o \ - math_atan.o \ - math_atan2.o \ - math_atan2f.o \ - math_atanf.o \ - math_cbrt.o \ - math_cbrtf.o \ - math_ceil.o \ - math_ceilf.o \ - math_copysign.o \ - math_copysignf.o \ - math_cos.o \ - math_cosf.o \ - math_cosh.o \ - math_coshf.o \ - math_erf.o \ - math_erfc.o \ - math_erfcf.o \ - math_erff.o \ - math_exp.o \ - math_expf.o \ - math_exp2.o \ - math_exp2f.o \ - math_expm1.o \ - math_expm1f.o \ - math_fabs.o \ - math_fabsf.o \ - math_floor.o \ - math_floorf.o \ - math_fmod.o \ - math_fmodf.o \ - math_fpclassify.o \ - math_frexp.o \ - math_frexpf.o \ - math_huge_val.o \ - math_huge_valf.o \ - math_hypot.o \ - math_hypotf.o \ - math_ilogb.o \ - math_ilogbf.o \ - math_inf.o \ - math_inff.o \ - math_init_exit.o \ - math_isfinite.o \ - math_isunordered.o \ - math_kernel_cosf.o \ - math_kernel_sinf.o \ - math_kernel_tanf.o \ - math_ldexp.o \ - math_ldexpf.o \ - math_lgamma.o \ - math_lgammaf.o \ - math_log.o \ - math_log2.o \ - math_log2f.o \ - math_log10.o \ - math_log10f.o \ - math_log1p.o \ - math_log1pf.o \ - math_logb.o \ - math_logbf.o \ - math_logf.o \ - math_modf.o \ - math_modff.o \ - math_nan.o \ - math_nanf.o \ - math_nextafter.o \ - math_nextafterf.o \ - math_pow.o \ - math_powf.o \ - math_remainder.o \ - math_remainderf.o \ - math_rem_pio2f.o \ - math_rint.o \ - math_rintf.o \ - math_scalbn.o \ - math_scalbnf.o \ - math_signbit.o \ - math_sin.o \ - math_sinf.o \ - math_sinh.o \ - math_sinhf.o \ - math_sqrt.o \ - math_sqrtf.o \ - math_tan.o \ - math_tanf.o \ - math_tanh.o \ - math_tanhf.o \ - stdio_asprintf.o \ - stdio_flush.o \ - stdio_flush_all_files.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_vsscanf.o \ - stdio_vscanf.o \ - stdio_vprintf.o \ - stdio_vsnprintf.o \ - stdio_vsprintf.o \ - stdlib_atof.o \ - stdlib_strtod.o \ - stdlib_strtof.o \ - time_difftime.o - -MATH_LIB_881 = \ - m881.lib_rev.o \ - $(MATH_LIB) - -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_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 \ - stat_umask.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 \ - utsname_uname.o - -DEBUG_LIB = \ - debug.lib_rev.o \ - debug.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 \ - debug_level.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_beginio.o \ - amiga_callhook.o \ - amiga_callhooka.o \ - amiga_coercemethod.o \ - amiga_createextio.o \ - amiga_createport.o \ - amiga_createstdio.o \ - amiga_createtask.o \ - amiga_deleteextio.o \ - amiga_deleteport.o \ - amiga_deletestdio.o \ - amiga_deletetask.o \ - amiga_domethod.o \ - amiga_dosupermethod.o \ - amiga_dotimer.o \ - amiga_fastrand.o \ - amiga_freeievents.o \ - amiga_hookentry.o \ - amiga_hotkey.o \ - amiga_invertstring.o \ - amiga_newlist.o \ - amiga_rangerand.o \ - amiga_remtof.o \ - amiga_rexxvars.o \ - amiga_setsuperattrs.o \ - amiga_timedelay.o \ - amiga_waitbeam.o - -MEMDEBUG_LIB = \ - stdio_vasprintf_debug.o \ - stdio_vasprintf_debug.o \ - stdio_vasprintf_hook_entry_debug.o \ - stdlib_alloca_debug.o \ - stdlib_calloc_debug.o \ - stdlib_free_debug.o \ - stdlib_malloc_debug.o \ - string_strdup_debug.o \ - unistd_getcwd_debug.o - -############################################################################## - -LIBS_68K := $(LIBC_OBJS)/libc.a $(LIBSTACK_OBJS)/libstack.a $(LIBUNIX_OBJS)/libunix.a \ - $(LIBNET_OBJS)/libnet.a $(LIBDEBUG_OBJS)/libdebug.a $(LIBAMIGA_OBJS)/libamiga.a \ - $(LIBM_OBJS)/libm.a -LIBS_020 := $(LIBM881_OBJS)/libm881.a $(LIBS_68K) - -############################################################################## - -# The 881 math library won't build in plain 68k mode -ifneq (,$(findstring 68020,$(CODE_FLAGS))) -LIBS := $(LIBS_020) -else -LIBS := $(LIBS_68K) -endif - -############################################################################## - -STARTUPS := nrcrt0.o nbcrt0.o nr32crt0.o nb32crt0.o ncrt0.o - -############################################################################## - -all: \ - lib/nrcrt0.o \ - lib/nbcrt0.o \ - lib/ncrt0.o \ - lib/n32bcrt0.o \ - lib/n32rcrt0.o \ - lib/libm020/libm.a \ - lib/libm.a \ - lib/libb/libm.a \ - lib/libb/libm020/libm.a \ - lib/libb32/libm020/libm.a - -############################################################################## - -clean: - -$(DELETE) $(TYPE) $(LIBS_020) $(STARTUPS) \ - $(LIBC_OBJS) $(LIBUNIX_OBJS) $(LIBM_OBJS) \ - $(LIBM881_OBJS) $(LIBSTACK_OBJS) $(LIBNET_OBJS) $(LIBDEBUG_OBJS) \ - $(LIBAMIGA_OBJS) - -realclean: - $(MAKE) clean - -$(DELETE) lib small_data_020 small_data small_data32 large_data_020 \ - large_data - -############################################################################## - -version: - copy clone c.lib_rev.rev amiga.lib_rev.rev - copy clone c.lib_rev.rev debug.lib_rev.rev - copy clone c.lib_rev.rev m.lib_rev.rev - copy clone c.lib_rev.rev m881.lib_rev.rev - copy clone c.lib_rev.rev net.lib_rev.rev - copy clone c.lib_rev.rev stack.lib_rev.rev - copy clone 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_`type c.lib_rev.rev` - -############################################################################## - -kitchen_sink: $(TYPE) $(LIBS) $(STARTUPS) - -############################################################################## - -ifneq (,$(TYPE)) -$(TYPE): - $(MAKEDIR) $@ -endif - -############################################################################## - -lib: - -$(MAKEDIR) $@ - -lib/libb : lib - -$(MAKEDIR) $@ - -lib/libb/libm020 : lib lib/libb - -$(MAKEDIR) $@ - -lib/libb32/libm020 : lib lib/libb32 - -$(MAKEDIR) $@ - -lib/libb32 : lib - -$(MAKEDIR) $@ - -lib/libm020 : lib - -$(MAKEDIR) $@ - -lib/libb/libm020/libm.a: lib lib/libb/libm020 - $(MAKE) TYPE=small_data_020 kitchen_sink - @$(COPY) $(foreach file,$(LIBS_020),small_data_020/$(file)) lib/libb/libm020 - -lib/libb/libm.a: lib lib/libb - $(MAKE) TYPE=small_data kitchen_sink - @$(COPY) $(foreach file,$(LIBS_68K),small_data/$(file)) lib/libb - -lib/libb32/libm020/libm.a: lib lib/libb32 lib/libb32/libm020 - $(MAKE) TYPE=small_data32 kitchen_sink - @$(COPY) $(foreach file,$(LIBS_020),small_data32/$(file)) lib/libb32/libm020 - -lib/libm020/libm.a: lib lib/libm020 - $(MAKE) TYPE=large_data_020 kitchen_sink - @$(COPY) $(foreach file,$(LIBS_020),large_data_020/$(file)) lib/libm020 - -lib/libm.a: lib - $(MAKE) TYPE=large_data kitchen_sink - @$(COPY) $(foreach file,$(LIBS_68K),large_data/$(file)) lib - -lib/nrcrt0.o : lib nrcrt0.o - @$(COPY) nrcrt0.o lib - -lib/nbcrt0.o : lib nbcrt0.o - @$(COPY) nbcrt0.o lib - -lib/ncrt0.o : lib ncrt0.o - @$(COPY) ncrt0.o lib - -lib/n32bcrt0.o : lib nb32crt0.o - @$(COPY) nb32crt0.o lib - -lib/n32rcrt0.o : lib nr32crt0.o - @$(COPY) nr32crt0.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)/c.lib_rev.o : c.lib_rev.c c.lib_rev.h - -$(LIBUNIX_OBJS)/unix.lib_rev.o : unix.lib_rev.c unix.lib_rev.h - -$(LIBM_OBJS)/m.lib_rev.o : m.lib_rev.c m.lib_rev.h - -$(LIBM881_OBJS)/m881.lib_rev.o : m881.lib_rev.c m881.lib_rev.h - -$(LIBSTACK_OBJS)/stack.lib_rev.o : stack.lib_rev.c stack.lib_rev.h - -$(LIBNET_OBJS)/net.lib_rev.o : net.lib_rev.c net.lib_rev.h - -$(LIBDEBUG_OBJS)/debug.lib_rev.o : debug.lib_rev.c debug.lib_rev.h - -$(LIBAMIGA_OBJS)/amiga.lib_rev.o : amiga.lib_rev.c amiga.lib_rev.h - -############################################################################## - -$(LIBC_OBJS)/stdlib_stacksize.o : stdlib_stacksize.c stdlib_gcc_help.h - -$(LIBC_OBJS)/stdlib_getdefstacksize.o : stdlib_getdefstacksize.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_memory.h - -$(LIBC_OBJS)/stdlib_calloc.o : stdlib_calloc.c stdlib_memory.h - -$(LIBC_OBJS)/stdlib_free.o : stdlib_free.c stdlib_memory.h - -$(LIBC_OBJS)/stdlib_malloc.o : stdlib_malloc.c stdlib_memory.h - -$(LIBC_OBJS)/stdlib_realloc.o : stdlib_realloc.c stdlib_memory.h - -$(LIBC_OBJS)/stdlib_red_black.o : stdlib_red_black.c stdlib_memory.h - -############################################################################## - -# The -fbaserel32 option requires the CPU type to be 68020, too. -ifneq (,$(findstring fbaserel32,$(CODE_FLAGS))) -LOCAL_CODE_FLAGS := $(CODE_FLAGS) $(CODE_TYPE) -else -LOCAL_CODE_FLAGS := $(CODE_FLAGS) -endif - -$(LIBM881_OBJS)/math_init_exit.o : math_init_exit.c - @echo "Compiling $< [$(TYPE):m881]" - @$(CC) -o $(LIBM881_OBJS)/math_init_exit.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(LOCAL_CODE_FLAGS) -DM68881_FLOATING_POINT_SUPPORT $(INCLUDES) $< - -$(LIBC_OBJS)/stdlib_machine_test.o : stdlib_machine_test.c - @echo "Compiling $< [$(TYPE):c]" - @$(CC) -o $(LIBC_OBJS)/stdlib_machine_test.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(LOCAL_CODE_FLAGS) $(INCLUDES) $< - -$(LIBC_OBJS)/stdlib_showerror.o : stdlib_showerror.c - @echo "Compiling $< [$(TYPE):c]" - @$(CC) -o $(LIBC_OBJS)/stdlib_showerror.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(LOCAL_CODE_FLAGS) $(INCLUDES) $< - -$(LIBC_OBJS)/stdlib_main.o : stdlib_main.c - @echo "Compiling $< [$(TYPE):c]" - @$(CC) -o $(LIBC_OBJS)/stdlib_main.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(LOCAL_CODE_FLAGS) $(INCLUDES) stdlib_main.c - -############################################################################## - -$(LIBC_OBJS)/stdlib_alloca_debug.o : stdlib_alloca.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/stdlib_alloca_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_alloca.c - -$(LIBC_OBJS)/stdlib_calloc_debug.o : stdlib_calloc.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/stdlib_calloc_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_calloc.c - -$(LIBC_OBJS)/stdlib_free_debug.o : stdlib_free.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/stdlib_free_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_free.c - -$(LIBC_OBJS)/stdlib_malloc_debug.o : stdlib_malloc.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/stdlib_malloc_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_malloc.c - -$(LIBC_OBJS)/stdlib_realloc_debug.o : stdlib_realloc.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/stdlib_realloc_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_realloc.c - -$(LIBC_OBJS)/stdio_vasprintf_hook_entry_debug.o : stdio_vasprintf_hook_entry.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/stdio_vasprintf_hook_entry_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdio_vasprintf_hook_entry.c - -$(LIBC_OBJS)/stdio_vasprintf_debug.o : stdio_vasprintf.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/stdio_vasprintf_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdio_vasprintf.c - -$(LIBM_OBJS)/stdio_vasprintf_debug.o : stdio_vasprintf.c - @echo "Compiling $< [$(TYPE):m debug]" - @$(CC) -o $(LIBM_OBJS)/stdio_vasprintf_debug.o -c $(CFLAGS) -DIEEE_FLOATING_POINT_SUPPORT -D__USE_MEM_TREES -D__MEM_DEBUG stdio_vasprintf.c - -$(LIBC_OBJS)/string_strdup_debug.o : string_strdup.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/string_strdup_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG string_strdup.c - -$(LIBC_OBJS)/unistd_getcwd_debug.o : unistd_getcwd.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/unistd_getcwd_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG unistd_getcwd.c - -$(LIBUNIX_OBJS)/unistd_getcwd_debug.o : unistd_getcwd.c - @echo "Compiling $< [$(TYPE):unix debug]" - @$(CC) -o $(LIBUNIX_OBJS)/unistd_getcwd_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG -DUNIX_PATH_SEMANTICS unistd_getcwd.c - -############################################################################## - -$(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) $@ - -############################################################################## - -$(LIBM881_OBJS) : - $(MAKEDIR) $@ - -$(LIBM881_OBJS)/libm881.a : $(LIBM881_OBJS) $(foreach file,$(MATH_LIB_881),$(LIBM881_OBJS)/$(file)) - -$(DELETE) $@ - @$(AR) $@ $(foreach file,$(MATH_LIB_881),$(LIBM881_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) $@ - -############################################################################## - -nrcrt0.o : nrcrt0.S - @echo "Assembling $< [resident]" - @$(CC) -traditional -o $@ -c nrcrt0.S - -nr32crt0.o : nrcrt0.S - @echo "Assembling $< [resident32]" - @$(CC) -traditional -m68020 -DSMALL_DATA32 -o $@ -c nrcrt0.S - -nbcrt0.o : ncrt0.S - @echo "Assembling $< [small_data]" - @$(CC) -traditional -DSMALL_DATA -o $@ -c ncrt0.S - -nb32crt0.o : ncrt0.S - @echo "Assembling $< [small_data32]" - @$(CC) -traditional -m68020 -DSMALL_DATA32 -o $@ -c ncrt0.S - -ncrt0.o : ncrt0.S - @echo "Assembling $< [large_data]" - @$(CC) -traditional -o $@ -c ncrt0.S - -############################################################################## - -CONSTRUCTOR_FILES = \ - amiga_rexxvars.c \ - dirent_closedir.c \ - locale_init_exit.c \ - math_init_exit.c \ - sas_profile.c \ - socket_init_exit.c \ - stdio_file_init.c \ - stdio_init_exit.c \ - stdlib_alloca.c \ - stdlib_arg.c \ - stdlib_malloc.c \ - stdlib_program_name.c \ - stdlib_setenv.c \ - stdlib_stackcheck.c \ - stdlib_stackextension.c \ - time_clock.c \ - unistd_chdir_exit.c \ - unistd_init_exit.c \ - unistd_timer.c \ - unistd_wildcard_expand.c \ - usergroup_init_exit.c - -touch_constructor_files: - touch $(CONSTRUCTOR_FILES) diff --git a/library/GNUmakefile.os4 b/library/GNUmakefile.os4 deleted file mode 100644 index 2cbc126..0000000 --- a/library/GNUmakefile.os4 +++ /dev/null @@ -1,1223 +0,0 @@ -# -# $Id: GNUmakefile.os4,v 1.72 2005-07-03 10:36:46 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 -a -DELETE = rm -rf -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_COMMAND) -f GNUmakefile.os4 - -############################################################################## - -ifeq (,$(TYPE)) -LIBC_OBJS = libc_objs -LIBUNIX_OBJS = libunix_objs -LIBM_OBJS = libm_objs -LIBNET_OBJS = libnet_objs -LIBDEBUG_OBJS = libdebug_objs -LIBAMIGA_OBJS = libamiga_objs -LIBPROFILE_OBJS = libprofile_objs -else -LIBC_OBJS = $(TYPE)/libc_objs -LIBUNIX_OBJS = $(TYPE)/libunix_objs -LIBM_OBJS = $(TYPE)/libm_objs -LIBNET_OBJS = $(TYPE)/libnet_objs -LIBDEBUG_OBJS = $(TYPE)/libdebug_objs -LIBAMIGA_OBJS = $(TYPE)/libamiga_objs -LIBPROFILE_OBJS = $(TYPE)/libprofile_objs -endif - -############################################################################## - -# General build rules for all object files and the individual libraries -%.o : %.c - @echo "Compiling $<" - @$(CC) -c $(CFLAGS) $< - -$(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) $(FLOAT_TYPE) $< - -$(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) $< - -$(LIBPROFILE_OBJS)/%.o : %.c - @echo "Compiling $< [$(TYPE):profile]" - @$(CC) -o $(LIBPROFILE_OBJS)/$*.o -c $(CFLAGS) $< - -$(LIBPROFILE_OBJS)/%.o : %.S - @echo "Assembling $< [$(TYPE):profile]" - @$(CC) -o $(LIBPROFILE_OBJS)/$*.o -Wa,-mregnames -c $(CFLAGS) $< - - - -############################################################################## - -# Build options for the individual libraries -ifeq (small_data,$(TYPE)) -CODE_TYPE := -msdata=sysv -DSMALL_DATA -FLOAT_TYPE := -DPPC_FLOATING_POINT_SUPPORT -endif - -ifeq (large_data,$(TYPE)) -CODE_TYPE := -msdata=data -FLOAT_TYPE := -DPPC_FLOATING_POINT_SUPPORT -endif - -ifeq (large_data_softfloat,$(TYPE)) -CODE_TYPE := -msdata=data -msoft-float -FLOAT_TYPE := -endif - -ifeq (baserel,$(TYPE)) -CODE_TYPE := -mbaserel -DBASEREL_DATA -FLOAT_TYPE := -DPPC_FLOATING_POINT_SUPPORT -endif - -############################################################################## - -WARNINGS = \ - -Wall -W -Wpointer-arith -Wsign-compare -Wmissing-prototypes \ - -Wundef -Wbad-function-cast -Wmissing-declarations -Wunused - -# -Wconversion -Wshadow - -INCLUDES = -Iinclude -I. -I$(SDK_INCLUDE) -#OPTIONS = -D__THREAD_SAFE -DNDEBUG -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-common -std=gnu99 - OPTIONS = -DNDEBUG -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-common -std=gnu99 -OPTIMIZE = -O3 -#DEBUG = -ggdb - -CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_TYPE) $(INCLUDES) - -############################################################################## - -# All objects files which make up libc.a -C_LIB = \ - c.lib_rev.o \ - ctype_isalnum.o \ - ctype_isalpha.o \ - ctype_isascii.o \ - ctype_isblank.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_table.o \ - ctype_tolower.o \ - ctype_toupper.o \ - dirent_closedir.o \ - dirent_opendir.o \ - dirent_readdir.o \ - dirent_rewinddir.o \ - errno_data.o \ - fcntl_close.o \ - fcntl_creat.o \ - fcntl_fcntl.o \ - fcntl_get_default_file.o \ - fcntl_lock.o \ - fcntl_lseek.o \ - fcntl_open.o \ - fcntl_read.o \ - fcntl_write.o \ - ftw_ftw.o \ - ftw_nftw.o \ - inttypes_imaxdiv.o \ - inttypes_imaxabs.o \ - inttypes_strtoimax.o \ - inttypes_strtoumax.o \ - libgen_basename.o \ - libgen_dirname.o \ - locale_init_exit.o \ - locale_localeconv.o \ - locale_open_locale.o \ - locale_setlocale.o \ - mount_convertinfo.o \ - mount_fstatfs.o \ - mount_statfs.o \ - profile_profil.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_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_dropiobreadbuffer.o \ - stdio_duplicate_fd.o \ - stdio_examine_fh.o \ - stdio_fclose.o \ - stdio_fdhookentry.o \ - stdio_feof.o \ - stdio_ferror.o \ - stdio_fflush.o \ - stdio_fgetc.o \ - stdio_fgetpos.o \ - stdio_fgets.o \ - stdio_filliobreadbuffer.o \ - stdio_findvacantfdentry.o \ - stdio_findvacantiobentry.o \ - stdio_flockfile.o \ - stdio_flush.o \ - stdio_flush_all_files.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_fseeko.o \ - stdio_fsetpos.o \ - stdio_ftell.o \ - stdio_ftello.o \ - stdio_ftrylockfile.o \ - stdio_funlockfile.o \ - stdio_fwrite.o \ - stdio_getc.o \ - stdio_getc_unlocked.o \ - stdio_getchar.o \ - stdio_getchar_unlocked.o \ - stdio_gets.o \ - stdio_get_file_descriptor.o \ - stdio_growfdtable.o \ - stdio_growiobtable.o \ - stdio_grow_file.o \ - stdio_initializefd.o \ - stdio_initializeiob.o \ - stdio_init_exit.o \ - stdio_file_init.o \ - stdio_iobhookentry.o \ - stdio_lock.o \ - stdio_locksemaphorename.o \ - stdio_nostdio.o \ - stdio_openiob.o \ - stdio_parent_of_fh.o \ - stdio_perror.o \ - stdio_popen.o \ - stdio_printf.o \ - stdio_putc.o \ - stdio_putc_unlocked.o \ - stdio_putchar.o \ - stdio_putchar_unlocked.o \ - stdio_puts.o \ - stdio_remove.o \ - stdio_remove_fd_alias.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_unlockfile.o \ - stdio_vasprintf.o \ - stdio_vasprintf_hook_entry.o \ - stdio_vfprintf.o \ - stdio_vfscanf.o \ - stdio_vsscanf.o \ - stdio_vscanf.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_atoll.o \ - stdlib_bsearch.o \ - stdlib_calloc.o \ - stdlib_checkdetach.o \ - stdlib_constructor.o \ - stdlib_constructor_begin.o \ - stdlib_default_pool_size.o \ - stdlib_default_puddle_size.o \ - stdlib_destructor.o \ - stdlib_detach.o \ - stdlib_disablerequesters.o \ - stdlib_div.o \ - stdlib_divsi3.o \ - stdlib_divsi4.o \ - stdlib_dosbase.o \ - stdlib_exit.o \ - stdlib_free.o \ - stdlib_getdefstacksize.o \ - stdlib_getenv.o \ - stdlib_getsp.o \ - stdlib_get_errno.o \ - stdlib_isresident.o \ - stdlib_labs.o \ - stdlib_llabs.o \ - stdlib_ldiv.o \ - stdlib_lldiv.o \ - stdlib_lib_main.o \ - stdlib_lib_startup.o \ - stdlib_machine_test.o \ - stdlib_main.o \ - stdlib_malloc.o \ - stdlib_math.o \ - stdlib_mkdtemp.o \ - stdlib_mkstemp.o \ - stdlib_mktemp.o \ - stdlib_modsi3.o \ - stdlib_mulsi3.o \ - stdlib_never_free.o \ - stdlib_osliberror.o \ - stdlib_oslibversion.o \ - stdlib_priority.o \ - stdlib_process_name.o \ - stdlib_program_name.o \ - stdlib_putenv.o \ - stdlib_qsort.o \ - stdlib_rand.o \ - stdlib_rand_r.o \ - stdlib_realloc.o \ - stdlib_red_black.o \ - stdlib_semaphore.o \ - stdlib_setenv.o \ - stdlib_setjmp.o \ - stdlib_set_errno.o \ - stdlib_set_process_window.o \ - stdlib_shell_escape.o \ - stdlib_showerror.o \ - stdlib_srand.o \ - stdlib_stackargbytes.o \ - stdlib_stackcheck.o \ - stdlib_stackoverflow.o \ - stdlib_stacksafezone.o \ - stdlib_stacksize.o \ - stdlib_stack_usage.o \ - stdlib_arg.o \ - stdlib_stdio_window_spec.o \ - stdlib_strtol.o \ - stdlib_strtoll.o \ - stdlib_strtoul.o \ - stdlib_strtoull.o \ - stdlib_swapstack.o \ - stdlib_sysbase.o \ - stdlib_system.o \ - stdlib_termination_message.o \ - stdlib_threshold.o \ - stdlib_utilitybase.o \ - stdlib_udivsi3.o \ - stdlib_udivsi4.o \ - stdlib_umodsi3.o \ - stdlib_unsetenv.o \ - strings_ffs.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_strlcat.o \ - string_strlcpy.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_strtok_r.o \ - string_strxfrm.o \ - time_asctime.o \ - time_asctime_r.o \ - time_clock.o \ - time_converttime.o \ - time_convert_datestamp.o \ - time_convert_time.o \ - time_ctime.o \ - time_ctime_r.o \ - time_data.o \ - time_days_per_date.o \ - time_gettimeofday.o \ - time_gmtime.o \ - time_gmtime_r.o \ - time_localtime.o \ - time_localtime_r.o \ - time_mktime.o \ - time_numbertostring.o \ - time_strftime.o \ - time_time.o \ - time_weekday.o \ - uio_readv.o \ - uio_writev.o \ - unistd_access.o \ - unistd_chdir.o \ - unistd_chdir_exit.o \ - unistd_chown.o \ - unistd_currentpathname.o \ - unistd_dup.o \ - unistd_dup2.o \ - unistd_fchown.o \ - unistd_fdatasync.o \ - unistd_fdopen.o \ - unistd_fileno.o \ - unistd_fsync.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_sync_fd.o \ - unistd_timer.o \ - unistd_time_delay.o \ - unistd_truncate.o \ - unistd_unlink.o \ - unistd_usleep.o \ - utime_utime.o \ - utsname_uname.o - -# All objects files which make up libunix.a -UNIX_LIB = \ - unix.lib_rev.o \ - dirent_closedir.o \ - dirent_rewinddir.o \ - dirent_opendir.o \ - dirent_readdir.o \ - fcntl_creat.o \ - fcntl_fcntl.o \ - fcntl_open.o \ - fcntl_get_default_file.o \ - getopt_getopt_long.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_ctermid.o \ - stdio_fdhookentry.o \ - stdio_fflush.o \ - stdio_fopen.o \ - stdio_file_init.o \ - stdio_init_exit.o \ - stdio_locksemaphorename.o \ - stdio_openiob.o \ - stdio_popen.o \ - stdio_record_locking.o \ - stdio_remove.o \ - stdio_rename.o \ - stdlib_arg.o \ - stdlib_main.o \ - stdlib_mkdtemp.o \ - stdlib_mkstemp.o \ - stdlib_mktemp.o \ - stdlib_system.o \ - termios_cfgetispeed.o \ - termios_cfgetospeed.o \ - termios_cfmakeraw.o \ - termios_cfsetispeed.o \ - termios_cfsetospeed.o \ - termios_console_fdhookentry.o \ - termios_openserial.o \ - termios_tcdrain.o \ - termios_tcflow.o \ - termios_tcflush.o \ - termios_tcgetattr.o \ - termios_tcsendbreak.o \ - termios_tcsetattr.o \ - uio_readv.o \ - uio_writev.o \ - unistd_access.o \ - unistd_chdir.o \ - unistd_chdir_exit.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_ttyname.o \ - unistd_ttyname_r.o \ - unistd_unix_path_semantics.o \ - unistd_unlink.o \ - unistd_wildcard_expand.o \ - utime_utime.o - -# All objects files which make up libm.a -MATH_LIB = \ - complex_carg.o \ - complex_cargf.o \ - complex_cargl.o \ - complex_cimag.o \ - complex_cimagf.o \ - complex_cimagl.o \ - complex_conj.o \ - complex_conjf.o \ - complex_conjl.o \ - complex_creal.o \ - complex_crealf.o \ - complex_creall.o \ - math_acos.o \ - math_acosf.o \ - math_acosh.o \ - math_acoshf.o \ - math_asin.o \ - math_asinf.o \ - math_asinh.o \ - math_asinhf.o \ - math_atan.o \ - math_atan2.o \ - math_atan2f.o \ - math_atanf.o \ - math_cbrt.o \ - math_cbrtf.o \ - math_ceil.o \ - math_ceilf.o \ - math_copysign.o \ - math_copysignf.o \ - math_cos.o \ - math_cosf.o \ - math_cosh.o \ - math_coshf.o \ - math_erf.o \ - math_erfc.o \ - math_erfcf.o \ - math_erff.o \ - math_exp.o \ - math_expf.o \ - math_exp2.o \ - math_exp2f.o \ - math_expm1.o \ - math_expm1f.o \ - math_fabs.o \ - math_fabsf.o \ - math_floor.o \ - math_floorf.o \ - math_fmod.o \ - math_fmodf.o \ - math_fpclassify.o \ - math_frexp.o \ - math_frexpf.o \ - math_huge_val.o \ - math_huge_valf.o \ - math_hypot.o \ - math_hypotf.o \ - math_ilogb.o \ - math_ilogbf.o \ - math_inf.o \ - math_inff.o \ - math_init_exit.o \ - math_isfinite.o \ - math_isunordered.o \ - math_kernel_cos.o \ - math_kernel_cosf.o \ - math_kernel_expm1.o \ - math_kernel_rem_pio2.o \ - math_kernel_scalbn.o \ - math_kernel_sin.o \ - math_kernel_sinf.o \ - math_kernel_tan.o \ - math_kernel_tanf.o \ - math_ldexp.o \ - math_ldexpf.o \ - math_lgamma.o \ - math_lgammaf.o \ - math_log.o \ - math_log2.o \ - math_log2f.o \ - math_log10.o \ - math_log10f.o \ - math_log1p.o \ - math_log1pf.o \ - math_logb.o \ - math_logbf.o \ - math_logf.o \ - math_modf.o \ - math_modff.o \ - math_nan.o \ - math_nanf.o \ - math_nextafter.o \ - math_nextafterf.o \ - math_pow.o \ - math_powf.o \ - math_remainder.o \ - math_remainderf.o \ - math_rem_pio2f.o \ - math_rint.o \ - math_rintf.o \ - math_scalbn.o \ - math_scalbnf.o \ - math_signbit.o \ - math_sin.o \ - math_sinf.o \ - math_sinh.o \ - math_sinhf.o \ - math_sqrt.o \ - math_sqrtf.o \ - math_tan.o \ - math_tanf.o \ - math_tanh.o \ - math_tanhf.o \ - stdio_asprintf.o \ - stdio_flush.o \ - stdio_flush_all_files.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_vsscanf.o \ - stdio_vscanf.o \ - stdio_vprintf.o \ - stdio_vsnprintf.o \ - stdio_vsprintf.o \ - stdlib_atof.o \ - stdlib_strtod.o \ - stdlib_strtof.o \ - time_difftime.o - -# All objects files which make up libnet.a -NET_LIB = \ - net.lib_rev.o \ - socket_accept.o \ - socket_bind.o \ - socket_connect.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 \ - stat_umask.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 \ - utsname_uname.o - -# All objects files which make up libdebug.a -DEBUG_LIB = \ - debug.lib_rev.o \ - debug.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 \ - debug_level.o - -# All objects files which make up libamiga.a -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_beginio.o \ - amiga_callhooka.o \ - amiga_coercemethod.o \ - amiga_createextio.o \ - amiga_createport.o \ - amiga_createstdio.o \ - amiga_createtask.o \ - amiga_deleteextio.o \ - amiga_deleteport.o \ - amiga_deletestdio.o \ - amiga_deletetask.o \ - amiga_domethod.o \ - amiga_dosupermethod.o \ - amiga_dotimer.o \ - amiga_fastrand.o \ - amiga_freeievents.o \ - amiga_hotkey.o \ - amiga_invertstring.o \ - amiga_newlist.o \ - amiga_rangerand.o \ - amiga_remtof.o \ - amiga_rexxvars.o \ - amiga_setsuperattrs.o \ - amiga_timedelay.o \ - amiga_waitbeam.o - -MEMDEBUG_LIB = \ - stdio_vasprintf_debug.o \ - stdio_vasprintf_hook_entry_debug.o \ - stdlib_alloca_debug.o \ - stdlib_calloc_debug.o \ - stdlib_free_debug.o \ - stdlib_malloc_debug.o \ - string_strdup_debug.o \ - unistd_getcwd_debug.o - -PROFILE_LIB = \ - profile__mcount.o \ - profile_gmon.o \ - profile_mcount.o - -############################################################################## - -# The libraries to be built, prefixed by the respective path names -LIBS := \ - $(LIBC_OBJS)/libc.a \ - $(LIBUNIX_OBJS)/libunix.a \ - $(LIBDEBUG_OBJS)/libdebug.a \ - $(LIBAMIGA_OBJS)/libamiga.a \ - $(LIBM_OBJS)/libm.a \ - $(LIBNET_OBJS)/libnet.a \ - $(LIBPROFILE_OBJS)/libprofile.a - -############################################################################## - -# The startup object files to be built -STARTUPS := crt0.o crtbegin.o crtend.o - -############################################################################## - -# This is the first target: it creates the necessary directories, then proceeds -# to build the startup object files and finally the libraries -all: \ - lib \ - lib/soft-float \ - lib/small-data \ - lib/baserel \ - small_data \ - large_data \ - large_data_softfloat \ - baserel \ - lib/crt0.o \ - lib/crtbegin.o \ - lib/crtend.o \ - lib/libm.a \ - lib/small-data/crt0.o \ - lib/small-data/crtbegin.o \ - lib/small-data/crtend.o \ - lib/small-data/libm.a \ - lib/soft-float/libm.a \ - lib/baserel/crt0.o \ - lib/baserel/crtbegin.o \ - lib/baserel/crtend.o \ - lib/baserel/libm.a - -############################################################################## - -# Delete all object files and libraries -clean: - -$(DELETE) $(STARTUPS) lib small_data large_data large_data_softfloat baserel - -############################################################################## - -# Update the version numbers bound to the individual libraries -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 - cp c.lib_rev.rev profile.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 - bumprev 1 profile.lib - -############################################################################## - -# Tag all files with a certain version number -cvs-tag: - cvs -q tag V1_`cat c.lib_rev.rev` - -############################################################################## - -# This target first creates a directory to store the object files in, then -# proceeds to build the libraries from the code. It is invoked by the -# individual library build targets below. -all_libraries: $(TYPE) $(LIBS) - -############################################################################## - -# These create the required subdirectories to store object files and -# libraries in -lib: - -$(MAKEDIR) $@ - -lib/small-data: lib - -$(MAKEDIR) $@ - -lib/soft-float: lib - -$(MAKEDIR) $@ - -lib/baserel: lib - -$(MAKEDIR) $@ - -small_data: - -$(MAKEDIR) $@ - -large_data: - -$(MAKEDIR) $@ - -large_data_softfloat: - -$(MAKEDIR) $@ - -baserel: - -$(MAKEDIR) $@ - -############################################################################## - -# Dependencies for libm.a (large data variant with hardware floating point code -# support): this actually ends up building all the libraries rather than just -# libm.a -lib/libm.a: large_data large_data/libm.a - -large_data/libm.a: - $(MAKE) TYPE=large_data all_libraries - $(COPY) $(foreach file,$(LIBS),large_data/$(file)) lib - -############################################################################## - -# Dependencies for libm.a (large data variant with software floating point code -# support): this actually ends up building all the libraries rather than just -# libm.a -lib/soft-float/libm.a: large_data_softfloat large_data_softfloat/libm.a - -large_data_softfloat/libm.a: - $(MAKE) TYPE=large_data_softfloat all_libraries - $(COPY) $(foreach file,$(LIBS),large_data_softfloat/$(file)) lib/soft-float - -############################################################################## - -# Dependencies for libm.a (small data variant): this actually ends up building all -# the libraries rather than just libm.a -lib/small-data/libm.a: small_data small_data/libm.a - -small_data/libm.a: - $(MAKE) TYPE=small_data all_libraries - $(COPY) $(foreach file,$(LIBS),small_data/$(file)) lib/small-data - -############################################################################## - -# Dependencies for libm.a (baserel variant) - -lib/baserel/libm.a: baserel baserel/libm.a - -baserel/libm.a: - $(MAKE) TYPE=baserel all_libraries - $(COPY) $(foreach file,$(LIBS),baserel/$(file)) lib/baserel - -############################################################################## - -# Rules to build and move the startup code -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/small-data/crt0.o : lib small_data/crt0.o - $(COPY) small_data/crt0.o lib/small-data - -lib/small-data/crtbegin.o : lib small_data/crtbegin.o - $(COPY) small_data/crtbegin.o lib/small-data - -lib/small-data/crtend.o : lib small_data/crtend.o - $(COPY) small_data/crtend.o lib/small-data - -lib/baserel/crt0.o : lib baserel/crt0.o - $(COPY) baserel/crt0.o lib/baserel - -lib/baserel/crtbegin.o : lib baserel/crtbegin.o - $(COPY) baserel/crtbegin.o lib/baserel - -lib/baserel/crtend.o : lib baserel/crtend.o - $(COPY) baserel/crtend.o lib/baserel - -############################################################################## - -# Individual dependencies which tell make to build the object files from -# 'C' source files rather than the assembly language source files of the -# same name (e.g. stdlib_getsp.c instead of stdlib_getsp.asm). -$(LIBC_OBJS)/stdlib_getsp.o : stdlib_getsp.c - -$(LIBC_OBJS)/stdlib_swapstack.o : stdlib_swapstack.c - -$(LIBC_OBJS)/stdlib_setjmp.o : stdlib_setjmp.c - -############################################################################## - -# Build rules for version information that goes into each library -$(LIBC_OBJS)/c.lib_rev.o : c.lib_rev.c c.lib_rev.h - -$(LIBUNIX_OBJS)/unix.lib_rev.o : unix.lib_rev.c unix.lib_rev.h - -$(LIBM_OBJS)/m.lib_rev.o : m.lib_rev.c m.lib_rev.h - -$(LIBNET_OBJS)/net.lib_rev.o : net.lib_rev.c net.lib_rev.h - -$(LIBDEBUG_OBJS)/debug.lib_rev.o : debug.lib_rev.c debug.lib_rev.h - -$(LIBAMIGA_OBJS)/amiga.lib_rev.o : amiga.lib_rev.c amiga.lib_rev.h - -$(LIBPROFILE_OBJS)/profile.lib_rev.o : profile.lib_rev.c profile.lib_rev.h - -############################################################################## - -# Build rules for the debug version of the library which has special -# memory allocation debugging code, controlled by the contents of -# the stdlib_memory.h file. -$(LIBC_OBJS)/stdlib_alloca.o : stdlib_alloca.c stdlib_memory.h - -$(LIBC_OBJS)/stdlib_calloc.o : stdlib_calloc.c stdlib_memory.h - -$(LIBC_OBJS)/stdlib_free.o : stdlib_free.c stdlib_memory.h - -$(LIBC_OBJS)/stdlib_malloc.o : stdlib_malloc.c stdlib_memory.h - -$(LIBC_OBJS)/stdlib_realloc.o : stdlib_realloc.c stdlib_memory.h - -$(LIBC_OBJS)/stdlib_red_black.o : stdlib_red_black.c stdlib_memory.h - -############################################################################## - -# Peculiar build rules for the debug versions of memory allocation functions, -# or at least those which use memory allocation functionality. -$(LIBC_OBJS)/stdlib_alloca_debug.o : stdlib_alloca.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/stdlib_alloca_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_alloca.c - -$(LIBC_OBJS)/stdlib_calloc_debug.o : stdlib_calloc.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/stdlib_calloc_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_calloc.c - -$(LIBC_OBJS)/stdlib_free_debug.o : stdlib_free.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/stdlib_free_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_free.c - -$(LIBC_OBJS)/stdlib_malloc_debug.o : stdlib_malloc.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/stdlib_malloc_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_malloc.c - -$(LIBC_OBJS)/stdlib_realloc_debug.o : stdlib_realloc.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/stdlib_realloc_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_realloc.c - -$(LIBC_OBJS)/stdio_vasprintf_hook_entry_debug.o : stdio_vasprintf_hook_entry.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/stdio_vasprintf_hook_entry_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdio_vasprintf_hook_entry.c - -$(LIBC_OBJS)/stdio_vasprintf_debug.o : stdio_vasprintf.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/stdio_vasprintf_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdio_vasprintf.c - -$(LIBM_OBJS)/stdio_vasprintf_debug.o : stdio_vasprintf.c - @echo "Compiling $< [$(TYPE):m debug]" - @$(CC) -o $(LIBM_OBJS)/stdio_vasprintf_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG $(FLOAT_TYPE) stdio_vasprintf.c - -$(LIBC_OBJS)/string_strdup_debug.o : string_strdup.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/string_strdup_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG string_strdup.c - -$(LIBC_OBJS)/unistd_getcwd_debug.o : unistd_getcwd.c - @echo "Compiling $< [$(TYPE):c debug]" - @$(CC) -o $(LIBC_OBJS)/unistd_getcwd_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG unistd_getcwd.c - -$(LIBUNIX_OBJS)/unistd_getcwd_debug.o : unistd_getcwd.c - @echo "Compiling $< [$(TYPE):unix debug]" - @$(CC) -o $(LIBUNIX_OBJS)/unistd_getcwd_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG -DUNIX_PATH_SEMANTICS unistd_getcwd.c - -############################################################################## - -# Individual build rules for libc.a -$(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) $@ - -############################################################################## - -# Individual build rules for libunix.a -$(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) $@ - -############################################################################## - -# Individual build rules for libm.a -$(LIBM_OBJS) : - $(MAKEDIR) $@ - -$(LIBM_OBJS)/libm.a : $(LIBM_OBJS) $(foreach file,$(MATH_LIB),$(LIBM_OBJS)/$(file)) - -$(DELETE) $@ - @$(AR) $@ $(foreach file,$(MATH_LIB),$(LIBM_OBJS)/$(file)) - $(RANLIB) $@ - -############################################################################## - -# Individual build rules for libnet.a -$(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) $@ - -############################################################################## - -# Individual build rules for libdebug.a -$(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) $@ - -############################################################################## - -# Individual build rules for libamiga.a -$(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) $@ - -############################################################################## - -# Individual build rules for libprofile.a -$(LIBPROFILE_OBJS) : - $(MAKEDIR) $@ - -$(LIBPROFILE_OBJS)/libprofile.a : $(LIBPROFILE_OBJS) $(foreach file,$(PROFILE_LIB),$(LIBPROFILE_OBJS)/$(file)) - -$(DELETE) $@ - @$(AR) $@ $(foreach file,$(PROFILE_LIB),$(LIBPROFILE_OBJS)/$(file)) - $(RANLIB) $@ - -############################################################################## - -# Individual build rules for the startup code. -crt0.o : crt0.S - @echo "Assembling $<" - @$(CC) -Wa,-mregnames -o crt0.o -c crt0.S - -small_data/crt0.o : crt0.S - @echo "Assembling $<" - @$(CC) -DSMALL_DATA -Wa,-mregnames -o small_data/crt0.o -c crt0.S - -small_data/crtbegin.o : crtbegin.c - @echo "Assembling $<" - @$(CC) -o small_data/crtbegin.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -msdata=sysv -DSMALL_DATA crtbegin.c - -small_data/crtend.o : crtend.c - @echo "Assembling $<" - @$(CC) -o small_data/crtend.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -msdata=sysv -DSMALL_DATA crtend.c - -baserel/crt0.o : crt0.S - @echo "Assembling $<" - @$(CC) -Wa,-mregnames -o baserel/crt0.o -mbaserel -DBASEREL_DATA -c crt0.S - -baserel/crtbegin.o : crtbegin.c - @echo "Assembling $<" - @$(CC) -o baserel/crtbegin.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -mbaserel -DBASEREL_DATA crtbegin.c - -baserel/crtend.o : crtend.c - @echo "Assembling $<" - @$(CC) -o baserel/crtend.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -mbaserel -DBASEREL_DATA crtend.c - diff --git a/library/TODO b/library/TODO deleted file mode 100755 index 9650cc0..0000000 --- a/library/TODO +++ /dev/null @@ -1,19 +0,0 @@ -C99 math functions: - - (functions generally missing, including their "float" counterparts) - fma - fmaf - lrint - lrintf - lround - lroundf - nearbyint - nearbyintf - remquo - remquof - round - roundf - tgamma - tgammaf - trunc - truncf diff --git a/library/amiga.lib_rev.c b/library/amiga.lib_rev.c deleted file mode 100644 index 90bf4d2..0000000 --- a/library/amiga.lib_rev.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * $Id: amiga.lib_rev.c,v 1.2 2005-01-02 09:07:06 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; diff --git a/library/amiga.lib_rev.h b/library/amiga.lib_rev.h deleted file mode 100644 index 9fd2f33..0000000 --- a/library/amiga.lib_rev.h +++ /dev/null @@ -1,6 +0,0 @@ -#define VERSION 1 -#define REVISION 193 -#define DATE "4.6.2005" -#define VERS "amiga.lib 1.193" -#define VSTRING "amiga.lib 1.193 (4.6.2005)\r\n" -#define VERSTAG "\0$VER: amiga.lib 1.193 (4.6.2005)" diff --git a/library/amiga.lib_rev.rev b/library/amiga.lib_rev.rev deleted file mode 100644 index 2455a46..0000000 --- a/library/amiga.lib_rev.rev +++ /dev/null @@ -1 +0,0 @@ -193 diff --git a/library/amiga_acrypt.c b/library/amiga_acrypt.c deleted file mode 100644 index 71ff9a1..0000000 --- a/library/amiga_acrypt.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * $Id: amiga_acrypt.c,v 1.3 2005-05-30 14:01:20 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 ACrypt __ACrypt - -#include -#include -#include - -#undef ACrypt - -/****************************************************************************/ - -#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); -} diff --git a/library/amiga_addtof.c b/library/amiga_addtof.c deleted file mode 100644 index 48583eb..0000000 --- a/library/amiga_addtof.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * $Id: amiga_addtof.c,v 1.3 2005-02-25 10:14:20 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include -#include - -#include - -/****************************************************************************/ - -#include -#include -#include - -/****************************************************************************/ - -#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); -} diff --git a/library/amiga_argarraydone.c b/library/amiga_argarraydone.c deleted file mode 100644 index 1ea21f3..0000000 --- a/library/amiga_argarraydone.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * $Id: amiga_argarraydone.c,v 1.2 2005-01-02 09:07:06 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include - -#include - -/****************************************************************************/ - -#include -#include -#include - -/****************************************************************************/ - -#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; - } -} diff --git a/library/amiga_argarrayinit.c b/library/amiga_argarrayinit.c deleted file mode 100644 index e68f70a..0000000 --- a/library/amiga_argarrayinit.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * $Id: amiga_argarrayinit.c,v 1.2 2005-01-02 09:07:06 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include -#include -#include - -#include - -/****************************************************************************/ - -#include -#include -#include -#include -#include - -/****************************************************************************/ - -#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); -} diff --git a/library/amiga_argint.c b/library/amiga_argint.c deleted file mode 100644 index c615afd..0000000 --- a/library/amiga_argint.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * $Id: amiga_argint.c,v 1.2 2005-01-02 09:07:06 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include - -#include - -/****************************************************************************/ - -#include -#include -#include - -/****************************************************************************/ - -#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); -} diff --git a/library/amiga_argstring.c b/library/amiga_argstring.c deleted file mode 100644 index 5568817..0000000 --- a/library/amiga_argstring.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * $Id: amiga_argstring.c,v 1.2 2005-01-02 09:07:06 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include -#include -#include - -#include - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#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); -} diff --git a/library/amiga_beginio.c b/library/amiga_beginio.c deleted file mode 100644 index e2d631b..0000000 --- a/library/amiga_beginio.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * $Id: amiga_beginio.c,v 1.3 2005-01-02 09:07:06 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include -#include - -/****************************************************************************/ - -#include "debug.h" - -/****************************************************************************/ - -#ifndef __PPC__ - -/****************************************************************************/ - -#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__ */ - -/****************************************************************************/ - -VOID -BeginIO(struct IORequest *ior) -{ - struct Device * DeviceBase; - - ENTER(); - - assert( ior != NULL && ior->io_Device != NULL ); - - DeviceBase = ior->io_Device; - __begin_io(ior); - - LEAVE(); -} - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -#if defined(BeginIO) -#undef BeginIO -#endif /* BeginIO */ - -/****************************************************************************/ - -VOID -BeginIO(struct IORequest *ior) -{ - ENTER(); - - assert( ior != NULL && ior->io_Device != NULL ); - - IExec->BeginIO(ior); - - LEAVE(); -} - -/****************************************************************************/ - -#endif /* __PPC__ */ diff --git a/library/amiga_callhook.c b/library/amiga_callhook.c deleted file mode 100644 index bde5e54..0000000 --- a/library/amiga_callhook.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * $Id: amiga_callhook.c,v 1.2 2005-01-02 09:07:06 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -#include - -/****************************************************************************/ - -#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__ */ diff --git a/library/amiga_callhooka.asm b/library/amiga_callhooka.asm deleted file mode 100644 index fe3aca7..0000000 --- a/library/amiga_callhooka.asm +++ /dev/null @@ -1,80 +0,0 @@ -* -* $Id: amiga_callhooka.asm,v 1.2 2005-01-02 09:07:06 obarthel Exp $ -* -* :ts=8 -* -* Portable ISO 'C' (1994) runtime library for the Amiga computer -* Copyright (c) 2002-2005 by Olaf Barthel -* 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 diff --git a/library/amiga_callhooka.c b/library/amiga_callhooka.c deleted file mode 100644 index 4314dad..0000000 --- a/library/amiga_callhooka.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * $Id: amiga_callhooka.c,v 1.2 2005-01-02 09:07:06 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__ */ diff --git a/library/amiga_coercemethod.c b/library/amiga_coercemethod.c deleted file mode 100644 index aebdec2..0000000 --- a/library/amiga_coercemethod.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * $Id: amiga_coercemethod.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include - -#include - -/****************************************************************************/ - -#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__ */ diff --git a/library/amiga_createextio.c b/library/amiga_createextio.c deleted file mode 100644 index 42f0da8..0000000 --- a/library/amiga_createextio.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * $Id: amiga_createextio.c,v 1.3 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#include "debug.h" - -/****************************************************************************/ - -#if defined(CreateExtIO) -#undef CreateExtIO -#endif /* CreateExtIO */ - -/****************************************************************************/ - -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); -} diff --git a/library/amiga_createport.c b/library/amiga_createport.c deleted file mode 100644 index db9c1d6..0000000 --- a/library/amiga_createport.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: amiga_createport.c,v 1.3 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#include "debug.h" - -/****************************************************************************/ - -#if defined(CreatePort) -#undef CreatePort -#endif /* CreatePort */ - -/****************************************************************************/ - -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); -} diff --git a/library/amiga_createstdio.c b/library/amiga_createstdio.c deleted file mode 100644 index 9002a04..0000000 --- a/library/amiga_createstdio.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * $Id: amiga_createstdio.c,v 1.3 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#include "debug.h" - -/****************************************************************************/ - -#if defined(CreateStdIO) -#undef CreateStdIO -#endif /* CreateStdIO */ - -/****************************************************************************/ - -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); -} diff --git a/library/amiga_createtask.c b/library/amiga_createtask.c deleted file mode 100644 index 3a9d860..0000000 --- a/library/amiga_createtask.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * $Id: amiga_createtask.c,v 1.4 2005-03-18 12:38:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include -#include - -#include - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_H */ - -/****************************************************************************/ - -#include "macros.h" -#include "debug.h" - -/****************************************************************************/ - -#ifndef __PPC__ - -/****************************************************************************/ - -/* - * 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); -} - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#if defined(CreateTask) -#undef CreateTask -#endif /* CreateTask */ - -/****************************************************************************/ - -struct Task * -CreateTask(CONST_STRPTR name,LONG pri,CONST APTR init_pc,ULONG stack_size) -{ - struct Task * 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; - } - - result = IExec->CreateTask(name,pri,init_pc,stack_size,NULL); - - out: - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* __PPC__ */ diff --git a/library/amiga_deleteextio.c b/library/amiga_deleteextio.c deleted file mode 100644 index f80e3b4..0000000 --- a/library/amiga_deleteextio.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * $Id: amiga_deleteextio.c,v 1.3 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#include "debug.h" - -/****************************************************************************/ - -#if defined(DeleteExtIO) -#undef DeleteExtIO -#endif /* DeleteExtIO */ - -/****************************************************************************/ - -VOID -DeleteExtIO(struct IORequest * io) -{ - assert(io != NULL); - - if(io != NULL) - DeleteIORequest((struct IORequest *)io); -} diff --git a/library/amiga_deleteport.c b/library/amiga_deleteport.c deleted file mode 100644 index 6d61281..0000000 --- a/library/amiga_deleteport.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * $Id: amiga_deleteport.c,v 1.3 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#include "debug.h" - -/****************************************************************************/ - -#if defined(DeletePort) -#undef DeletePort -#endif /* DeletePort */ - -/****************************************************************************/ - -VOID -DeletePort(struct MsgPort * port) -{ - assert( port != NULL ); - - if(port->mp_Node.ln_Name != NULL) - RemPort(port); - - DeleteMsgPort(port); -} diff --git a/library/amiga_deletestdio.c b/library/amiga_deletestdio.c deleted file mode 100644 index ecd621f..0000000 --- a/library/amiga_deletestdio.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * $Id: amiga_deletestdio.c,v 1.3 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#include "debug.h" - -/****************************************************************************/ - -#if defined(DeleteStdIO) -#undef DeleteStdIO -#endif /* DeleteStdIO */ - -/****************************************************************************/ - -VOID -DeleteStdIO(struct IOStdReq * io) -{ - if(io != NULL) - DeleteIORequest((struct IORequest *)io); -} diff --git a/library/amiga_deletetask.c b/library/amiga_deletetask.c deleted file mode 100644 index 0fa6081..0000000 --- a/library/amiga_deletetask.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * $Id: amiga_deletetask.c,v 1.3 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#ifndef __PPC__ - -/****************************************************************************/ - -VOID -DeleteTask(struct Task *tc) -{ - RemTask(tc); -} - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#if defined(DeleteTask) -#undef DeleteTask -#endif /* DeleteTask */ - -/****************************************************************************/ - -VOID -DeleteTask(struct Task *tc) -{ - IExec->DeleteTask(tc); -} - -/****************************************************************************/ - -#endif /* __PPC__ */ diff --git a/library/amiga_domethod.c b/library/amiga_domethod.c deleted file mode 100644 index 4877eac..0000000 --- a/library/amiga_domethod.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * $Id: amiga_domethod.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include - -#include - -/****************************************************************************/ - -#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__ */ diff --git a/library/amiga_dosupermethod.c b/library/amiga_dosupermethod.c deleted file mode 100644 index 276127c..0000000 --- a/library/amiga_dosupermethod.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * $Id: amiga_dosupermethod.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include - -#include - -/****************************************************************************/ - -#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__ */ diff --git a/library/amiga_dotimer.c b/library/amiga_dotimer.c deleted file mode 100644 index 75ab5d4..0000000 --- a/library/amiga_dotimer.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * $Id: amiga_dotimer.c,v 1.4 2005-03-18 12:38:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -#include - -#include - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_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 ); - - #if defined(__amigaos4__) - { - mp = AllocSysObjectTags(ASOT_PORT, - ASOPORT_Action, PA_SIGNAL, - ASOPORT_Signal, SIGB_SINGLE, - ASOPORT_Target, FindTask(NULL), - TAG_DONE); - - if(mp == NULL) - { - error = IOERR_OPENFAIL; - goto out; - } - } - #else - { - 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); - } - #endif /* __amigaos4__ */ - - 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); - } - - #if defined(__amigaos4__) - { - if(mp != NULL) - FreeSysObject(ASOT_PORT,mp); - } - #else - { - FreeVec(mp); - } - #endif /* __amigaos4__ */ - - return(error); -} diff --git a/library/amiga_fastrand.c b/library/amiga_fastrand.c deleted file mode 100644 index 2a2aef4..0000000 --- a/library/amiga_fastrand.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: amiga_fastrand.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -ULONG -FastRand(ULONG seed) -{ - ULONG value; - - value = seed + seed; - if(value < seed) - value ^= 0x1D872B41; - - return(value); -} diff --git a/library/amiga_freeievents.c b/library/amiga_freeievents.c deleted file mode 100644 index e761412..0000000 --- a/library/amiga_freeievents.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * $Id: amiga_freeievents.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -#include - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#include "debug.h" - -/****************************************************************************/ - -VOID -FreeIEvents(struct InputEvent * ie) -{ - struct InputEvent * next; - - while(ie != NULL) - { - next = ie->ie_NextEvent; - - FreeVec(ie); - - ie = next; - } -} diff --git a/library/amiga_hookentry.asm b/library/amiga_hookentry.asm deleted file mode 100644 index 588045b..0000000 --- a/library/amiga_hookentry.asm +++ /dev/null @@ -1,51 +0,0 @@ -* -* $Id: amiga_hookentry.asm,v 1.2 2005-01-02 09:07:07 obarthel Exp $ -* -* :ts=8 -* -* Portable ISO 'C' (1994) runtime library for the Amiga computer -* Copyright (c) 2002-2005 by Olaf Barthel -* 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 diff --git a/library/amiga_hookentry.c b/library/amiga_hookentry.c deleted file mode 100644 index fd2f2fd..0000000 --- a/library/amiga_hookentry.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * $Id: amiga_hookentry.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__ */ diff --git a/library/amiga_hotkey.c b/library/amiga_hotkey.c deleted file mode 100644 index c33ef50..0000000 --- a/library/amiga_hotkey.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * $Id: amiga_hotkey.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -#include - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#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); -} diff --git a/library/amiga_invertstring.c b/library/amiga_invertstring.c deleted file mode 100644 index fcd9868..0000000 --- a/library/amiga_invertstring.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * $Id: amiga_invertstring.c,v 1.3 2005-02-25 10:14:20 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include -#include - -#include - -/****************************************************************************/ - -#include -#include -#include - -/****************************************************************************/ - -#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); -} diff --git a/library/amiga_newlist.c b/library/amiga_newlist.c deleted file mode 100644 index e0681c8..0000000 --- a/library/amiga_newlist.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * $Id: amiga_newlist.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -#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(); -} diff --git a/library/amiga_rangerand.c b/library/amiga_rangerand.c deleted file mode 100644 index 158e2f7..0000000 --- a/library/amiga_rangerand.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * $Id: amiga_rangerand.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -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); -} diff --git a/library/amiga_remtof.c b/library/amiga_remtof.c deleted file mode 100644 index 228b6bf..0000000 --- a/library/amiga_remtof.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * $Id: amiga_remtof.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include -#include - -#include - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#include "debug.h" - -/****************************************************************************/ - -VOID -RemTOF(struct Isrvstr *i) -{ - assert( i != NULL ); - - RemIntServer(INTB_VERTB,(struct Interrupt *)i); -} diff --git a/library/amiga_rexxvars.c b/library/amiga_rexxvars.c deleted file mode 100644 index 9781946..0000000 --- a/library/amiga_rexxvars.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * $Id: amiga_rexxvars.c,v 1.6 2005-03-18 12:38:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -/* We don't want to pull in */ -#define CLIB_ALIB_PROTOS_H - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#define __NOLIBBASE__ -#include - -/****************************************************************************/ - -static struct Library * RexxSysBase; - -/****************************************************************************/ - -#if defined(__amigaos4__) -static struct RexxSysIFace * IRexxSys; -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -CLIB_CONSTRUCTOR(rexxvars_init) -{ - ENTER(); - - RexxSysBase = OpenLibrary(RXSNAME,0); - - #if defined(__amigaos4__) - { - if(RexxSysBase != NULL) - { - IRexxSys = (struct RexxSysIFace *)GetInterface(RexxSysBase, "main", 1, 0); - if(IRexxSys == NULL) - { - CloseLibrary(RexxSysBase); - RexxSysBase = NULL; - } - } - } - #endif /* __amigaos4__ */ - - LEAVE(); - - CONSTRUCTOR_SUCCEED(); -} - -/****************************************************************************/ - -CLIB_DESTRUCTOR(rexxvars_exit) -{ - ENTER(); - - #if defined(__amigaos4__) - { - if(IRexxSys != NULL) - DropInterface((struct Interface *)IRexxSys); - - IRexxSys = NULL; - } - #endif /* __amigaos4__ */ - - if(RexxSysBase != NULL) - { - CloseLibrary(RexxSysBase); - RexxSysBase = NULL; - } - - LEAVE(); -} - -/****************************************************************************/ - -/* This is modeled after the original assembly language code. Except for the - fact that we compare the library base against a local, static variable - rather then opening the library for each check. */ -BOOL -CheckRexxMsg(struct RexxMsg *message) -{ - BOOL result = FALSE; - - if(RexxSysBase == NULL) - goto out; - - if(message->rm_LibBase != RexxSysBase) - goto out; - - if(message->rm_TaskBlock == NULL) - goto out; - - if(NOT IsRexxMsg(message)) - goto out; - - result = TRUE; - - out: - - return(result); -} - -/****************************************************************************/ - -/* The following function works in about like the original, except that it's - not reentrant, does not fill in a pointer to the variable itself and - requires rexxsyslib.library V45. */ -LONG -GetRexxVar(struct RexxMsg *message,STRPTR variable_name,STRPTR *buffer_pointer) -{ - static UBYTE buffer[256]; - LONG result; - - /* The following uses a function which was added to rexxsyslib.library V45. - We therefore have a minimum library version requirement. */ - if(RexxSysBase == NULL || RexxSysBase->lib_Version < 45 || NOT IsRexxMsg(message)) - { - result = ERR10_010; /* invalid message packet */ - goto out; - } - - /* The 256 character limit isn't good. This should be done differently. */ - result = GetRexxVarFromMsg(variable_name,buffer,message); - if(result != 0) - goto out; - - (*buffer_pointer) = buffer; - - out: - - return(result); -} - -/****************************************************************************/ - -/* The following function works in about like the original, except that it - ignores the length parameter (the value needs to be a NUL-terminated string) - and requires rexxsyslib.library V45. */ -LONG -SetRexxVar(struct RexxMsg *message,STRPTR variable_name,STRPTR value,ULONG length) -{ - LONG result; - - /* The following uses a function which was added to rexxsyslib.library V45. - We therefore have a minimum library version requirement. */ - if(RexxSysBase == NULL || RexxSysBase->lib_Version < 45 || NOT IsRexxMsg(message)) - { - result = ERR10_010; /* invalid message packet */ - goto out; - } - - result = SetRexxVarFromMsg(variable_name,value,message); - - out: - - return(result); -} diff --git a/library/amiga_setsuperattrs.c b/library/amiga_setsuperattrs.c deleted file mode 100644 index cc59aed..0000000 --- a/library/amiga_setsuperattrs.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Id: amiga_setsuperattrs.c,v 1.4 2005-02-25 10:14:20 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include - -#include - -/****************************************************************************/ - -#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__ */ diff --git a/library/amiga_timedelay.c b/library/amiga_timedelay.c deleted file mode 100644 index 5918d2e..0000000 --- a/library/amiga_timedelay.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * $Id: amiga_timedelay.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -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); -} diff --git a/library/amiga_waitbeam.c b/library/amiga_waitbeam.c deleted file mode 100644 index 4167be1..0000000 --- a/library/amiga_waitbeam.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * $Id: amiga_waitbeam.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include -#include - -#include - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#include "debug.h" - -/****************************************************************************/ - -#define DO_NOTHING ((void)0) - -/****************************************************************************/ - -VOID -waitbeam(LONG position) -{ - while(position > VBeamPos()) - DO_NOTHING; -} diff --git a/library/build_archive_amiga b/library/build_archive_amiga deleted file mode 100755 index 0dfde7e..0000000 --- a/library/build_archive_amiga +++ /dev/null @@ -1,31 +0,0 @@ -; Simple release archive build script for Amiga systems. - -; Set the name of the archive and the directory the -; files go into -set dir_name clib2-1.`type c.lib_rev.rev` - -; Start with a clean slate -delete all quiet ram:$dir_name - -; Create the directory, copy all the libraries, header files -; and release note files inside. -makedir ram:$dir_name -copy lib ram:${dir_name}/lib all clone quiet -copy include ram:${dir_name}/include all clone quiet -copy changes ram:$dir_name clone - -; Delete the CVS data from the include directory -delete ram:${dir_name}/include/CVS ram:${dir_name}/include/sys/CVS all quiet - -; Finally, create an lha archive in RAM: -pushcd ram: -lha -r -x -a a ${dir_name}-gcc-68k.lha ${dir_name} -popcd - -; Move the archive back to this directory -copy ram:${dir_name}-gcc-68k.lha "" clone - -; Clean up... -delete ram:$dir_name all quiet -unset dir_name - diff --git a/library/build_archive_unix.sh b/library/build_archive_unix.sh deleted file mode 100755 index d6e4e8e..0000000 --- a/library/build_archive_unix.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -# Simple release archive build script for Unix systems. -# I typically build the library with a cross compiler. - -# Set the name of the archive and the directory the -# files go into -export dir_name=clib2-1.`cat c.lib_rev.rev` - -# Start with a clean slate -rm -rf $dir_name - -# Create the directory, copy all the libraries, header files -# and release note files inside. -mkdir $dir_name -cp -a lib $dir_name -cp -a lib.threadsafe $dir_name -cp -a include $dir_name -cp changes $dir_name - -# Delete the CVS data from the include directory -rm -rf ${dir_name}/include/CVS ${dir_name}/include/sys/CVS - -# Finally, create an lha type 5 archive; the Amiga LhA port -# can unpack it. -lha ao5q ${dir_name}-gcc-os4.lha ${dir_name} - diff --git a/library/c.lib_rev.c b/library/c.lib_rev.c deleted file mode 100644 index 8361ca7..0000000 --- a/library/c.lib_rev.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * $Id: c.lib_rev.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; diff --git a/library/c.lib_rev.h b/library/c.lib_rev.h deleted file mode 100644 index 8f73686..0000000 --- a/library/c.lib_rev.h +++ /dev/null @@ -1,6 +0,0 @@ -#define VERSION 1 -#define REVISION 193 -#define DATE "4.6.2005" -#define VERS "c.lib 1.193" -#define VSTRING "c.lib 1.193 (4.6.2005)\r\n" -#define VERSTAG "\0$VER: c.lib 1.193 (4.6.2005)" diff --git a/library/c.lib_rev.rev b/library/c.lib_rev.rev deleted file mode 100644 index 2455a46..0000000 --- a/library/c.lib_rev.rev +++ /dev/null @@ -1 +0,0 @@ -193 diff --git a/library/changes b/library/changes deleted file mode 100644 index 42679d0..0000000 --- a/library/changes +++ /dev/null @@ -1,4067 +0,0 @@ -- Added getopt_long to libunix.a - -- Added new libprofile.a which implements gprof gmon.out output - -- Added the function profil() to libc.a - -- Added ftello() and fseeko() which both merely call the equivalent (at - least for clib2) ftell() and fseek() functions, respectively. - -- statfs() never stated that a disk was mounted for read-only access - because the wrong InfoData structure member was tested. Fixed. - -- lstat would overwrite the name parameter via ReadLink(..., name, ...) - instead of ReadLink(..., new_name, ...) - -- Implemented exp2()/exp2f() and log2()/log2f() as suggested by - Henning Nielsen Lund. Thank you very much! - -- The pattern matching code which expands command line arguments, as part - of libunix.a, now translates the "*" wildcard into "#?" unless you prefix - it with a backtick ("`"), which is the wildcard pattern escape character - used on AmigaOS. - -- Repaired the pattern matching code which expands command line arguments: - it no longer requires that any parameters are quoted and it is automatically - enabled if you link against libunix.a, without libc.a standing a chance to - accidentally override it. - -- Fixed a bug in vfprintf that would surface when the buffer was enlarged - if the pattern was too large to fit the static internal buffer - -- Added file system names to statfx - -- Moved all the constructor code out of "stdlib_init_exit.c" and into the - files which initialize global data, such as the new "stdlib_program_name.c" - and "stdlib_malloc.c". - -- Until I can find a way to invoke it from within the library, the - __machine_test() function is no longer invoked. - -- Tagged global data with NOCOMMON attributes. - -- Added the __lib_init() and __lib_exit() functions, which are part of the - thread-safe library and which can be used to hook up clib2 with standard - Amiga shared library/device code. Some documentation on how to use them - can be found in the header file. - - -c.lib 1.193 (4.6.2005) - -- fpclassify() now returns FP_ZERO both for 0 and -0. - -- nan() and nanf() now return quiet NaNs. - -- Added internal __inf() and __inff() functions. - -- strtof() now calls nanf() and __inff(), respectively, to produce - the special floating point values for nan/inf/infinity. - -- strtod() now calls nan() and __inf(), respectively, to produce - the special floating point values for nan/inf/infinity. - -- The scanf() family now calls nan() and __inf(), respectively, to - produce the special floating point values for nan/inf/infinity. - -- Added %D, %e, %F, %g, %G and %h for strftime(); repaired %I. - -- Documented __strip_double_slash() and plugged in a memmove() - in place of the copying loop. - -- Modified __translate_unix_to_amiga_path_name() and - __translate_amiga_to_unix_path_name() to not to call strlen() - on the results of __strip_double_slash(). - -- For %C strtime() should return the century number, not the - year number mod 100. - -- The record locking code in fcntl() is no longer part of the - regular libc.a, but only of libunix.a. - -- Changed the definition of the D_S() macro to cast the pointer - address to an unsigned 32 bit integer. - -- Modified the locale-aware isalnum(), isalpha(), iscntrl(), - isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), - isupper(), isxdigit(), tolower() and toupper() functions - to clamp the input parameter to the "unsigned char" range before - it is submitted to the respective locale.library function. This - should be in sync with what the specs demand, which state that - if the input parameter is neither EOF nor in the range of an - "unsigned char" variable, then the results are undefined. - -- ungetc() now returns the input character, clamped to an unsigned - char value, upon success. Previously, if the input parameter was - negative and not EOF, the result was identical to the input, which - could have had negative side-effects. - -- Added NAN, INFINITY, FLT_EVAL_METHOD, float_t and double_t to - (C99). - -- Added skeleton code for acosf(), acosh(), acoshf(), asinf(), asinh(), - asinhf(), atan2f(), atanf(), atanh(), atanhf(), cbrt(), cbrtf(), - ceilf(), cosf(), coshf(), erf(), erfc(), erfcf(), erff(), - exp2(), exp2f(), expf(), expm1(), expm1f(), fdim(), fdimf(), - floorf(), fma(), fmaf(), fmax(), fmaxf(), fmin(), fminf(), - fmodf(), frexpf(), hypotf(), ilogb(), ilogbf(), ldexpf(), lgamma(), - lgammaf(), log10f(), log1p(), log1pf(), log2(), log2f(), logbf(), - logf(), lrint(), lrintf(), lround(), lroundf(), modff(), nearbyint(), - nearbyintf(), powf(), remainder(), remainderf(), remquo(), remquof(), round(), - roundf(), scalbn(), scalbnf(), sinf(), sinhf(), sqrtf(), tanf(), - tanhf(), tgamma(), tgammaf(), trunc() and truncf(), to be filled in - later... - -- Implemented fmin()/fminf(), fmax()/fmaxf(), fdim()/fdimf() for C99. - -- Ported acosf(), asinf(), atan2f(), atanf(), ceilf(), expf(), floorf(), - fmodf(), frexpf(), ldexpf(), log10f(), logbf(), logf(), modff(), powf(), sqrtf(), - scalbn() and scalbnf() for C99. - -- Ported cbrt(), cbrtf(), erf(), erff(), erfc(), erfcf(), expm1(), - expm1f(), ilogb(), ilogbf(), log1p() and log1pf() for C99. - -- Ported cosf(), coshf(), sinf(), sinhf(), tanf(), tanhf() - and hypotf() for C99. - -- Ported acosh(), acoshf(), asinh(), asinhf(), lgamma(), lgammaf(), - remainder() and remainderf() for C99. - -- The scanf() family now supports character ranges for the %[ - conversion. Note that this is a non-standard feature! - -- Integrated Peter Bengtsson's termios code. Thank you very much! I chose - to add it to libunix.a rather than keeping it in a separate libtermios.a - library. - - -c.lib 1.192 (12.5.2005) - -- Changed how errors are detected, as returned by Write(), Read() and - Seek(). Seek() is particularly challenging because the value it - returns might be a valid file position and not an error. - -- Replaced numeric function return codes of 0 and -1 with macros OK, - SEEK_ERROR/ERROR to clarify the respective purposes. - -- Changed how ftell() and fseek() are used, double-checking the return - value and the errno code. - -- The record locking semaphore could wind up getting added to the public - list twice. Fixed. - -- Fixed two linker errors which were caused by duplicate symbol definitions. - -- Added code to the startup routine which allows you to monitor where a command - was started from and which parameters it was invoked with. - -- If fread()/fwrite() fail to read/write any data because either the number - of records or the size of each record is zero, both now call clearerr() to - avoid giving the caller the wrong impression that an EOF or error occured. - -- The libunix.a flavour of system() no longer attempts to translate the name - of a command unless it contains path separator characters. - -- Added strtof(), llabs(), lldiv(), vsscanf() and vscanf() for C99. - -- strftime() now supports %C, %n, %r, %R, %t, %T, %u, %V, and %z for C99. - And it ignores the E and O modifiers. - -- The printf() family now supports the %hh, %j, %t and %z modifiers and the - %a/%A conversions for C99. The %j is treated like %ll; %t and %z are treated - like %l. Also, the "infinity"/"not a number" signals now come out as the - strings "inf" and "nan". - -- Added HUGE_VALF to . - -- For the printf() "%a" conversion the exponent now comes out as a binary - number rather than a decimal one. Now how odd is that? - -- strtod() and strtof() now support "inf"/"infinity"/"nan"/"nan(..)" and - hexadecimal floating point numbers, for C99. - -- Added the fpclassify(), isfinite(), isnormal() and signbit() macros for C99. - -- Reimplemented isnan() and isinf() as macros for C99. The corresponding - functions will be dropped from the library. Note that the isinf() macro - does not return -1, 0 or 1 like the old function did, but only 0 or 1 - depending upon whether the parameter represents +/- infinity or not. - -- Added fabsf() for C99. - -- The scanf() family now supports the %hh, %j, %t and %z modifiers and the - %a/%A conversions for C99. The %j is treated like %ll; %t and %z are treated - like %l. Also, the "inf"/"infinity"/"nan"/"nan()" keywords are processed. - -- The strftime() %z conversion now prints the time zone difference as a - "decimal" number. That is, if the difference is 5 hours and 30 minutes, - then %z will now print "530" rather than "330". - -- mktime() now handles one leap second gracefully. - -- Added isblank(). - -- Added isunordered(), isgreater(), isgreaterequal(), isless(), - islessequal() and islessgreater() to for C99. - -- The wchar_t type is now an 'unsigned short' integer (16 bits wide). - -- Added PTRDIFF_MIN/PTRDIFF_MAX, WCHAR_MIN/WCHAR_MAX and - WINT_MIN/WINT_MAX to for C99. - -- Added imaxdiv() and imaxabs() for C99. - -- Added strtoimax() and strtoumax() for C99. - -- Added nextafter() and nextafterf() for C99. - -- Added copysign() and copysignf() for C99. - -- Unless I missed something, clib2 should now be functionally complete - with regard to C99, except for the floating point operations covered. - These are a major challenge all by themselves, and I wonder both - whether they are worth the effort and how one could implement them - correctly. - -- fflush() now consistently supports a NULL parameter, causing all - streams to be flushed for which this behaviour is defined. - -- The printf() family can now produce output for floating point - numbers with more than about 77 characters, provided sufficient - memory is available. C99 calls for a minimum of 4095 characters, - but we're trying to allocate the space required dynamically. - - -c.lib 1.191 (9.4.2005) - -- The name of the public record locking semaphore has to be preallocated - for OS4 if the AllocSysObject() function is used to create it. - -- Moved the signal block mask and the signal function table out of - signal_data.c and into signal_raise.c where they are actually used. - This makes it possible to override the default definition of the - __check_abort_enabled variable in your own programs. - -- raise() no longer resets the signal handler before it invokes the one - currently configured. It merely blocks the delivery of the respective - signal to prevent recursion. - -- raise() now drops into abort() if a signal handler is set to - SIG_DFL. The exception is in SIGINT delivery, which has the - effect of printing a different termination message but otherwise - program flow takes the same path as abort(). - -- Moved the __UtilityBase/__IUtility variable declarations into - a separate file. - -- Simplified the library/open close code in "stdlib_main.c". - -- File descriptors produced by dup() or dup2() now work exactly like - the original file descriptors they are duplicates of. I modified the - function which maps file descriptor numbers to file descriptor - table entries to return the table entries of the original files. - -- In the thread-safe library, duplicated stdin/stdout/stderr - descriptors now work like the "real" ones. This is true even if - the "real" ones were closed and only their former aliases remain. - -- Invoking fstat() on what maps to a con-handler stream now produces - information identifying it as a character special file. - -- Added more code and changes contributed by Peter Bengtsson, thank you - very much! This includes the following: - - - Added SSIZE_MAX to . - - - Added , readv() and writev(). - - - Cut back the soft link resolution code in lstat(). - - - In O_NDELAY is now an alias for O_NONBLOCK. - - - Added , carg(), cargf(), cargl(), cimag(), cimagf(), - cimagl(), conj(), conjf(), conjl(), creal(), crealf() and creall(). - - Note that the C99 support for the complex floating point data - types is limited to GCC 3.x for now. - -- Added va_copy() to . - -- Added _Exit() to . - -- Added . - -- Added vfscanf() to . - -- The stdio locking in fcntl() wasn't working correctly. Fixed. - -- Made the clearerr(), feof() and ferror() macros thread-safe. - - -c.lib 1.190 (25.3.2005) - -- DoTimer() now calls AllocSysObject() rather than making up - a MsgPort locally. - -- The record locking semaphore code now builds a semaphore to add - before it tries to find the public one in memory. That way, the - code can spend less time in Forbid() state and, heaven forbid, - refrain from allocating memory while in that state. - -- Split the general stdio initialization/cleanup code from the - initialization of the stdin/stdout/stderr streams. - -- Moved the Workbench console stream initialization into the - initialization code for the stdin/stdout/stderr streams and - out of the program parameter setup. - -- The current program name is now set up in the stdlib - initialization function. - -- Simplified the machine test code; moved the FPU check into - the math initialization code. - -- Added more safety checks to verify that file descriptor - file handles are valid. - -- Made the file descriptor checks in the fsync() and fdatasync() - functions more robust. - -- Cleaned up the 68k build makefile, so that the CPU and FPU - tests and the error message display can run safely even - on plain 68000 machines. This won't work for the 32 bit small - data model, which implies 68020 code, but so there... - -- Moved the CPU/FPU type tests into the respective linker - libraries. - -- Moved the data declarations out of math_data.c, stat_data.c, - socket_data.c, dirent_data.c and stdio_data.c and into the - code that initializes them. - -- Moved a few __delete_semaphore() calls into conditional compilation - sections where they should have been in the first place. - -- Thanks to Jörg Strohmayer, the GCC library build now manages to - invoke the library's constructor/destructor functions in a - very particular order. That way, you can use constructor/destructor - functions in your own code and not have them clash with the library's - own functions. - -- Reimplemented the constructor/destructor invocation code for GCC. - Both the 68k and PowerPC platform now invoke them in the same order - and the 68k code uses the designated invocation priorities. The - PowerPC destructor function now sets up the exit() jmp_buf before - the destructor functions are called. - -- Added S_IREAD, S_IWRITE and S_IEXEC aliases to . - -- Moved data out of stdlib_data.c and into the code that references - or initializes it. - -- The stdlib constructor now performs the CPU/FPU compatibility test. - -- Introduced new constructor types and changed the overall priority - order. - -- Switched over the startup code and the library itself to use - constructor/destructor functions for initialization and cleanup - purposes. - -- The destructor function invocation code no longer calls - setjmp(). This is now done within stdlib_main.c prior to - calling the destructor function invocation code. - -- Fixed the SAS/C destructor function prototypes and verified - that the constructors/destructors are called in the proper - order, too. - -- Aliases of file descriptors are now using the signal semaphore - of the original file descriptor. - -- close() did not return 0 if the file descriptor in question - was really just an alias. Fixed. - -- Added a feature which makes it possible to have several clients - use the standard I/O streams (stdin/stdout/stderr) and have these - referring to their process' Input()/Output()/ErrorOutput() - streams. This is intended to support the upcoming shared - library feature. - -- Turns out that the 68k GCC port does not sort constructor and - destructor functions in any way at all. I reimplemented the - entire library constructor/destructor functionality to use the - same approach as libnix. - -- ftruncate() ended up changing the current file position, contrary - to what it is supposed to do. Fixed. - -- fcntl() did not work for sockets. Fixed. - -- Reorganized the local header files, removing redundancies. - -- Dropped unused stub code which is now redundant because of - the constructor/destructor mechanism. - -- Moved the call chain printing out of stdlib_main.c and into - separate files. - -- Removed some more redundant data from stdlib_main.c. - -- Added the first "real" C99 function: _Exit() ;-) - -- assertion failures early on during program initialization - should no longer spell big trouble on account of the stdio - data structures possibly not being in a well-defined and - initialized state. - -- Turns out that the constructor/destructor calling sequence - was still wrongish for the OS4 library. So I had to change - it *again*. Which probably means that the 68k library will - need further changes... - -- Moved stdlib_main.o into the regular libc.a, at least for - the 68k build. The PowerPC build may follow later, provided - I manage to get the specs file fixed. Actually, stdlib_main.o - is in the libc.a library already. Now about that specs file... - -- Moved the check for the presence of an FPU into the - math_init.c code. I am far from certain whether this will - have the desired effect, though. Due to how the GNU ld linker - works, libraries are scanned once only. And the FPU check will - be pulled in only if something references the HUGE_VAL - constant. - -- Activated the dormant thread-safe standard input/output/error - handling code. - -- Small fixes to fcntl() and select() to cover the thread-safe - fd->fd_DefaultFile == ZERO case. - - -c.lib 1.189 (5.3.2005) - -- Rewrote the __translate_unix_to_amiga_path_name() function to - translate patterns such as "foo/bar/../../baz" properly, and to - use strlen() a lot less. - -- Major, major changes! Moved most of the monolithic code out of - the file descriptor hook and into the respective functions, - such as dup2(), fchmod(), fchown(), fcntl(), fdatasync(), fstatfs(), - fsync(), ftruncate() and lseek(). Code which is not strictly - required will no longer find its way into your programs if you - link with the updated library. - - NOTE: these changes require that the entire library is rebuilt! - -- The buffered and unbuffered file hook code is now invoked through - function pointers alone. The utility.library/CallHookPkt mechanism - is no longer required. - -- Moved the entire lseek() code relevant for files into the hook - function. - -- Simplified the close() function which now just calls into the - hook code to perform whatever is necessary. The hook code is - responsible for cleaning up after aliases, etc. This change in - turn made it possible to greatly simplify the hook code for - buffered files which now bypasses close/read/write/lseek and - directly invokes the hook code for unbuffered files. - -- Added various floating point constants to , courtesy - of Henning Nielsen Lund. Thank you very much! - -- When using the wildcard expansion code for command line - parameters (which is by default linked in with libunix.a), - regular expressions can no longer prompt dos.library requesters - to appear. However, to be on the safe side, if you are expecting - to pass regular expressions on the command line, do not use - the wildcard expansion code such as by overriding the library - symbols with dummy functions such as are used in the file - "stdlib_wildcard_expand.c". - -- Added a new variable '__open_locale' which can be used to - restrict all library functions to use the "C" language locale - rather than the current system locale settings. In addition - to that, two new functions __locale_exit() and __locale_init() - can be used to close and (re-)open the system locale at a - later time. - -- Local ("static") functions are now identified by the STATIC - qualifier. This was done in preparation for changes that will - deal with global and local data and the issue of thread safety. - -- Added stdio thread locking functions flockfile(), funlockfile(), - and ftrylockfile(). - -- Modified the internal FILE structure to allow for thread locking. - Note that this again requires that the library is rebuilt! - -- Added or modified macros for getc_unlocked(), getchar_unlocked(), - putc_unlocked() and putchar_unlocked(). - -- Added rand_r(). - -- Added flockfile()/funlockfile() wrappers around all stdio - functions. - -- Added more semaphore locking around the basic stdio, memory, locale - and dirent data operations. That should do it! While the library is - not reentrant (this is not ixemul.library) it should be thread-safe - now. Thread-safe in the sense of POSIX 1003.1c-1995. - -- The thread-safety code is now subject to conditional compilation. - Both the library and the user code need to be rebuilt with the - preprocessor symbol __THREAD_SAFE defined to get thread-safe - code. - -- Extended the thread-safety locking to the file descriptors. - - NOTE: these changes require that the entire library is rebuilt! - -- The translation of Unix to Amiga path names now silently accepts - absolute Amiga path names passed to it and will use them without - changing them. - -- Added atoll(), ffs(), ftw(), nftw(), lstat() and uname() code - contributed by Peter Bengtsson. Thank you very much! - -- Reworked the code that handles quoting for the wildcard expansion - routine. We no longer allocate memory and then modify it, but - call a function for each quoted parameter which does whatever is - necessary. - -- The shell command parameter parser now considers the non-breaking - space character (ISO code 160) to be a blank space character, too. - -- Moved the signal semaphore allocation/initialization/deallocation - into a dedicated module. This also has the advantage that it's - harder to break code by accidentally forgetting to call - InitSemaphore() after having allocated the memory for it. - -- Rewrote the code that allocates the file descriptor and file - buffer tables so that all the memory allocations are in one - place and it's possible to specify exactly how many table - entries are required at a time. - -- Creation and initialization of semaphores now uses the AmigaOS4 - specific functions for this purpose, if available. - -- In the thread-safe variant, the library now tries to allow - multiple concurrent callers to use the socket functions. Note - that this works only with the Roadshow TCP/IP stack, and the - results with other TCP/IP stacks are rather unpredictable. - - -c.lib 1.188 (7.2.2005) - -- Folded duplicate code in "stdio_init_exit.c" into a common function. - -- Simplified the code in "time_asctime_r.c" which builds the time - string. It gracefully handles buffer sizes which are too short - by returning an empty string. - -- Moved the "tm->tm_wday" initialization out of the hook function - in "time_strftime.c" since it was to be called only once anyway. - -- Lost a few compiler warnings in "unistd_time_delay.c" and - "time_gettimeofday.c". - -- Folded duplicate code in "time_mktime.c"; also, errno is no longer - modified unless the library is built with the "CHECK_FOR_NULL_POINTERS" - option. - -- We now allocate the AnchorPath used in the unistd_wildcard_expand.c - code. Also, the contents of the AnchorPath structure are no longer - modified between calls. MatchEnd() has to be sufficient. - -- Moved redundant code out of the readdir()/opendir()/closedir() - functions which is not required unless the code is built for - Unix compatibility mode. - -- Lost the __not_a_number and __infinity variables, including the - code which initialized them. - -- Reading/changing the errno variable is no longer done directly, but - involves accessor functions. - -- References to the HUGE_VAL quantity now involve an accessor function, too. - -- Changed the manner in which the __huge_val constant is initialized by - the __math_init() function. The new approach should be more portable. - -- The library no longer sends ACTION_DISK_INFO packets to the console - handler. The side-effects were too varied and irritating after all. - -- Added the fsync() and fdatasync() functions and the and - header files contributed by Peter Bengtsson. Thank - you very much! - -- Tweaked the build makefiles to produce fewer meaningless warnings. - - -c.lib 1.187 (29.1.2005) - -- The default console output window opened when a program is launched - from Workbench would open and stay open. This was not intended to - happen and is a side-effect of the new stdio initialization code which - checks if the stdio streams are in non-blocking mode. Fixed. - -- Moved the common DateStamp to time_t conversion code into a shared - function. - -- The fall-back function for converting time into a string in strftime() - now calls itself for the "%c", "%x" and "%X" format specifiers. - -- mktime() is supposed to convert the time specification, given as local - time, into the number of seconds since January 1st, 1970, relative to - UTC. This didn't really work up until now since the time value returned - was given as local time. - -- Plugged in a different algorithm for calculating the day of the week in - strftime() and asctime_r(). This one isn't sensitive to the effects of - adding/subtracting the local time zone. - -- Changed the algorithm that calculates the number of days that have passed - so far as used by the the __convert_time() function and the conversion - code in strftime(). - -- Also changed the algorithm used by strftime() to produce the week numbers - (the '%U' and '%W' format specifiers). The new method is much simpler - than the old one. - -- Made the code that converts a 'time_t' value into the 'struct DateStamp', - as used by strftime() and utime(), into its own function. This also - fixes a bug in the code strftime() would use which was completely - unaware of the local time zone settings. - - -c.lib 1.186 (14.1.2005) - -- Redirecting stderr to a file no longer has the effect of showing error - messages and assertion failure notifications as requesters. The exception - is in redirecting stderr to NIL: which will prompt the requester use. - -- gettimeofday() now calls GetSysTime() rather than DateStamp() to obtain - the current system time. This resolves granularity issues since the - DateStamp() result was only accurate by 1/50 of a second. - -- The "ptrdiff_t" definition in now defaults to type 'int' rather - than 'long int'. - -- The "char" limits in are now set up according to the current - compiler settings, which can either default to an unsigned or - signed definition. - -- Changed the rules again for the use of stderr/stdout redirection when - printing error messages. It is always safe to redirect them now and - no requester will appear unless you specifically set the value of the - "__no_standard_io" variable to TRUE in your program. - -- Removed a misplaced IsInteractive() from the stdio initialization - function. Now this could have been big trouble... - -- Removed tests for FileHandle->fh_Type != NULL which used to precede - all IsInterative() tests. I verified that IsInteractive() will always - return FALSE for NIL: type file handles. - -- Dropped the special flag variable used by the abort() function that - tracks whether or not console output is possible. We now use the - global "__no_standard_io" instead. - -- Made the macros more robust. - -- Removed the "NIL:" file handle tests preceding the Open("CONSOLE:",..) - calls. As of Kickstart 2.x and beyond these are no longer a source of - trouble. - -- The V37/V40 compatibility code is no longer built for the AmigaOS4 - version of the library. - -- Switched over the last use of DeviceProc() to GetDeviceProc(), etc. - -- open() no longer examines a file after opening it in order to figure - out whether read/write accesses are permitted. This decision is now - for the file system to make. - -- Whether or not stdio console streams are blocking or non-blocking - is now determined at initialization time. The I/O mode is restored before - the program exits. Previously, any changes to the I/O mode would persist. - -- Lost some more code that is not required for AmigaOS 4.x and can be - handled conveniently through conditional compilation. - -- close() did not reset the non-blocking file property, as it should - have. This only worked for files which were closed anyway, but not - for the stdio streams. Fixed. - -- Added a missing definition to stdio_init_exit.c which is part of - the OS4 header files, but not of the older header file distributions. - - - -c.lib 1.185 (2.1.2005) - -- Moved the environment variable cleanup code into a destructor function. - -- Fixed a typo in the hstrerror() function. - -- The common error reporting function __show_error() could throw Enforcer - hits if the program was not launched from Shell. Fixed. - -- Moved the memory initialization and cleanup functions into the - malloc/free code itself and updated the alloca code to do its - own data management. - -- Finally optimized the alloca() memory cleanup code. - -- Tried to make it possible to have debug versions of the memory - management code in the default link library along with the - normal versions. Let's see how well this works out in the GCC - version. SAS/C does not seem to like it... - -- Changed the definition of alloca() for GCC, which now defaults - to the built-in function. - -- Updated the stdio.h, stdlib.h, string.h and unistd.h header files - to declare function prototypes for the __MEM_DEBUG versions of the - library functions only if that preprocessor symbol is defined. - -- If a SIGINT signal is caught and processed by the default signal - handler, the localized "*** BREAK" string will be printed rather - than the built-in one. - -- The data structure alignment (file I/O buffer) is now configurable - at compile time. The default used to be 16 bytes, which is appropriate - for the 68040/68060 but not for the PowerPC, which uses 32 or 128 - bytes per cache line. - -- fwrite() now flushes the entire "buffer" for unbuffered files. The - exception are "interactive" files such as console windows. For these - line buffered output is used. - -- Whether or not a file is bound to an interactive device, such as a - console window, is now checked and remembered after a file descriptor - has been associated with it. - - -c.lib 1.184 (28.11.2004) - -- Added asctime_r(), ctime_r(), gmtime_r(), localtime_r() and strtok_r(). - -- Added stubs for the Rexx Variables Interface code that used to - be part of amiga.lib. While comparable functionality is available - in rexxsyslib.library V45, the new stubs might be helpful during - porting. Care must be taken since these functions don't work - exactly like the originals. - -- Integrated strlcpy() and strlcat() which are intended to be safer - replacements for strncpy() and strncat(). - -- The program's task priority is now configurable through an external - variable '__priority'. - -- The process name to be used when detaching can be configured through - the new '__process_name' variable. - -- The minimum required operating system version can be configured - through the new '__minimum_os_lib_version' variable; a matching - error message can be provided through the new '__minimum_os_lib_error' - variable. - -- The default console window specification can be overriden through - the new '__stdio_window_specification' variable. - -- The socket initialization code did not set up a reference to the - 'h_errno' variable correctly. This had the effect of making name - and address resolution errors trash the 'errno' variable instead - and leaving 'h_errno' always set to 0. Fixed. - -- For sockets, ioctl() and fcntl() now interact on the FIONBIO/FIOASYNC - requests (ioctl) and the O_NOBLOCK/O_ASYNC flags (fcntl). - -- popen() now accepts "rb" and "wb" as mode parameters. However, "r+", - "w+" and variants thereof are still unsupported due to the - unidirectional pipe support in the standard "PIPE:" device. - - -c.lib 1.183 (13.11.2004) - -- Cleaned up the OS4 build makefile, losing redundant libraries, - adding more startup object code and ultimatively making the whole - rebuild logic work again: if code changes and dependencies are - set up correctly, it will now get rebuilt. Previously, such - changes went unnoticed and you had to rebuild the entire library - from scratch. - -- Added stubs for CreatePort(), DeletePort(), CreateTask(), DeleteTask() - and NewList() which have equivalents in exec.library V50 but for which - it might be useful if ported code didn't have to reference these - explicitly. - -- mktemp() was broken in libunix.a with Unix path semantics enabled. - This was because the name template was translated and translated - back again, overwriting the translation buffer. This, funny enough, - broke Samba's printing feature. Fixed by translating the name only - before each test for "uniqueness" is made. The new code also handles - empty "" templates gracefully, which was a problem with both the - "standard" and the Unix path semantics flavour. - - Why is it that I find bugs like this always after having just - released another library update? - - -c.lib 1.182 (8.11.2004) - -- Changed the error abort condition for the %s conversion of the - scanf() family. It now matches the abort conditions for all other - conversions and no longer ignores whether any other parameters were - converted before. This was a quirk in the older implementation. - -- The scanf() family now accepts %E and %G in place of %f and %X in - place of %x. - -- Simplified the common code that fopen(), freopen() and fdopen() - share and which has to figure out by looking at a file access - mode specification which parameters should be used. - -- Dropped error detection in the scanf() family. The EOF has to be - good enough. Also, ungetc() failure still leads to error handling. - - - -c.lib 1.181 (26.10.2004) - -- The scanf() family now always returns the number of assignments made - unless an error occured or an EOF was hit during conversion before the - first assignment could be made. - -- strtok() did not terminate properly if the last token in the string - did not end with a separator character but with a '\0' byte. Fixed. - -- The directory scanning functions opendir/closedir did not get the global - directory data tracking data structure initialized which later led to - Enforcer hits and maybe trashed memory. Fixed. - - -c.lib 1.180 (23.10.2004) - -- The printf() family now produces no output at all for %e, %f and %g if the - floating point support code is disabled. Previously, a minimum field width - specification could take effect, printing a series of 0 or blank space - characters where no output should have been produced. - - -c.lib 1.179 (22.10.2004) - -- The scanf() family no longer assumes that a leading '0' indicates that the - following digits form an octal number if the conversion type has been - specified as already '%x' already. - - -c.lib 1.178 (7.10.2004) - -- The OS4 version had floating point math support code enabled in all - libraries and not just "libm.a". Fixed. - - -c.lib 1.177 (29.9.2004) - -- Moved the locale initialization/cleanup code into constructors - and destructors. - -- The socket cleanup function is now a destructor. - -- The math cleanup function is now a destructor. - -- The wildcard cleanup function is now a destructor. - -- The stdio cleanup function is now a destructor. - -- The stack extension cleanup function is now a destructor. - -- The code that cleans up after the program's current directory - was changed is now a destructor function. - -- Moved the initialization/cleanup code for unlink() into constructors - and destructors. - -- Moved the initialization/cleanup code for usergroup.library into - constructors and destructors. - -- Added usleep(), and created wrapper code that both sleep() and - usleep() can use. - -- Added strtoll() and strtoull(), with further changes to - and . - -- The socket exit code now calls the common stdio function which - flushes and shuts down all buffered and unbuffered files. - -- Fixed the stack swapping function which, for reasons unknown, ceased - to work... - -- The start time used by clock() is now initialized by a constructor - function. - -- NOTE THAT ALL THE CHANGES WITH REGARD TO USE OF DESTRUCTOR AND - CONSTRUCTOR FUNCTIONS REQUIRE A COMPLETE REBUILD OF THE LIBRARY! IF - YOU DO NOT DO THIS, THE CONSTRUCTOR/DESTRUCTOR FUNCTIONS MAY NOT - GET CALLED. - - -c.lib 1.175 (10.9.2004) - -- now tries to use the compiler supplied, machine specific - file and also includes the OS4-specifc - file, if necessary. - -- Added another test to to check if the "timeval" definition is - already in place. If it is, will not be included. - -- can be made to define the timeval data structure locally if - the __USE_CLIB2_TIMEVAL preprocessor symbol is defined. In this case no - or file will be read. - -- The sprintf() family did not properly handle empty strings as format - specifications. This would result in a necessary buffer flush action - getting skipped, which consequently did not put the string termination - character into the output buffer. - - -c.lib 1.174 (27.8.2004) - -- The parameters of atan2() were swapped. Fixed. - -- Merged fdlibm 5.3 changes with __kernel_tan(), __exp() and __pow() - functions. - -- Replaced the rint() and rintf() functions with the fdlibm code. - - -c.lib 1.173 (25.8.2004) - -- The header file was missing the C++ 'extern "C" { .. }' - declarations. - -- Added a new function __get_default_file() which allows direct access - to the low level file handle/socket descriptor associated with a - file descriptor. - - -c.lib 1.172 (21.8.2004) - -- acos() now returns 0 for a domain error. - -- asin() now returns 0 for a domain error. - -- atan2() now returns 0 for a domain error. - -- fmod() now returns x if y == 0 and sets a - domain error. - -- sqrt() now returns 0 for a domain error. - -- Added NaN and +Inf constants to the math library - initialization code which could come in handy later. - - -c.lib 1.171 (16.8.2004) - -- Added "math_hypot.c" - -- The 68k build makefile now builds the vfprintf/vfscanf functions - with %lld/%llu support. - -- Split the release notes file into changes and actual release notes, - which may overlap but differ in technical content. - - -c.lib 1.170 (14.8.2004) - -- Added "math_logb.c", and it appears to work, too. - - -c.lib 1.169 (8.8.2004) - -- Since the 'long double' data type is not really supported by the GCC - versions we use (and not supported by SAS/C either) building the - library with support code for it is now a configurable option. Unless - enabled, 'long double' is now treated like 'double'. - -- Reworked the HUGE_VAL definition which previously would default to - Infinity. The new code properly defines this to the largest - representable floating point number. The 'great' thing about the - HUGE_VAL definition in this library is that it's a reference to - a binary constant initialized by the library startup code. So any - application checking for HUGE_VAL merely needs to be relinked - rather than recompiled. - - -c.lib 1.168 (7.8.2004) - -- Ditched __is_infinity() and __is_not_a_number(), brought them back - as isinf() and isnan(). - -- Updated code and header files to state exactly which ISO 'C' version - is meant by the "The following is not part of the ISO 'C' standard." - warning. - -- Integrated rint() and rintf(). - - -c.lib 1.167 (29.7.2004) - -- Modified __is_infinity() and __is_not_a_number() to use more portable - methods for accessing the low level representation of the IEEE 754 - numbers they work on. - -- Fixed a compiler warning in h_strerror() - - -c.lib 1.166 (28.7.2004) - -- Added h_strerror() function to libnet.a; there's a global 'h_errno' - variable available, too. - -- now defines a type 'sig_t'. - -- now allows the 'fd_set' type to be referenced as - 'struct fd_set', too. - - -c.lib 1.165 (26.7.2004) - -- In printf(), if the precision is 0 and the value to be printed for - the %d, %i, %u, %o and %x conversion types is 0, no output should - be produced. Fixed. - -- Fixed the rounding for %g (again). The maximum number of significant - digits produced by a precision given for %g is different for numbers - < 1.0 and those >= 1.0: the leading 0 for numbers < 1.0 does not count - as a significant digit. - -- The calculation of the number of leading digits in a floating point - number now uses a mixture of log10() and a fall-back just in case - log10() returns gunk. - -- For floating point numbers, the sign, the digits, trailing zeroes - and the exponent are now set up and 'assembled' separately. This - removes the artificial limitation of floating point numbers to - a maximum of 78 digits to follow the decimal point. - - -c.lib 1.164 (25.7.2004) - -- The precision given for the printf() %g conversion types determines the - number of digits to generate, not the number of digits to follow the - decimal point. Fixed. The GCC FPU code generation now works again. - Previously, the floating point number conversion crashed cc1 since the - output amounted to 32 digits plus a terminating NUL, which overran the - 30 byte buffer sprintf() stored the output in. My, this was very hard - to find :( - -- Restored the floor() loop to figure out the size of the integer part - of a floating point number. For some strange reason, the log10() function - can return HUGE_VAL for numbers >= MAX_INT if mathieeedoubtrans.library - is involved. This crashes the conversion, which has the effect of making - the number come out as 0 rather than MAX_INT. Now that was nasty, too :( - - -c.lib 1.163 (25.7.2004) - -- Simplified the %e/%f/%g conversion some more. We now call log10 and pow - instead of looping and scaling the floating point number to be printed. - - -c.lib 1.162 (25.7.2004) - -- Simplified the floating point number output code in vfprintf(). - Instead of two separate branches handling output for the %e and - %f conversion types, the two now share the same code. - - -c.lib 1.161 (24.7.2004) - -- Dropped all the non-public source code fragments from the library, - including the memory pools, ARexx variable support and asyncio - functionality. - - -c.lib 1.160 (24.7.2004) - -- fputc() never flushed the output buffer if the stream in question - was unbuffered. - -- Rewrote puts() not to call fputs(). This avoids flushing the output - buffer twice if stdout is unbuffered. - - -c.lib 1.159 (23.7.2004) - -- Trying to open a directory like a file now reliably produces the - error code EISDIR. Previously, the error code could have come - out as ENOTDIR instead. - - -c.lib 1.158 (21.7.2004) - -- freopen() was broken since it tried to reuse data from an already - closed stream. Fixed. - -- Fixed a number of small compiler problems resulting from debug - output code that had never been exercised, or was not adapted to - subsequent code changes. - -- You can now enable debug output and have assertions come out - correctly. - - -c.lib 1.157 (21.7.2004) - -- The file hook message action "file_hook_action_write_and_flush" was - not handled properly by the socket and scanf/printf hooks. Fixed. - -- Removed a few assertions from the select() wrapper code which - prevented it from working properly. - -- Changed the stdio buffered I/O flushing code so that data can stay - in the cache, if necessary, rather than get written to disk. This - should help the asynchronous I/O feature. - - -c.lib 1.156 (21.7.2004) - -- Brought back the __unix_path_semantics variable. If you link with - -lunix and set this variable to FALSE, you'll still get Unix-like - behaviour from certain routines, only the translations of Unix<->Amiga - path name semantics will be disabled, leaving you with Amiga path - semantics. - -- sscanf(), asprintf(), vasprintf(), snprintf(), vsnprintf(), sprintf() - and vsprintf() now use short local buffers to speed up conversion rather - than a single measly byte. - -- opendir() now avoids returning duplicate volume names. - - - -c.lib 1.155 (21.7.2004) - -- Lost all special case code which took care of unbuffered output - and input. The new implementation works by using one byte of - buffer, which is part of the iob structure. Unbuffered output - is produced by 'flushing' the buffer once data has been written - to it. The new code also has the advantage of making ungetc() - work on unbuffered streams. - - NOTE THAT THIS MEANS THAT THE ENTIRE LIBRARY NEEDS TO BE REBUILT! - -- Each FILE buffer now sports back-link information which can be - tested to verify that it is valid. - - -c.lib 1.154 (21.7.2004) - -- fwrite() has to call fputc() for each byte to be written. Oops... - fwrite() no longer changes the file position if a write access - went wrong. Trying to write to a stream which is not available - for writing now counts as an error. - -- fread() has to call fgetc() for each byte to be read. fread() no - longer changes the file position if a partial read would yield - fewer data than is necessary to fill an element. Trying to read - from a stream which is not available for reading now counts as - an error. - -- Lost all the code that tested if the hook pointer embedded in a - file descriptor table entry or buffered file was NULL. It - simply has to be a valid pointer. - - -c.lib 1.153 (19.7.2004) - -- Oops: cli->cli_DefaultStack does not necessarily match the size - of the program's stack if it was launched from the shell and the - "$STACK:" keyword embedded in the program overrides the default - shell command stack size. - -- Stack space allocated locally is now public rather than private - memory (although it probably should be private). - - -c.lib 1.152 (19.7.2004) - -- Simplified the code that figures out how much stack space was - provided to the program when it was launched. The number does - not need to be absolutely accurate at the time it is calculated. - -- vfprintf() now prints a pointer (%p) as if it were a hexadecimal - number with 8 digits (0x%08x). - - -c.lib 1.151 (18.7.2004) - -- Oops: I mixed up the file descriptor and buffered I/O flags - in fflush() and __fill_iob_read_buffer(). - - -c.lib 1.150 (18.7.2004) - -- Checked the dos.library/InternalRunCommand() code to see if - the fiddling with Process->pr_ReturnAddresss is really necessary to - figure out how much stack space is available. Turns out that it - isn't under Kickstart 2.0 and beyond. Since this is what the library - requires, only the task lower/upper bound and the current stack - pointer address are consulted now. - -- isascii() is now a macro. - - -c.lib 1.149 (17.7.2004) - -- Reworked the ctype table layout and how the table is used by - the optional ctype macros. - - -c.lib 1.148 (17.7.2004) - -- Changed the flag definitions used by buffered files. - - NOTE THAT THIS MEANS THAT THE ENTIRE LIBRARY NEEDS TO BE REBUILT! - -- Added new macros to and which replace functions - of the same name and which might be more efficient. - - -c.lib 1.147 (17.7.2004) - -- Removed the isascii() macro and replaced it with a real function. - - -c.lib 1.146 (17.7.2004) - -- added a missing isascii() define to the ctype.h include file - as it is quiet a common function macro and should be included - - -c.lib 1.145 (16.7.2004) - -- Oops, I broke strncpy() *again*. Fixed. - - -c.lib 1.144 (16.7.2004) - -- The file descriptor duplication code now sits in a separate - function rather than in the different file/socket descriptor - hooks. - -- The code which reduces AmigaDOS path names by dropping path - components followed by two slashes now sits in a separate - function. Previously, it appeared twice in the Amiga<->Unix - path name translation code. - -- Simplified the select() function considerably. - - -c.lib 1.143 (16.7.2004) - -- added missing hook_entry object files to GNU OS4 makefile - -- added required newlines "\n" to the 68k GNU inline assembler - functions to make them compile with GCC version 3 and upwards. - - -c.lib 1.142 (15.7.2004) - -- ferror() does not return the code of the error for the stream - which ran into trouble, it merely signals that an error occured. - There goes another iob state variable. - - NOTE THAT THIS MEANS THAT THE ENTIRE LIBRARY NEEDS TO BE REBUILT! - -- Removed all the code that set the value of 'errno' to 0. - -- Likewise, removed all the code that reset the error condition - that might have been set for a file. The only function which - can do that is clearerr(). - -- No functions other but clearerr(), ungetc() and fseek() clear the - 'eof detected' flag now. - -- Simplified vfprintf() some more, merging the %x formatting code - with the other integer conversion code. - -- vfscanf() now decides that with the %i conversion, a number is - in octal notation if the first digit converted is a 0 and there - is no 'x' or 'X' character following it. - -- vfscanf() no longer counts '%n' as an assignment/conversion operation. - -- Rewrote strtol() and strtoul() again. The overflow detection is - now different in both routines and they avoid performing a - conversion if the base is 1 (which would lead to an infinite - loop). Also, the possible base values are limited to <= 36 and - letters in the range a..z are allowed, too. - -- All buffered streams which hold data and which operate in line buffering - mode are now flushed before the buffer of a line buffered input stream - is filled. - -- fflush() now flushes all buffered files if the stream parameter - is NULL. - -- Unlike fgets(), gets() does *not* put the terminating '\n' character - into the buffer. Fixed. - -- rewind() now clears both the 'end of file' and error indicator flags. - -- Replaced all memcpy() calls with memmove(). - -- Cleaned up error code translation and forwarding within the hook - functions. Instead of mucking around with the global errno variable, - the hook functions now return the error code as part of the hook - message. The error code translation is now done entirely through - two functions rather than one function, which fiddled with the - global errno variable, and local code which, if necessary, translated - ERROR_OBJECT_WRONG_TYPE into ENOTDIR. - - NOTE THAT THIS, TOO, MEANS THAT THE ENTIRE LIBRARY NEEDS TO BE REBUILT! - -- Lost the unconditional address alignment test in the qsort() data - swapping routine. If the code is built for an 68020 and beyond, it - is replaced by a no-op. - - -c.lib 1.141 (14.7.2004) - -- Rewrote the buffered file I/O code, and in particular how the read - access interacts with the file's state information. Rather than - counting how many bytes can be read from the buffer still, the - new code checks the buffer position against the number of bytes - stored in the buffer. This makes maintenance easier since only - one state variable needs to be modified at a time. - - Note that this means that code which would use the getc() macro - needs to be rebuilt! - -- The pid_t type used by kill() and returned by getpid() is now - really a Process address pointer. It used to be a CLI number. - - -c.lib 1.140 (12.7.2004) - -- The stack alignment code used when reallocating new stack space and - swapping it with the current configuration pushed the end of the - stack beyond the boundaries of the allocated stack. This crashed - in no time at all, but sometimes it just about worked without - blowing up. The fixed code is simpler than before and now initializes - both the lower and the upper stack boundaries to be aligned to - multiples of 16 bytes. - - -c.lib 1.139 (11.7.2004) - -- snprintf/vsnprintf were broken: instead of limiting output to - the size given as a parameter, data beyond the end of the buffer - was trashed. - - -c.lib 1.138 (11.7.2004) - -- Greatly simplified the vfscanf() code. Added new code which - initializes each parameter before the conversion begins. - This should help software which tosses data at scanf() - and expects it to come back initialized without checking for - the function's return code. - -- The vfscanf() '%f' conversion method could have consumed one - more character than it was really allowed to. Fixed. - -- If vfscanf() is built without floating point support, the - '%f' conversion method now properly pulls the respective - floating point number from the stack but performs no - conversion and does not modify the contents of the - variable. - - -c.lib 1.137 (11.7.2004) - -- Moved the initialization for the stack size checking out - of the _main() code and into its own initialization function - where it belongs. That way, the test also works for programs - that detach from the shell. - -- The '%g' and '%G' vfprintf() format specifiers now have the - effect of stripping trailing 0 and . characters in the number - string produced. Previously, this effect was also enabled for - the '%f', '%e' and '%E' formats. - -- Greatly simplified the vfprintf() code and verified that the - output matches the requirements. - - -c.lib 1.136 (9.7.2004) - -- Dropped in loads more of assertions to check the validity of - files and descriptors. - - -c.lib 1.135 (6.7.2004) - -- Fixed the last two issues in puts() and fputs() caused by the - bug fix I made to fputc() which would not return the character - value passed in. Occasionally, this could cause puts() to omit - the trailing '\n'. - - -c.lib 1.134 (4.7.2004) - -- Simplified and reordered the init/exit procedure in "stdlib_main.c". - Initializations which could be done on the spot when required are - no longer performed that early on. The stdio initialization is - performed earlier so that error messages can be printed using - stdio methods. - -- A stack overflow can no longer turn into an infinite loop. - -- Removed some more redundant data from the memory management data - structures. - -- The temporary file cleanup in fclose() did not properly turn off - profiling. Fixed. - -- Both close() and fclose() now fill their data structures with 0 - bytes before they return. - -- The tables for the file descriptors and buffered files are now - allocated dynamically. - -- If the asynchronous I/O options is not in effect, then the - global file data structures will not include a pointer to - the AsyncFile. - -- Lost some duplicate code from the locale cleanup routines. - -- Simplified the code that picks a vacant file descriptor table - slot. - -- NOTE: YOU NEED TO REBUILD THE ENTIRE LIBRARY IF YOU WANT TO USE - THESE CHANGES! - - -c.lib 1.133 (4.7.2004) - -- The memory routines no longer look up the management data structures - before they deallocate or modify an allocated memory chunk. This is - now done only in the debug version of the library. - -- Moved the code that performs memory deallocations in the debug and - nodebug versions of the library. Instead of separate functions, a - single common routine is used. - -- When launched from shell, the program's name is no longer allocated - through malloc() but through AllocVec(), and released separately later. - This helps the memory debug code which otherwise wouldn't be able to - print meaningful information when starting up and shutting down. - -- You can now get additional information out of the memory debugging - code, covering the locations where memory is allocated and released, - including how much memory is involved. - -- The month and day names used by the time conversion code are now - declared as 'const'. - -- Replaced all uses of the EPERM error code with EACCES. - - - -c.lib 1.132 (26.6.2004) - -- abort() and raise() now call a common termination routine. - -- Chopped the math_kernel.c code into individual files. Some local constant - values had to be duplicated, but so there... - -- Lost "smakefile.old" and "math_kernel.c". - -- Got rid of more compiler warnings... - -- Fixed a typo in the "stdlib_headers.h" header file. - -- In libdebug.a, for 'va_arg()' to work with 'char' type parameters, these must - be picked up as type 'int' from the stack. Otherwise we get a linker error later... - This should finally make the PowerPC 'native' kprintf() function work. - - -c.lib 1.131 (21.6.2004) - -- The '%i' conversion method in the scanf() family did not take - a leading '0' properly into account when updating the number of - letters to be read and processed. - -- If the '%c' conversion method reads fewer than the required - characters, it stops the conversion rather than aborting it - with an error. - -- The scanf() family now watches more carefully what data it still - requires to satisfy a conversion. For example, while it may accept - a '-' character to indicate that a sign is given to the number to - follow, if there is no number to follow will trigger an error - condition. - - -c.lib 1.130 (20.6.2004) - -- The scanf() family now returns EOF if an error was detected - (not just an end of file) or if the stream ended before a - conversion could be performed. - -- The file type reported by stat() did not really take pipes into - account. Fixed. - -- Cleaned up the data structure definitions and references. This turned - up a bug in the Unix<->Amiga path name translation which would use - a local data structure which was larger than the public version. Fixed. - - -c.lib 1.129 (18.6.2004) - -- Added a free memory threshold test feature to malloc(); how it works - is described in . - -- The PowerPC debug.lib now calls RawPutChar() and RawMayGetChar() - through the 68k LVO. This should finally make kprintf() and friends - usable on the PowerPC. - -- The asyncio code now defaults to allocate at least twice as much - memory as a buffered file would require (so that double buffering - can be used). Also, the fundamental asyncio support functions require - that enough memory is allocated to allow for four disk blocks to - be read at a time. - -- When opening a file for asynchronous I/O access, both read-only and - write-only access is supported now. Previously, the functionality - was limited to read-only access. - - -c.lib 1.128 (14.6.2004) - -- Moved the stack size usage reporting code again so that the name of - the program can be printed correctly. Also, the data from the - initial stack size swapping is now cached until it is used. - -- Reordered the resource allocations and initializations in tmpname() - to make error recovery more robust. - - -c.lib 1.127 (13.6.2004) - -- Truncating a file to size 0 was, if successful, considered a failure. - Fixed. - -- ftruncate() no longer changes the file position. - -- Advisory record locking now checks if the lock should be shared or - exclusive and verifies that the file open mode supports this access - mode. - -- Negative record lengths are now supported in the advisory record - locking code. - - -c.lib 1.126 (13.6.2004) - -- Unless Unix path semantics are in use, lseek() no longer defaults - to 'seek and extend' operation. - -- There are no longer two separate functions to take care of 'seek' - and 'seek and extend' operations. - -- The Unix-like lseek() behaviour now takes advantage of cached - file seek position information. Previously, it just ignored it. - -- The 'truncate' file action now makes sure that once the size of - the file has been trimmed, the new file position refers to the - end of the file. There also was a problem with growing the size - of the file which could have started at the wrong file offset. - -- The advisory file locking code now handles integer overflows - gracefully when the end of a locked region is to be calculated. - In this case, the end is assumed to be the (2^31)-1st byte. - Also, when removing a lock the search for the locked region in - question keys off the start position and the length rather than - the start position and the adjusted end position. - -- Added more sanity checks to file system operations which invariably - have to deal with FileHandle->fh_Type. - -- Rewrote the Unix->Amiga path name translation function again. - - -c.lib 1.125 (13.6.2004) - -- Rewrote the Amiga->Unix path name conversion code. Double slashes are - translated more robustly into '../' and the translation of the volume - name and the path to follow it are now done separately. The current - directory name ("") could wind up getting translated to a string pointing - into a local buffer. Fixed. Also, the new code knows how to translate - ":" to a path relative to the current directory (if that directory is - defined by an absolute path name). - -- The code that parsed and initialized the command line parameter - array to be passed to the main() function made different assumptions - during the counting and the initialization of the different parameters. - Fixed. - -- snprintf() and vsnprintf() now handle zero length buffer - sizes properly. - -- The stack size usage measuring code got broken when the - constructor/destructor mechanism was reimplemented. It - now works again. - - -c.lib 1.124 (12.6.2004) - -- Dropped the fseek() optimization for files with a write buffer. This - feature had little impact, but complicated buffer management enormously. - -- In fputc(), __fputc(), fwrite(), __flush(), etc. and the functions which - build upon them flushing the buffer now always takes place before new data - is pushed into the buffer. The exception is fputc()/__fputc() which can - flush the buffer if the file is in line buffering mode and a line feed - character has just been written. Also, failure to flush the buffer now - implies that the character/data to be stored in the respective function - was not successful. Previously, the different functions either stored the - data in the cache before and/or after the buffer was flushed, making it - difficult to tell if it had been written. Which in turn made it impossible - to recover from the failure since you could not be sure if another attempt - to store that data would really store it at the proper file position. - -- mktime() now insists that the year must be 1978 or later. - -- In debug.lib, KPutFmt() and the functions which build upon it now - should work even on the PowerPC. This works by analyzing the format - string and by converting the parameters to fit into a table whose - contents RawDoFmt() can handle. - -- For the asyncio code, all write accesses immediately flushed the buffer, - thus nullifying any advantage the asynchronous I/O might have provided. - Fixed. - -- The optimized memset(), memcpy() and memmove() functions now use - displacement addressing rather than post- and preincrement in the - unrolled loop. This should help strictly pipelined processors. It - does not seem to make any difference at all for the 68060, though. - -- The locale cleanup code now separately closes the specific locales - and the 'all' locale. - - -c.lib 1.123 (12.6.2004) - -- The distribution license no longer requires that for binaries using - the library a mention of the license text is mandatory. - -- closedir() now checks for a NULL pointer and backs out if it finds - one. - -- opendir() now exits with an error if it cannot allocate enough memory - for a volume name to be added to the list. - -- readdir() now checks for a NULL pointer and backs out if it finds one. - -- readdir() no longer builds with volume list scanning code unless - Unix path compatibility is enabled. - -- rewinddir() now ignores a NULL directory pointer. - -- strncmp() now treats the parameters as strings of unsigned characters. - -- strdup() no longer traverses the string to be copied twice to figure - out how much data needs to be copied. - -- strerror() now knows how to produce an error message for error - code 0x80000000. - -- strtol() and strtoul() always need to initialize the 'ptr' - parameter before they exit, not just when they succeed. - -- fputc() did not return the character value written, but 0. Fixed. - -- fputs() now returns EOF if it couldn't flush the write buffer, - if that was necessary. - -- fseek() no longer changes the value of the global 'errno' variable, - as required by the specification. - -- fseek() now sets the buffer position to 0 if the number of bytes that - can be read from the buffer drops to 0. This avoids clashes with write - access to the same file. - -- ftell() now always sets the global 'errno' variable to a well-defined - value. - -- fwrite() now tries to seek back to the original file position if - flushing the buffer failed. This complements similar code in fread(). - -- fwrite() no longer flushes the buffer before it returns. It appears - that this behaviour is not mandated by the specifications. The - buffer will only be flushed upon entry, and even then only to make - room for new data to be stored. - -- fread() now preserves error status information when recovering from - a failed buffer fill attempt. Previously, the error status information - would revert to 'no error' during this task. - -- mktemp() now also adds the current Task address to the seed value that - goes into the creation of the temporary name. - -- If dup2() fails to close a file, if that is necessary, it will return - an error rather than ignoring the failure. - -- Lost a return statement in dup2(). Also, growing the size of the - file descriptor table can now be aborted with ^C. - -- In fcntl(), growing the size of the file descriptor table can now be - aborted with ^C. - - -c.lib 1.122 (1.6.2004) - -- Lost the NULL tests in front of all UnLock() and FreeDeviceProc() calls. - -- The command line is now trimmed, dropping leading and trailing - blank spaces. - -- The ftruncate() functionality did not write 0 bytes to the file - being extended. Fixed. - -- popen() allocated a few bytes less than necessary for the command - name and the parameters. - -- Neither popen() nor system() now quote the command name unless it - is really necessary. - - -c.lib 1.121 (30.5.2004) - -- Made the memory debugging options a little more flexible and easier to - configure. - - -c.lib 1.120 (30.5.2004) - -- The asynchronous I/O code was never actually used by the library. Fixed. - -- Tweaked the realloc() code to take the memory allocation granularity into - account. This means, for example, that for small allocation sizes < 8 bytes - no reallocation will ever be performed since it wouldn't amount to anything. - This complements similiar code in malloc() which also rounds up allocation - sizes to the OS memory allocation granularity limits. - - -c.lib 1.119 (27.5.2004) - -- Got rid of a few compiler warnings involving signed/unsigned integer - comparisons. - -- Fixed a bug in the Unix->Amiga translation routine which would cause - file names such as './../foo' come out as '/foo' and end up being - translated to 'foo:'. The new code now takes care of removing leading - './' and embedded '/./' segments before further processing is - performed on the name string. - -- Fixed up the 68k GNUmakefile so that it builds properly. - - -c.lib 1.118 (26.5.2004) - -- Rewrote those putc/__putc macros again... - -- The vfprintf()/fputs() code did not properly test the result of - the __putc() function call. There should have been a test for - '!= EOF' rather than '== OK'. - - -c.lib 1.117 (26.5.2004) - -- realloc() now checks the size of blocks to be shrunk. If the block - shrinks by less than half its current size, then no new memory - is allocated for it. This saves the need to allocate memory and to - move the data. - -- Implemented an option to have the allocated memory chunks managed - by a balanced tree, sorted by address. This should help applications - which claim a lot of memory, possibly in small chunks, which get - allocated/released a lot. While this is still not quite as good as - having the low level memory management code use buddy lists or - slab allocation, it might still do the trick. This feature is - activated in "stdlib_headers.h" via the __USE_MEM_TREES preprocessor - symbol. You will need to rebuild the files stdlib_data.o, stdlib_free.o, - stdlib_init_exit.o, stdlib_malloc.o, and stdlib_red_black.o if you - change this. - -- The size of the physical memory allocation chunks is now taken into - account when making memory allocations. This means that allocations - are rounded up to multiples of 8 bytes each. - - -c.lib 1.116 (26.5.2004) - -- Reworked the putc/getc macro definitions, moved them behind the - function prototype declarations in . - -- The putc() macro did not return the same result as the equivalent - fputc() function would have done after flushing the buffer. The - new macro now calls a special flush routine which itself safely - returns the last character written. - - -c.lib 1.115 (24.5.2004) - -- Prior to performing ^C checking, the respective routines now verify first - if ^C checking is enabled in the first place. This saves a function call. - -- Replaced all ^C handling code that would drop straight into raise(SIGINT) - with a proper call to __check_abort(), which the user may have set up to - his own liking. - -- The wildcard matching argument list build code no longer defaults to - allow for ^C checking. This is permitted only if the global checking - flag is enabled. - - -c.lib 1.114 (24.5.2004) - -- Replaced most of the internal single character I/O calls with macros. - -- I/O buffers are now allocated so that their start addresses are aligned - to cache line boundaries. - -- Buffer size and position are now both signed integers. This fixes a - tricky issue with the newly-introduced macros and zero length buffer - sizes. - - -c.lib 1.113 (23.5.2004) - -- The 'FILE' structure now has a public part. Flags and layout have changed! - -- Reimplemented getc() and putc() as macros, which helps a lot with some - applications. - -- Added more of the SAS/C internal floating point support code, which makes - sprintf() and friends build even with floating point options enabled. - -- Replaced CheckSignal() with SetSignal(), which helped the ^C checking - code a lot. - - -c.lib 1.112 (23.5.2004) - -- Plugged in the SAS/C code profiling functionality. This works by measuring - calling time intervals and should be very portable. - -- Duplicating file descriptors could lead to trouble if the descriptor - number in question exactly matched the number of descriptors. Fixed. - -- Reactivated code in open() which was disabled for OS4 but which - should have stayed active. - -- Reduced the overhead of the single character input/output routines, - especially when called from within the library. This helped fgets(), - scanf(), fputs() printf() and others. - - -c.lib 1.111 (12.5.2004) - -- chdir() now checks if the object in question is really a directory. - -- Added special tests to a number of Open(), Lock() and Delete() calls - to catch attempts to open "subdirectories" of files. If it happens, - e.g. trying to open when "utility" is a header - file on the search list, errno will be set to ENOTDIR. - - -c.lib 1.110 (10.4.2004) - -- memmove() no longer tries to move large chunks of data if the source - and destination overlap by fewer bytes than can be moved at a time. - The original code should not have done this in the first place, but - it's safer to check rather than to assume that it will work out fine. - - -c.lib 1.109 (9.4.2004) - -- Fixed a bug in the PPC version of setjmp that would trash floating - point registers. - -- Fixed a bug in dup2: If the second fd didn't exist, it would return -1, - which is wrong (it should not close the second fd when it doesn't exist). - -- Added F_DUPFD to fcntl - - -c.lib 1.108 (15.3.2004) - -- Fixed a bug in the printf() family which affected how the %e - output was formed (and by extension, %E, %g and %G). The %e - format must put exactly one digit in front of the decimal - point, followed by the mantissa and the exponent. This worked - fine unless the round-off fudge added to the number caused - an overflow, producing two digits in front of the decimal point. - This has been fixed by checking for an overflow after having - added the round-off fudge and rescaling the result, if - necessary [Andrija Antonijevic]. - - -c.lib 1.107 (15.2.2004) - -- The setjmp() code now actually manages to save and restore the - FPU state in the 68k library form. - -- The SAS/C constructor/destructor invocation finally works. - -- Added an option to cache the current file position, which should - help seek performance. - -- Added targets "version" and "cvs-tag" to the makefiles. - - -c.lib 1.106 (14.2.2004) - -- index() now calls strchr() and rindex() calls strrchr(). - -- strchr() and strrchr() now read each byte of the string to - be searched exactly once. - -- Added optimized versions of memchr() and memcmp(). - -- The optimized versions of memchr(), memcmp(), memcpy(), memmove() - and memset() check first if the amount of data involved justifies - the expense of gearing up to perform an optimized operation. - -- strstr() no longer calls strlen() even once. - - -c.lib 1.105 (12.2.2004) - -- Replaced memcpy(), memmove() and memset() with optimized portable - versions. - - -c.lib 1.104 (11.2.2004) - -- When open() calls Lock() and fails to obtain a correct result, the - error code checking now also covers ERROR_ACTION_NOT_KNOWN (which is - ignored). This should help handlers which are no file systems, such - as PAR: and PIPE:. - -- The file->iob_BufferWriteBytes and file->iob_BufferPosition counters - no longer have to be in sync. In fact, the position can be smaller - than the number of bytes waiting to be written. The buffer flushing - has to take this into account now (it may have to seek back after - having dumped the buffer, which is nasty). - -- Worked Jörg's changes into the fseek() code. This covers two fields: - if possible, an absolute positioning command is converted into a - relative position change; if the current file buffer allows for it, - the buffer access position is updated rather than forcing the buffer - to be flushed to disk/reread. - - -c.lib 1.103 (8.2.2004) - -- The bug fixes in version 1.101 broke ungetc(). Fixed. Also reworked the - sanity checks in ungetc() which previously were performed either out - of order or were entirely missing. - -- Renamed socket_get_socket_descriptor.c to socket_get_descriptor.c to - make it easier to build the library on the Amiga. - - -c.lib 1.102 (22.1.2004) - -- modified string.h to also include strings.h within the non ISO 'C' standard - part. This should make porting of existing applications a bit easier as many - sources only include . As the current string.h anyway defines the - symbols of i.e. bcmp() and bcopy() etc, which should normally also be - in strings.h, I don't see any problem with that. - -- added function macros for stricmp() and strnicmp() to non ISO 'C' standard - part of to make it easier to port applications relying on - stricmp()/strnicmp(). - - -c.lib 1.101 (18.1.2004) - -- Draining an stdio buffer via fgetc/fread, etc. completely before switching - over to using the same buffer for writing data to a file would flop because - one of two important variables did not get reset to zero. This would also - end up trashing the buffer management. New code makes sure that if a read - access ends up setting the number of bytes available for reading from the - buffer to 0, the buffer position is reset to 0 as well. - -- fwrite() now pushes the buffer contents to disk if it has completely - filled up rather than allowing the full buffer to stick around until - another opportunity presents itself to flush it to disk. - - -c.lib 1.100 (18.1.2004) - -- abort() and raise() no longer call fprintf(stderr,..) but rather - use fputs(..,stderr) instead. - -- Updated the copyright text. - - -c.lib 1.99 (28.12.2003) - -- Updated "stdlib_constructor_begin.c" to invoke the SAS/C constructors - and destructors and to make the OS4 specific destructor handling - safer: destructors calling exit() will now cause the next following - destructor function to be called. - - -c.lib 1.98 (23.12.2003) - -- Fixed up Hans-Jörg's previous fix for strncat(). Added comments - explaining as to what this function is supposed to accomplish in - order to avoid making the same mistake again and again. - -- accept() now returns a properly wrapped socket descriptor (thanks to - Marcus!). - -- TODO: fix up the PowerPC destructor code; currently, a destructor - function calling exit() will cause all subsequent destructors to - be either skipped or the entire destructor list to be rerun ad - inifinitum (haven't checked this in detail yet). Change the code to - work more like the 68k version, which plants a setjmp() at the beginning - of the loop and remembers which one was the last destructor called. - - -c.lib 1.97 (15.12.2003) - -- The library can now use constructors and destructors internally. - -- Added the realpath() function. - -- Put the dirent functions back in libc.a. - - -c.lib 1.96 (13.12.2003) - -- gettimeofday() no longer reports microsecond values > 1000000. - - -c.lib 1.95 (13.12.2003) - -- The default memory pool and puddle sizes can now be configured at link - time by defining the __default_pool_size and __default_puddle_size - variables in your program. - -- strncat() no longer eats the last character copied. - - -c.lib 1.94 (9.12.2003) - -- now includes rather than , if - necessary. - -- Changed DoTimer() to allocate the MsgPort and the timerequest from - public memory rather than from the stack (which could be allocated - as private memory). - - -c.lib 1.93 (29.11.2003) - -- Fixed up the Unix->Amiga path name translation code to map "volume:/" style - paths to the virtual root directory. - -- The file operations (open, chmod, mkdir, rmdir, mktemp, chown, unlink, - utime and rename) now watch out for the root directory to come out of a - Unix->Amiga path name translation and will react according to it. - -- access() now also works on the virtual root directory. - - -c.lib 1.92 (28.11.2003) - -- Replaced qsort() with a different, iterative implementation. In terms of - performace it seems to beat everything out there. - -- Tinkered with the select() code again. The local FD_ZERO() implementation - was too smart. It would attempt to optimize the operation by breaking it - down in to series of bytes to be set to zero, followed by individual bits. - This went wrong because this isn't how the fd_set bits are organized. - The code now clears all the long words involved. - -- Updated the fix_datestamp() function which is part of the select() - wrapper. The updated version should be less vulnerable against - overflows. - - -c.lib 1.91 (25.11.2003) - -- Fixed up the dependencies in the makefiles. The libunix.a routines which - would involve the asynchronous I/O code would not get rebuilt if the - associated header file would change. - -- Added extra code to the fd hook function which looks after files that - should be unlinked, but which didn't get deleted at the first attempt - because they were still in use. That extra code checks, after a file is - closed, if the file in question was set up for deletion. This seems to - help the Samba port a lot, which no longer accumulates scores of lock - files in "Samba:log/locks" which get deleted only when smbd exits. - - -c.lib 1.90 (24.11.2003) - -- The wildcard pattern expansion for command line arguments no longer - drops parameters for which there is no match. Instead, the argument - is used as is. With the old behaviour, things like - "-D__interrupt=__attribute__((__interrupt__))" would expand to nothing, - breaking the GCC preprocessor. - -- The special definitions & code that help GCC to build itself are now - enabled through a single line in a local header file. - -- The file descriptor hook now sets errno to EBADF for file descriptors - which are not in use (this used to be ENOSYS). - - -c.lib 1.89 (23.11.2003) - -- The asynchronous file I/O support can now be enabled at library build - time by uncommenting a definition in a single header file. The makefile - dependencies then do the rest... - -- Fixed a bug in the Unix->Amiga path name conversion code. A trailing - "/." in a path name is now stripped. - - -c.lib 1.88 (22.11.2003) - -- alloca() is now included in the library even if GCC is used as the - host compiler. - - -c.lib 1.87 (17.11.2003) - -- truncate() and ftruncate() now safely extend the size of a file by - adding 0 bytes at the end. - - -c.lib 1.86 (17.11.2003) - -- Fixed a bug in the Unix->Amiga name translation which could lead to - a path beginning with "../" to be mistakenly identified as being an - absolute path name starting with "/". - - -c.lib 1.85 (16.11.2003) - -- The realignment code was missing in the FlushAsync() routine. Fixed. - -- The alignment position was not calculated correctly in SeekAsync() - as the wrong variable was involved. Fixed. - -- __umodsi3, __udivsi3, __udivsi4, __modsi3, __divsi3, __divsi4 would - not refer to the proper __UtilityBase library symbol. Fixed. - - -c.lib 1.84 (12.11.2003) - -- Updated the optional asyncio code to return to a block-aligned - file position after seeking in a write-only file. Also added - code to check if read/write access is actually allowed. - -- Multiple inclusion of debug.h no longer leads to trouble. - -- Merged duplicate file advisory lock testing code. - -- The dirent functions are now a part of libunix.a and no longer - appear in libc.a. - -- Advisory file locks can now start beyond the end of the (current) - file and it is possible to lock a region until the end of the file. - Previously, the latter was rejected as an invalid range. - -- If several exactly overlapping regions are locked on a file, - they all are now unlocked by a single call. - -- Replaced the qsort() code. - -- The assertion handling has moved into its own routine which - tries to make sure that the failure message is shown. - -- Rewrote clock() (again) to be much simpler in operation. - -- The opendir/readdir/closedir cleanup code now actually invokes the - closedir() function rather than doing the cleanup job manually. - -- open() no longer tests for delete protection after the file has - been already opened. If it's open, only a possible write protection - may be problematic and ought to be flagged. - -- __drop_iob_read_buffer() now checks if the buffered file is actually - in use. - -- If fseek(..,0,SEEK_CUR) is is called, it no longer results in the - read/write buffers to be dropped. - -- The snprintf() family now returns the proper number of characters - that would have gone into the buffer, if enough room were available. - Previously, it would stop counting after the buffer had filled up. - -- Merged duplicate code around free(). - -- The memory cleanup code now calls the free functions if memory - debugging code is enabled. - -- If the memory debugging code is enabled, allocations and deallocations - will trigger consistency checks now and then (with a likelyhood of - about 6% per operation). - -- mktime() now properly fills in the day of the week. - -- strftime() now expects the format hook code to provide for the NUL- - termination. - -- __translate_amiga_to_unix_path_name() now performs a sanity check - before it proceeds to use the supplied path name. The check is - to make sure that the local buffer does not overflow. Rearranged - code in __translate_unix_to_amiga_path_name() to perform a similar - test. - -- Rewrote the command line wildcard expansion code to use standard - Exec lists rather than the tricky singly linked list stuff, coupled - with tricky pointer arithmetic. If the code crashes, it's now much - easier to tell why. - -- The __usergroup_init() function now returns an error code rather - than dropping into exit() in case of trouble. - -- They 'key' parameter of bsearch() is now of type "void *" rather - than "char *". - - -c.lib 1.83 (5.11.2003) - -- The scanf() family now skips over initial whitespace preceding - data to be converted. Exceptions are the %c, %n and %[ conversions - which are documented not to bother. - - -c.lib 1.82 (4.11.2003) - -- Fixed another bug in the scanf() family. Floating point numbers were - not converted correctly, only the integral part was picked up. - - -c.lib 1.81 (4.11.2003) - -- Added assertions to track trashing of certain global variables. - -- Rewrote the select() wrapper again. It no longer makes assumptions about - the size of the fd_set data structures passed in. The new code is, however, - significantly more complex than it used to be. It uses far less stack space, - though... - - -c.lib 1.80 (29.10.2003) - -- More tweaking for the optional asyncio support. If requested, it's - always enabled for read-only files bound to descriptors, but never - for write-only or read/write access. It's always enabled for buffered - files standard I/O files because there's an fflush() to take care - of pushing the buffer contents to disk. There is no fsync() for - file descriptors which would accomplish the same. - - -c.lib 1.79 (29.10.2003) - -- The optional asyncio code now also sports a function similiar - to fflush() which will write the current contents of the buffer - to the file. - - -c.lib 1.78 (27.10.2003) - -- The asyncio code support is now an optional feature which can be - enabled at library build time by defining the ASYNCIO_SUPPORT - preprocessor symbol. - -- Cleaned up the code that uses the buffered I/O data structure - 'iob', which used to be a much bigger data structure with - a hard-coded buffer attached to it. The buffer is now allocated - dynamically when needed. - - Note that this change requires that the library is rebuilt or the - I/O buffer data structures will cause trouble. - - -c.lib 1.77 (26.10.2003) - -- Worked an updated version of the asyncio code into the library. - File I/O performance will benefit from this if, and only if, a - file is opened either for read or write access only. If both - read and write access are requested for a file, the asyncio layer - will not kick in. Also, in order to enable it, you have to declare - a '__asyncio_buffer_size' variable (see "stdio_asynciobuffersize.c") - somewhere in your program. - - Note that this change requires that the library is rebuilt or the - file descriptor data structures will cause trouble. - - -c.lib 1.76 (22.10.2003) - -- Added to define the macros va_startlinear() and - va_getlinearva(). - - -c.lib 1.75 (20.10.2003) - -- __initialize_fd() and __initialize_iob() now perform the bulk of the - data structure initialization rather than just setting the data to - zero and plugging in a hook function. - - -c.lib 1.74 (19.10.2003) - -- Renamed the global __fd_table variable to __fd to match the buffered - I/O data structure name. - -- Further modifications to make the debug version of the library build - without errors. - -- Moved the stack size usage checking code from _main() into separate - routines which are found in the linker library. - - -c.lib 1.73 (19.10.2003) - -- __grow_fd_table(), __grow_iob_table(), __flush_iob_write_buffer(), - __drop_iob_read_buffer(), __fill_iob_read_buffer() and __open_iob() - now returns 0 for success, -1 otherwise. - -- __grow_fd_table() and __grow_iob_table() now both set errno in - case of failure. - -- Lost the unnecessary file descriptor and buffered I/O table - initializations. - - -c.lib 1.72 (19.10.2003) - -- fopen(), freopen() and fdopen() now all call the same common - routine to set up a buffered stdio stream. Previously, the - fdopen() code was seperate and did things differently from - the rest. - -- Deletion of temporary files upon program exit could lead to - a crash (worst case), but never actually deleted anything. Fixed. - -- The stdio_exit() cleanup function now actually calls into - fclose() and close() rather than doing the same job all over - again manually. - -- Lost code which didn't make much sense in the socket descriptor - hook. Same thing for the temp file cleanup code. - -- dup() now invokes dup2() with the second parameter set to -1. - -- Simplified the duplicate cleanup in close(). - - -c.lib 1.71 (19.10.2003) - -- Added missing prototype for setbuf() in . - -- Put the definition of HUGE_VAL in inside #ifndef, to allow - GCC to do its thing. - - -c.lib 1.70 (18.10.2003) - -- The tests to verify that a file descriptor was valid all had a - problem. This test is now done in a separate function which - performs the necessary error checking. - -- The dup2() function did not close the second file descriptor - prior to duplicating the first one. Also, the dup(..,-1) case - did not return the number of the new file descriptor but -1 - instead. - -- The tests to check whether a Hook is attached to a file - descriptor now set errno to EBADF if no Hook is found. - -- All file descriptor flags are now cleared when a descriptor - is closed. Same thing for buffered files. - - -c.lib 1.69 (14.10.2003) - -- Not all conversions performed by the scanf() family would respect - the maximum field width. Fixed. - -- The local sscanf() file hook function had the last two parameters - reversed. Fixed. - -- strftime() now fills in the week day if it's not provided. - - -c.lib 1.68 (13.10.2003) - -- To activate the memory debugging code, use "#define __MEM_DEBUG". - Other debugging code (assertions) is deactivated through - "#define NDEBUG". - - -c.lib 1.67 (11.10.2003) - -- Reworked the program startup code. Instead of rattling down a number of - initialization functions, one at a time, the whole thing is now performed - through a 'constructor style' table. This ought to be replaced by the - real thing once it's safely possible. - - -c.lib 1.66 (11.10.2003) - -- UtilityBase, LocaleBase, SocketBase and UserGroupBase no longer override - any user defined global variables. The library now keeps them under - private names. - -- The wildcard expansion code would not return an empty argument list in - case no match was found. Fixed. - -- Cleaned up the stdlib_main.c code, moved all the data and function - references into local header files. - -- Completed the usergroup.library API integration for the OS4 variant. - -- The constructors are now called in forward order and the destructors - in reverse order. - -- Moved the constructor/destructor invocation code into a separate file. - - -c.lib 1.65 (9.10.2003) - -- In dev_t is now an unsigned long. - - -c.lib 1.64 (9.10.2003) - -- Bum. The old and the new clock() code was wrong. The clock() function - is supposed to return how much processor time the current process - consumed since it was started, which is a monotonously increasing - number (or something like it, unless the system time is reset). - The new code should deliver proper data, although it might be better - to switch it over to timer.device/ReadEClock. - - -c.lib 1.63 (8.10.2003) - -- Ouch, the old clock() code was correct, it just didn't look like it. - I rewrote it to make it clearer what happens and why it happens like - that [Andrija Antonijevic]. - - -c.lib 1.62 (6.10.2003) - -- A "+" and a "*" had been mixed up in clock(). Fixed. - - -c.lib 1.61 (5.10.2003) - -- Now that main.o is a platform neutral startup code file, it's possible - to do some machine type checks in "stdlib_machine_test.c". This code - checks for presence of an FPU and an MC68020 CPU (or better). It may - not work for -fbaserel32 which by the time the test is performed - will have already crashed. - -- Added the missing stdlib_dosbase.c, stdlib_localebase.c, stdlib_sysbase.c, - stdlib_utilitybase.c and math_init_exit.c files to the repository. - - -c.lib 1.60 (5.10.2003) - -- Renamed the source code files which implement the strtod(), strtol(), - strtoul(), atof(), atoi() and atol() functions. - -- Moved main() out of libc.a and made it into a startup object file - which needs to be added to the GCC specs file in the "*startfile" - section, right at the end of the list. This solves practically all - linking problems I encountered so far. Which means that -lunix - and -lsocket actually work and that you don't have to tweak the - specs file to build the compiler. - - -c.lib 1.59 (4.10.2003) - -- The math initialization/test function is now always invoked by the - _main() function. The math init/exit code defaults to stubs, though, - unless libm.a is linked in. - - -c.lib 1.58 (4.10.2003) - -- Moved the global library base/interface definitions from stdlib_main.c - into separate files, each of which defines a base/interface pair. - -- Moved the math library initialization/testing into libm.a where it - really belongs. The MathIEEE library base definitions went there, - too. - - -c.lib 1.57 (1.10.2003) - -- Calling dup2() on a stdio file reinitialized the source fd instead of the - destination fd. Fixed. - -- Added const declaration to first argument of sscanf(). - -- no longer enforces the inclusion of . - - -c.lib 1.56 (30.9.2003) - -- Moved the scalbn() function prototype into math_pow.c, where it is - used. This is not an ISO 'C' function to start with. - -- strtod(), strtol(), strtoul(), atof(), atoi() and atol() moved - from into . - -- fputs() no longer adds a newline character at the end of the line. - This is now done only by puts(). - -- fdopen(), fopen(), freopen() and popen() no longer mix up file - access mode options such as "r" and "r+". - -- popen() now adds the current time stamp to the name of the - temporary files it opens. - - -c.lib 1.55 (21.9.2003) - -- Added support for 'long long' quantities in the printf/scanf - families. This is not yet enabled by default since I couldn't - seem to make it work on the 68k platform. - - -c.lib 1.54 (18.9.2003) - -- fputs()/puts() didn't add the '\n' character at the end of the - line. Fixed. - - -c.lib 1.53 (25.8.2003) - -- Added hooks for code to perform wildcard expansion for all - command line parameters. Excluded are those parameters which - are surrounded by quotes ("). - - -c.lib 1.52 (19.8.2003) - -- fpos_t is now a scalar data type. - -- size_t is now an unsigned integer. - -- Lost the file descriptor table usage counter. Whether or not a - file descriptor is in use is now indicated by a flag. - -- Temporary buffered files now have a dynamically allocated temporary - file name string attached. Previously, a statically allocated - buffer was part of each file buffer data structure. - -- The order of the hook parameters for the file descriptor and - buffered files was wrong. - -- All the buffered file routines now check if the file in question - is actually in use before they proceed. - -NOTE: the last four changes require a rebuild of the entire library, - just to be safe! - - -c.lib 1.51 (12.8.2003) - -- setvbuf() now sets the buffer size to 0 when switching a stream - into unbuffered mode. Also, with buffering mode _IONBF (no - buffering) no memory is allocated and no supplied buffer is - used. - -- The stdio cleanup code no longer runs all file descriptors and - files through the shutdown code. Only those which are actually - in use. - -- Fixed a typo in the BSD style license text. - -- Cosmetic changes... - -- fopen("a+", ..) did not actually append any data. - -- The unlink() cleanup code didn't unlock the temporary locks - it maintained. - - -c.lib 1.50 (2.8.2003) - -- Rewrote the entire Amiga->Unix and Unix->Amiga name/path translation - code from scratch. It's now much more robust than it used to be. - -- Restored the original difftime() code. - - -c.lib 1.49 (1.8.2003) - -- vfprintf() now treats the '%' format specifier as an escape - character and produces the next following letter as is if that - letter does not indicate a specific format. - - -c.lib 1.48 (31.7.2003) - -- vfprintf() now sets up the buffer it uses for converting numbers - into text every time it goes through the main loop. This means - that a terminating '\0' is placed at the end. - -- vfprintf() now first checks if a floating point number is - +/-infinity or not a number and then performs the '%g' check - to figure out which output format should be used. - -- Fixed the alternate conversion option for precision == 0 and - the %e/%f/%g conversions. - -- In vfprintf(), if there is no digit following the precision - specifier, the precision is now set to 0. - -- In vfscanf() only %c, %s and %[ respond to the maximum field - width option, all other conversion methods ignore it. - -- readdir() again returns the ".." entry for the root - directory. - - -c.lib 1.47 (31.7.2003) - -- Fixed vfscanf() and strtol() again to accept very small negative - integers (-2147483648). The previous check to avoid overflows - was too strict. - - -c.lib 1.46 (31.7.2003) - -- strftime() now makes sure that the string generated is always - NUL-terminated. The formatting code checks if the dates are - in range to avoid accessing invalid day/month table data. - - -c.lib 1.45 (30.7.2003) - -- lseek() could end up freeing a local buffer twice. Fixed. - -- The sscanf() wrapper no longer emulates seek/write. - -- Added some more error checking to the vasprintf() code. - -- Fixed the %h qualifier in vfprintf(). - -- The %d conversion of negative integers in vfprintf() was relying - upon a non-portable operation: the % operator used on negative - numbers was expected to yield a negative result. The new code - tries to be more careful and uses the % operator only on - non-negative numbers. - -- vfprintf() now handles floating point number exponents - gracefully which are larger than 100. - -- Made the varargs handling vfprintf() more portable. - -- vfscanf() could produce an error if a character in the - format string did not exactly match the corresponding - character in the input stream. Now it just pushes the - character back and stops scanning. - -- The %c conversion in vfscanf() never stored more than - one single character. - -- The automatic %d octal number conversion in vfscanf() lost - the first digit following the introducing '0'. Fixed. - -- vfscanf() now properly handles the 0x/0X prefix for the - %x conversion. - -- vfscanf() now only returns EOF if no arguments could be - converted and the EOF status of the stream involved has - been asserted. - -- vsnprintf() no longer tries to skip the trailing NUL byte if - the resulting string is larger than the buffer it would - hold. - -- The memory allocation cleanup code now also properly handles - the extra large debug allocations and cleans up the - alloca() tracking list. - -- Fixed strncpy() and strncat() again not to write too much - data. Also strncat() does not pad the destination buffer. - Neither function is supposed to do anything if the - length parameter is negative. - -- strncmp() now returns 0 if the length parameter is negative. - - -amiga.lib 1.7 (30.7.2003) - -- None of the 68k assembly language files appear in the PowerPC build - any more. Also, none of the functions which use the local CallHook() - appear in the PowerPC build either. - - -c.lib 1.44 (28.7.2003) - -- Files created through open() now get their 'executable' protection - bits cleared when they are closed. - -- mkdir() now sets the protection bits on the directory created. - -- The record locking code now uses shared semaphore locking where - necessary. - -- Added workarounds for NIL: style file handles inthe record locking - code. - -- Preparations to get rid of the file descriptor use counter... - -- __open_iob() no longer calls lseek(). - -- popen() and fdopen() now also ignore the extra access options - separated by a comma. - -- tmpnam() now creates names with up to 10 characters. - -- Lost the special case code for zero length memory allocations. - They now produce NULL result codes. - -- Lost the DosLibrary, LocaleBase and ExecBase definitions where - they were not actually required. - -- strncat() didn't pad the destination string with NUL bytes, - according to spec. Fixed. - -- Fixed the weird strxfrm() to work according to spec. - -- Simplified the asctime() and strftime() code. - -- The "%j" format specifier did not produce exactly three digits - in strftime(). Fixed. - - -amiga.lib 1.6 (28.7.2003) - -- Removed NULL pointer checks from "amiga.lib". Added assertions in - their places. - -- Added tests for IconBase and CxBase to the "amiga.lib" routines. - - -c.lib 1.43 (27.7.2003) - -- readlink() didn't free the DeviceProc structure it could use. - -- More fixes to the record locking code. If a lock/unlock action was - performed on a duplicate of a file descriptor, it wasn't always - guaranteed that all the duplicate/original file descriptors were - affected. - -- Fixed a potential bug in the strncpy() code which could drop into - an infinite loop. - -- Replaced almost all do .. while loops with while .. loops. - - -c.lib 1.42 (27.7.2003) - -- Changed the memcpy(), bcopy(), memmove() and bcopy() code - not to use any assembly language bits. I'm wondering whether - this will have an effect on overall stability. - -- The internal number->string conversion routine used by the - time.lib code had two of its parameters swapped. Fixed. - -- The main() startup code had a bug in the character escape - handling. Everything escaped other than 'e' or 'n' would - terminate the respective command line parameter in place. - -- The shell escape character (default is '*') is now configurable - at compile time, which can help applications ported from the - Unix world.Note that you cannot override the '*' escape character, - you can merely define another valid escape character. - -- Changed how double quotes are used by the main() startup code. - A quoted string is now terminated if there is a blank space - following the final double quote or if the end of the command - line is reached. - - -c.lib 1.41 (26.7.2003) - -- In vfscanf() the '%e', '%f' and '%g' conversions now default again - to 'float' unless a format size specifier is used. Also, the function - no longer 'forgets' that the default conversion is being used, which - could happen if several parameters were to be converted. - -- asctime() now tries to make sure that the conversion process - does not overflow the local buffer. - -- readdir() no longer returns the ".." entry for the root - directory. Also simplified the readdir() cleanup code. - -- open(), stat() and lstat() could leave dangling FileLocks behind. Fixed. - -- dup2() now returns the new file descriptor rather than 0. It also - tries to close the second descriptor if that one is in use and - easy to close. - -- fileno() never returned the associated file descriptor but the - table index of the FILE stream. Fixed. - -- Increased the internal maximum directory/file path length to - 1024 characters. Note that this means that the entire library - will have to be rebuilt! - -- setvbuf() now frees its custom allocated buffer if flushing the - write buffer fails. - -- setenv() now longer permits a NULL 'value' parameter. - -- fdopen() now 'claims' a file descriptor rather than performing - an 'internal' dup() on it. - -- vfscanf() now stops converting the mantissa when it finds - an exponent character in the input stream. - -- vfscanf() now makes sure that the strings it reads are - all NUL terminated while they are being read. If the - conversion is aborted, this will still produce a properly - NUL terminated string. - -- The '%' conversion in vfscanf() no longer exits with an - error if the next character read does not match the - '%s' character. - -- vfprintf() now watches the size of the buffer it uses for - converting numeric data into strings. - -- The file descriptor hook code now initializes the duplicate - when it performs a dup() operation. - -- The record locking support now also extends to duplicated - file descriptors. - -TODO: replace struct fd.fd_UseCount with a flag. - - -net.lib 1.8 (25.7.2003) - -- The select() function was broken in a number of ways. Always was, even - in its original form in the Samba 2.0.7 Amiga emulation library. First, - the except_fd bits could have been set even for files (unlikely, if not - impossible to happen). Second, if sockets and real files were used in - parallel, sockets were preferred and the FD_SETs for the files would - come out as indicating that data was available for reading/writing - (which was wrong). Third, the test loop which checked whether the files - had data waiting to be read never initialized the data structure it - had to use. As a bonus, the new code now also checks if a file is - writable and will then flag its FD_SET bit as "ready for writing". - -- More fixes to select(): in each iteration of the polling code, the - set bits would be cleared that might later be used to check for - new input. This no longer happens. - - -c.lib 1.40 (25.7.2003) - -- fopen() now ignores any open options following the mode string, - separated by comma. - - -c.lib 1.39 (23.7.2003) - -- Ouch! vfprintf() didn't work right for floating point number conversion - (again). The '%g' conversion code didn't work on the PowerPC because - the method employed to figure out which format to use was not portable. - Fixed. The '%f' conversion code would produce no output at all if the - number to be printed was zero and the number of digits following the - comma was zero, too. Fixed. Large numbers didn't come ought right. - Fixed. The '%e' conversion code was ill prepared for converting - negative numbers and sometimes failed to produce digits. Fixed. - -- More trouble. strtod() and, by extension, atof() didn't convert - numbers properly with more than one digit following the mantissa. - Fixed. Same stupid problem in vfscanf(). - -- The '%e', '%f' and '%g' conversions would always default to 'float'. - They now default to 'double'. Use the 'h' or 'L' specifiers if you - want less/more. - - -c.lib 1.38 (23.7.2003) - -- The '%s' and '%[' conversion code in vfscanf() never NUL-terminated - the string just read. Fixed. - - -amiga.lib 1.5 (15.6.2003) - -- CreatePort() didn't fill in the port priority. Fixed. - - -amiga.lib 1.4 (1.5.2003) - -- RangeRand() didn't obey the range parameter's restrictions. Fixed. - - -c.lib 1.37 (3.3.2003) - -- Added an option to allow a program to detach itself from the shell - it was launched from. This option is ignored for residentable - programs. - - -c.lib 1.36 (14.2.2003) - -- Removed redundant code from the routines which deal with buffered - stdio streams. The respective routines now only test for the - buffering type and ignore the buffer size altogether, just like - it's supposed to work. - -- Fixed the vfprintf() %e format output which no longer flips the - sign of the number to be converted until it's safe to do so. - The code to figure out whether %g should be mapped to %e or %f - was unreliable because it could miscount the number of digits in - front of the comma. - -- Updated the code that dumps the stdio buffer in fcntl() before the - set/get lock function is performed. These two should have nothing - in common, though. Let's see what it does. - - -c.lib 1.35 (13.2.2003) - -- When a stdio or plain unbuffered stream is opened, the respective data - structures are reinitialized with default values. Previously, the old - settings could persist and stale data could cause unallocated or - reallocated data to be clobbered. This seems to have been the problem - which eventually broke the Samba port. - -- Added some more code to improve debug output quality. - -- The buffered stdio routines now include some extra safety checking - code in case the buffer data structures get clobbered. Not that this - should happen again... - - -c.lib 1.34 (8.2.2003) - -- The program startup code now opens dos.library and utility.library - before it starts to figure out whether it has sufficient stack space - available or not. This allows the stack size setup callback function - to get its bearings. It also simplifies the startup code a bit. - -- The UtilityBase and LocaleBase library bases will now be cached until - the startup code performs its cleanup duties. This is intended to help - application software which insists on reopening these libraries by - itself all over again. - -- The stdio initialization code now uses the shell's standard error output - stream if one is available. Otherwise, it will open "CONSOLE:" instead, - thereby cloning the console file handle. - - -c.lib 1.33 (2.2.2003) - -- Rewrote the vfprintf() floating point conversion code not to rely - upon floating point to integer conversions which could overflow the - capacity of 32 bit integers. The new code now converts the individual - digits as floating point numbers which then end up getting converted - into integers, which should be safe enough. - -- Simplified the fgets() code a bit. - - -c.lib 1.32 (26.1.2003) - -- The fgets() EOF detection was flawed. Fixed [Andrea Valinotto]. - It now returns NULL if no data was read yet and an EOF condition - was detected. Previously, it would keep returning an empty string. - - -c.lib 1.31 (14.1.2003) - -- Rewrote the floating point conversion code in vfscanf(). The - EOF handling for the data to be parsed was not robust enough. - It aborted scanning altogether if the last data item also - included the last character in the data stream. - -- Now properly counts all characters read in vfscanf() even if - some of them have to be pushed back. - -- Invalid character matches are now pushed back by vfscanf(). - - -c.lib 1.30 (28.12.2002) - -- ungetc() now returns the character pushed back, or EOF if it - could not push anything back. It also clears the end-of-file - indicator. - -- ftell() no longer drops the read/write buffer contents. It now - checks where the current file access pointer is and then adjusts - that position with regard to what's in the read/write buffer. - - -net.lib 1.7 (28.12.2002) - -- The socket file descriptor hook now rejects seek accesses, - setting the proper errno code ESPIPE. - - -net.lib 1.6 (21.12.2002) - -- Turns out that the daemon socket bound to the stdio streams must be - marked as available for reading and writing or Samba won't work. - - -stack.lib 1.2 (18.12.2002) - -- Added code that collects information on how much memory is allocated - for stack extension. That data is printed by the debug library before - it exits. - - -c.lib 1.29 (18.12.2002) - -- strxfrm() and strcoll() did not use the locale.library pragma/inline - header files and thus would not link properly. Fixed. - -- Changed the entry assertions for bcopy(), bsearch(), memcpy(), - memmove(), memset() and bzero() to ignore zero length arrays. - This fixes the GCC port which had alloca(0) followed by bzero(..,0) - in it. - -- malloc() and alloca() now return NULL again for a zero length - allocation. Not sure if this is the way to go... - - -c.lib 1.28 (14.12.2002) - -- setenv() trashed the variable value to be used if the variable and - value names were given in the "variable=value" form. Fixed. - -- Reworked the overflow checking for strtol() and the scanf() family - again. This time it hopefully works as expected. - -- Trying to allocate a memory chunk of size 0 now returns a pointer - to a unique address rather than NULL. I wonder whether this is - really the right thing to do, but it seems to help the compiler. - -- Calling realloc() on a memory chunk with exactly the same size it - was allocated with now returns a pointer to that chunk rather than - NULL. - -- The alloca() memory cleanup code is now triggered from within the - library by a separate function which can be told apart from user - code making the call. - -- Now remembers which local variables were set with putenv()/setenv() - and makes sure that before it exits that they all get removed first. - - -c.lib 1.27 (13.12.2002) - -- The strtol() fix didn't actually fix anything broken, but broke some - working things instead. Fixed. - -- Reworked the overflow checking code in scanf() and strtol() again to - compile without producing warnings. - - -c.lib 1.26 (13.12.2002) - -- strtol() did not set the converted number to the smallest possible - negative integer if the number to convert had a sign. Fixed. - - -c.lib 1.25 (13.12.2002) - -- Added special case code to handle conversion of the smallest long - integer -2147483648 from ASCII string to number. - - -c.lib 1.24 (12.12.2002) - -- vfprintf() couldn't convert -2147483648 into a string. This is what - caused GCC to fail rebuilding itself. Fixed. - - -c.lib 1.23 (12.12.2002) - -- setvbuf() now consistently accepts a size value of 0, whereupon - it will default to "no buffering" mode. - -- Ouch. My "optimization" for unbuffered streams did not work if the - buffer size was set to zero. Fixed. - - -c.lib 1.22 (12.12.2002) - -- The buffered file I/O routines no longer take care of appending - data to the end of the file. This is now done entirely by the - file descriptor layer. - -- fread() could in unbuffered mode end up reading partial elements - from the file. It now backs up to change the file position to take - the exact number of records into account that should have been - read. - -- setvbuf() now frees the custom file buffer before replacing it - with a user supplied buffer. - -- stderr is no longer buffered by default (as it should be). However, - optimizations are in place to make vfprintf() and fputs() queue their - output until they return. - - -net.lib 1.5 (12.12.2002) - -- Replaced the inline header files. - -- When launched as a daemon from inetd or similar, the daemon socket - passed to the startup code is now adopted for stdin. Previously, - three new sockets were duplicated from the daemon socket. Also, - the three stdio streams are no longer buffered by default. The - file descriptor setup now matches the standard I/O setup in that - stdin can be read from and stdout/stderr can be written to. - - -c.lib 1.21 (10.12.2002) - -- The path name translation code could end up clobbering the original - string. Fixed. - -- The command name translation in system() did not work right. It - ended up translating the entire string which bombed with very - long command lines. Same problem for popen(), same fix. - -- Updated the Unix name translation code to bail out of the string - to translate is too long to be translated in the first place. - Previously, it just trashed the stack :( - -- system() now calls SystemTagList() with SYS_UserShell=TRUE. - -- Fixed up the header files so that function pointers for the debug - routines actually work. This became apparent when I was trying to - rebuild the binutils with the clib2. - -- The header file no longer pulls in - by default. If it hasn't been included yet, then only the timeval - structure is defined. - - -c.lib 1.20 (8.12.2002) - -- The stdio buffered file I/O routines now clear their error indicators - before work begins. - -- Simplified the code to back the lseek() function. It no longer calls - Seek() twice if the file position does not change. - -- fgetc() and fputc() now set errno to EBADF if the file in question - cannot be read from or written to, respectively. - - -amiga.lib 1.3 (8.12.2002) - -- The name of the memory pool is now placed at an odd memory location. - - -c.lib 1.19 (4.12.2002) - -- index()/rindex()/strchr()/strrch() now perform signed byte - comparisons. These used to be unsigned. - -- Added a cast to memchr() to make sure that the comparison - is performed on unsigned bytes. - -- fseek() and fsetpos() now clear the file EOF condition. - - -c.lib 1.18 (29.11.2002) - -- ftruncate() no longer works for files which aren't open for writing. - -- Simplified the __show_error() code. - -- When allocating a custom buffer, setvbuf() didn't actually fill in - the allocated buffer's address, causing data to be trashed. Fixed. - Setting the buffer size to zero now works only for the - "don't buffer" mode. If the buffer size was changed, the previous - buffer was not flushed to disk before. - -- If an attempt to flush a file write buffer fails, the next attempt - to put data into the buffer will retry flushing the buffer. - Previously, data would have been written beyond the bounds of the - buffer. - -- If fgets() hits an error, it now NUL terminates the string - to be on the safe side. - -- Lost the (disabled) asyncio code. - -- The startup file for SMALL_DATA32 mode did not set up register A4 - at all. Ouch. - - -amiga.lib 1.2 (29.11.2002) - -- Fixed the RVI code to look & work more like the original implementation. - - -m.lib 1.2 (7.11.2002) - -- pow() called the IEEEDPPow() LVO with the x/y parameters reversed. - Actually, IEEEDPPow() seems to be the one to blame [Andrija Antonijevic]. - -- __fixunsdfsi() and __fixunssfsi() had a cast in the wrong place. - The original libnix functions these were based on were still - correct [Andrija Antonijevic]. - - -m881.lib 1.2 (7.11.2002) - -- __fixunsdfsi() and __fixunssfsi() had a cast in the wrong place. - The original libnix functions these were based on were still - correct [Andrija Antonijevic]. - - -c.lib 1.17 (7.11.2002) - -- ftell() now returns the current file position rather than invoking - fseek(), which does something different altogether [Andrija Antonijevic]. - -- fgetpos() now calls ftell() [Andrija Antonijevic]. - -- fsetpos() didn't properly evaluate the return value of fseek() - which would have been -1 in case of error [Andrija Antonijevic]. - -- fseek() now returns 0 for success and -1 for error [Andrija Antonijevic]. - - -c.lib 1.16 (5.11.2002) - -- memcpy() and memmove() had a debug switch wired the wrong way - round, causing the wrong kind of code to be emitted. Code which - could call exec.library/CopyMem and shouldn't have called it. - Fixed. It no longer depends upon exec.library. - -- Removed all the abort signal routines from the string formatting - code. This kind of action is now done solely by the I/O routines. - - -c.lib 1.15 (4.11.2002) - -- sscanf() ended up calling vfprintf(). Ouch. - -- Practically none of the numeric conversion operations in the scanf() - family actually worked. Fixed. - -- scanf() and friends now push a character back upon detecting an - overflow rather than using it and setting the number converted to - MAXINT. - - -c.lib 1.14 (21.10.2002) - -- Rewrote strcasecmp() and strncasecmp() to work more like strcmp() and - strncmp(). Previously, these functions would drop into the utility.library - routines Stricmp() and Strnicmp() which don't work like strcmp() or - strncmp(), respectively. - -- Rewrote the code that closes file descriptors. It should now be much smarter - in handling duplicates. - -- fchmod() invoked the wrong hook action which could lead to a crash. - -- Added wrapper code for ExamineFH() to avoid crashing due to a bug in - dos.library V40 and below with NIL: file handles. - -- The temporary directory locks set up for temporary files were never - unlocked. - -- Submitting an untracked memory region to be freed did not produce the - intended error output. - - -c.lib 1.13 (7.10.2002) - -- The vfprintf() family didn't produce any sign characters at all unless - a field width specifier was used [Andrija Antonijevic]. - - -c.lib 1.12 (28.9.2002) - -- The vfprintf() family got the hexadecimal number conversion (and the pointer - conversion, too) wrong because the conversion string had an extra zero digit - in it [Detlef Würkner]. - - -c.lib 1.11 (15.9.2002) - -- In the printf() family, the default case for '%c' (plain character - output without padding) did not update the length of the string - created [Andrija Antonijevic]. - - -c.lib 1.10 (11.9.2002) - -- In gettimeofday() the important DateStamp() call was missing [Andrija - Antonijevic]. - -- Removed the replacement remainder calculation code. It's not necessary. - - -c.lib 1.9 (7.9.2002) - -- Added replacement code for the two routines the updated compiler will call - in place of the inline '020 math which cannot be used on the '060. This - ought to be done smarter, but this works, too. - - -c.lib 1.8 (28.8.2002) - -- The open() code now avoids calling Lock() on NIL:, which otherwise could - have caused the file open action to follow later to be skipped. - -- Added more compiler internal code to support SAS/C. - -- Increased the size of the memory debugging walls. - -- When reading data off stdin character by character, the stdout and - stderr streams are now flushed first. - - -c.lib 1.7 (27.8.2002) - -- Discovered that ExamineFH() and ChangeMode() will crash on file - handles which refer to "NIL:". Put a workaround for these into - the open() code. - - -c.lib 1.6 (27.8.2002) - -- With the standard I/O streams the vfprintf() code would still add a - terminating NUL byte to each string printed. Fixed. - -- The open() code now checks before it opens if the file in question - can be overwritten, should this be necessary. Likewise, once the - file in question has opened, its protection bits are examined to - verify that the access mode it has been opened for is applicable - in the first place. - -- The asynchronous I/O option now works only for O_RDONLY and O_WRONLY - mode access. - - -c.lib 1.5 (25.8.2002) - -- fread() treated EOF as an error, returning with 0 characters read - from the buffer even if there was still some data in the buffer that - could be read. - -- fread() now seeks back to the last location it could read an entire - element from. Subsequent fgetc() calls will thus pick up the data - not processed by the previous fread() call. Also, if fread() encounters - an error, it seeks back to where the read was supposed to begin. - - -c.lib 1.4 (22.8.2002) - -- Updated the ctype_headers.h, locale_headers.h, math_headers.h, - signal_headers.h, stdio_headers.h, stdlib_headers.h, string_headers.h, - strings_headers.h and time_headers.h header files. The extern library - definitions are now in the SAS/C branch. - -- Moved the __is_daemon definition from unistd.h into dos.h and changed - its type as well. - - -net.lib 1.4 (22.8.2002) - -- Updated the SAS/C compatible prototypes and #pragma definitions. - - -c.lib 1.3 (22.8.2002) - -- Files opened in exclusive access mode are now switched back into - shared access mode for testing. - -- The asynchronous file I/O is now enabled only for read and write - access. Appending is disabled. - -- You now have more control over the asynchronous file I/O and can - enable it on demand and specify the default buffer size. - -- You can now provide for a callback function that initializes the - default stack size to use early on during the runtime configuration - process. - - -net.lib 1.3 (22.8.2002) - -- getgroups() and setgroups() now ignore the second parameter if the - number of groups involved is zero. - -- Upon startup, the runtime environment now sets a global variable - to 1 if the current program was launched by the internet superserver - or an equivalent facility. - - -c.lib 1.2 (21.8.2002) - -- Added sigaddset() and sigemptyset(). - -- isxdigit() didn't work. Fixed. - - -net.lib 1.2 (21.8.2002) - -- Added setpwent(), getpwent(), endpwent(), setgrent(), getgrent() and - endgrent() - - ----------------------------------------------------------------------------- - -amiga.lib 1.1 (20.08.2002) - -- Now bears a version number. - - -c.lib 1.1 (20.08.2002) - -- Now bears a version number. - - -debug.lib 1.1 (20.08.2002) - -- Now bears a version number. - - -m.lib 1.1 (20.08.2002) - -- Now bears a version number. - - -m881.lib 1.1 (20.08.2002) - -- Now bears a version number. - - -net.lib 1.1 (20.08.2002) - -- Now bears a version number. - - -stack.lib 1.1 (20.08.2002) - -- Now bears a version number. - - -unix.lib 1.1 (20.08.2002) - -- Now bears a version number. - - ----------------------------------------------------------------------------- - -- '%f' floating point output now also works for numbers > 9. - -- needs to include and . - -- now only defines a bunch of data types, it no - longer includes any header files. - -- Activated the local bcopy() and ovbcopy() code. - -- Added ACrypt(). - -- Added CreateTask() and DeleteTask(). - -- Added Sebastian's fix for vsprintf(), which did not generate - a '-' at all appropriate times. - -- Added Unix-style directory scanning with pseudo "/" directory - support. - -- Added __stdio_configure_streams() to reconfigure the stream - I/O after the Workbench output window has been opened. - -- Added a local NewList() replacement. - -- Added a plain 68k version of the setjump()/longjmp() pair. - -- Added an extra call to __check_abort() after each - bsdsocket.library call. Because, if a ^C was registered, - causing the respective function call to return, the signal - will still be set, waiting to be picked up. - -- Added assertions to vfscanf(). - -- Added basename(), dirname(), asprintf(), snprintf(), - vasprintf(), vsnprintf(), mkdtemp(), mkstemp(), mktemp(), - putenv(), setenv(), unsetenv(), strcasecmp(), strncasecmp(), - strdup(), gettimeofday() and alloca(). - -- Added data and code to support SAS/C stack overflow checking - and abort. - -- Added further ^C checking to closedir(), opendir(), readdir(), - rewinddir(), creat(), open(), read(), write(), chmod(), fchmod(), - fstat(), lstat(), mkdir(), rmdir(), stat(), fprintf(), fputs(), - ftell(), getc(), getchar(), gets(), __open_iob(), printf(), - putc(), putchar(), puts(), rewind(), setbuf(), sprintf(), - tmpfile(), tmpnam(), vfprintf(), __vfscan(), vprintf(), - vsprintf(), getenv(), system(), strtod(), strtol(), strtoul(), - strftime(), access(), chdir(), chown(), fchown(), fileno(), - ftruncate(), getcwd(), getopt(), lchown(), link(), readlink(), - sleep(), symlink(), truncate(), unlink() and utime(). - -- Added getopt(), kill() and getpid(). - -- Added grp.h and pwd.h header files. - -- Added isatty(). - -- Added more assertions and tests to detect illegal parameters - earlier than before. - -- Added more assertions to strftime(). - -- Added more casts to (size_t) where appropriate. - -- Added more memory debugging hooks to other routines which - implicitly allocate memory and return it. - -- Added more of the GCC specific support routines. - -- Added new __get_a4() and __set_a4() routines to the startup - code. Also put them into the header file. - -- Added platform specific header file. - -- Added popen() and pclose(). - -- Added some more assertions to qsort(). - -- Added some of the bsdsocket.library stubs required for - Samba 2.0.7 to work. - -- Added stack size checking support. - -- Added stack swapping code. - -- Added statfs() and fstatfs(). - -- Added stub code to handle double precision IEEE math. - -- Added support code to emulate the behaviour of debug.lib. - -- Added the Amiga/Unix name translation code. - -- Added the GCC specific floating point runtime library routines. - -- Added the GCC specific startup code. - -- Added the README file. - -- Added the amiga.lib RVI code. - -- Added the hook and method functions from amiga.lib. - -- Added the math support code. - -- Added the memory allocation debugging code. - -- Added the memory pools code to the amiga.lib set. - -- Added the monitoring and debugging code. - -- Added the remaining few amiga.lib 'C' library routines. The - memory pools stuff is probably hopeless, but we'll what I can do. - -- Added the socket I/O wrapper. - -- Added the source code comments to the memory pools source code. - -- Added the stack extension code. It still has to be updated to - be more readable, though. - -- Added the wide character stubs. - -- Added umask(). - -- Added usergroup.library support. - -- All debug output now uses kprintf() again. - -- All memory allocations now use malloc() and free(). - -- Changed the manner in which the floating point support code is - compiled into the library. - -- Changed the name of the preprocessor symbol which activates - the Unix file name semantic support. - -- Changed the names of unused function parameters to match their uses. - -- Changed the way the library is built. We now build seven - different component libraries which all must be linked - separately. - -- Conditional branches no longer bear an 's' or 'w' suffix. - The assembler is supposed to find out all by itself which - one should be picked. - -- File descriptors and I/O buffers now receive the respective - data structures as part of the hook calling packet rather - than having to probe the h_Data contents. - -- Finally figured out what the %n format specifier is supposed - to accomplish in fprintf(). - -- Finally figured out what the __main() reference was good - for and implemented construtor and destructor support. - -- Fixed a bunch of compiler warnings. - -- Fixed more than one bug in sleep(). This time the code - hopefully works as advertized. - -- Fixed several bugs GCC highlighted. - -- Fixed two more compiler warnings related to signed/unsigned - comparisons. - -- For Workbench startup, the stderr stream is now merely an alias - for the stdout stream. - -- Forgot the SAS/C CallHookA() stub. - -- Forgot to add the stubs for the socket and usergroup components. - -- Found and worked around two more code generation problems with - WaitSelect() and recvfrom(). - -- GMT+0 always came out as GMT+ with strftime(). It now stays GMT. - -- If possible, memory pools are used for memory management. - -- In we now define sigset_t rather than in . - -- In CreateTask(), the recovery from a failed AllocEntry() call - was flawed. Reread the exec source code and fixed that bug. - -- In alloca(), no unused memory was ever freed. - -- In listen() a test to see if the file descriptor was really a - socket was missing. - -- In memmove(), the local ovbcopy() code is now smarter about the - registers it has to save. - -- In stat(), lstat() and fstat() the st_dev structure member is - now initialized with the address of the file system's MsgPort - the respective directory/file is stored on. This allows file - descriptors to be compared. - -- In strstr() there is now a test to make sure that the substring - is smaller or equal in size to the big string to be searched in. - -- In vfprintf() the '%g' output format always came out as '%e' if - the precision was uninitialized. Fixed. - -- Instead of passing local variables around to show errors or to - display the current program name, the whole code now uses global - variables. - -- Integrated a modified version of the Commodore asynchronous file - I/O code into the library, mainly for the benefit of Samba. - -- Integrated the default stack size checking variables into the - makefiles. - -- Integrated the extra super elaborate advisory file locking code - which worked so well with Samba. Or did it? With the new library - it appears that opportunistic locks don't work any more. I'm not - so sure if they ever did :( - -- Knocked up replacement functions for amiga.lib and SAS/C runtime - library functions. - -- Looks like Samba needs the super elaborate locking method after - all. Oh well... - -- Modified the startup code and the assembly language fragments - to support the -fbaserel32 option. Built Samba 2.0.7 with it, - which actually seems to work OK. - -- Modified the unistd.h header file to avoid clashes with the - TCP/IP header files. - -- More components are now part of libunix.a to make sure that the right replacement functions are linked in. - -- Moved NewList() into its own source file. This is supposed to - be more compatible with amiga.lib. - -- Moved all the functions which are unimplemented out of the build - files. The old build makefiles are still around, though. - -- Moved the fundamental file descriptor I/O into the stdio branch. - The fcntl branch now only contains stubs. - -- Moved the locale references made in strtod() into the math - libraries, too. - -- Moved the macro definitions into a separate header file. - -- Moved the string hook code into sscanf(). - -- No longer uses the cooked version of for the build. - A local "debug.h" header file is used instead. - -- Now actually compiles and links with GCC. - -- Now builds code for the 68020-60 target rather than 68020-40. - -- Now builds with SAS/C again. - -- Only a single error message should appear during startup, not - a long list of messages for each problem that might appear. - -- Oops. Forgot the constructor/destructor defaults for GCC. - -- Oops. One variable was uninitialized. - -- Plugged in the optimized assembly language data copying code. - -- Preparations for %ll support in vfprintf() and vfscanf(). - -- Rebuilt with GCC, which revealed a problem in calling - AutoRequest(). Fixed. - -- Rebuilt with new GCC inline macros which yield better code. - -- Redid the BOOPSI functions in 'C'. - -- Redid the qsort() code, borrowing snippets from libnix2. - -- Reduced the complexity of fseek() a bit. - -- Renamed stdio_unixsemantics.c to stdio_unixbehaviour.c. - -- Reorganized the libdebug.a source code. Each file now contains - only a single routine. - -- Replaced all unconditional branches with jbra. - -- Restored the old advisory record locking code to see if it - makes a difference. - -- Reviewed the stack extension code and added comments. Now - uses pooled memory allocations instead of AllocMem()/FreeMem() - if possible. - -- Reworked the header file set to key off the compiler used. - -- Reworked the popen() initialization code. - -- Rewrote the ncrt0.S and nrcrt0.S startup code again, trying to - make it simpler. - -- Rewrote the setjmp()/longjmp() code to also save and restore - the floating point register set if there is an FPU installed. - -- Separated the code paths for alloca(), malloc(), realloc() - and free(). They all call intermediate routines to get their - jobs done. - -- Simplified error return codes in many components. - -- Simplified the build makefile. - -- Stack swapping appears to work. - -- Switched compiler options to large data/large code to keep - SAS/C out of my hair. - -- Tested the Unix name semantics translation. - -- The 'e', 'f' and 'g' formatting commands produce no output - the floating point support code is not built into the library. - -- The Amiga/Unix name translation routines now treat "" and "." - special. - -- The FLOATING_POINT_SUPPORT macro definition never checked for - the M68881_FLOATING_POINT_SUPPORT symbol. Fixed. - -- The HUGE_VAL constant now actually refers to a constant floating - point number which the startup code will initialize with 'positive - infinity'. - -- The IEEE math code now compiles properly. - -- The IEEE math libraries are now opened requiring version 33 or - higher. Earlier versions did not support floor() or ceil(). - -- The Unix name translation code now allows for files in /dev to - be accessed. /dev/null, however, is still mapped to NIL:. - -- The __swap_stack_and_call() function never actually loaded A6 - with SysBase. Guess I was lucky... - -- The _main() startup code now displays error messages and is more - careful about mucking with the program's streams and current - directory configuration. - -- The abort() and raise() code now shares the same error message. - -- The abort() code now drops into _exit() rather than relying - upon raise() to do this. - -- The amiga_rexxvars code no longer uses 'fp' in place of 'a5'. - -- The asyncio.c code now uses the local bcopy() routine rather - than calling into CopyMem(). The local bcopy() is a lot faster. - -- The atexit() processing now takes care of all registered - functions, even if exit() is called by one of them. - -- The constructor/destructor support code could crash if no - such functions were present in the binary. Fixed. - -- The conversion of the program startup parameters to a command - vector now works as expected. - -- The debug.h header file now also works with GCC (sort of). - -- The file descriptor duplication is now done in the respective hook. - -- The fundamental lseek() code could trash the current file - position. Fixed. - -- The kgetnum() code did not properly update the character - position for the sign and the digits. Fixed. - -- The libdebug.a code is now fully self contained, so that it may - be linked in last. - -- The log tag initialization in the socket setup code did not work - properly. Fixed. - -- The math routines are now compiled only if the preprocessor - symbols are set up for them to build. - -- The name translation routine in readlink() changed the wrong name. - Fixed. - -- The new test code also prints an integer and a rational number - to test floating point output. - -- The non-blocking console I/O flag was not reset as it should have - been. Fixed. - -- The numeric and collation locale references were still using - the old locale variables. Fixed. - -- The numeric conversion routine used by the time code did not - generate proper ASCII digits. Fixed. - -- The old record locking code needed to be integrated better. - -- The pseudo-root directory containing all volumes is now scanned - entirely within readdir(); opendir() now only collects the - available volume names. - -- The raw I/O routines no longer reference the SysBase variable. - -- The return code of rename() was always the opposite of what - it really should have been. Fixed. - -- The socket code is now compiled conditionally. - -- The special behaviour of remove() and rename() is now a compile - time option. - -- The stack extension setup and cleanup routines are actually - called now. - -- The stack size checking code is no longer built if the stack - extension code is to be used. - -- The stdlib initialization code now attempts to create a memory - pool. This is done exactly once. - -- The time conversion code no longer drops into assert() if the - time stamp is not within the supported Amiga time window. - -- The unlink() and rename() functions can now be configured to - perform vaguely like on a Unix system. - -- There is still something wrong with the built-in functions, so - I disabled them in the makefile. - -- Tried to find a way to allow for ":" to pass through the Unix - file name translation process without being mistaken for the - pseudo-root directory. - -- Triggering a call to exit() while the program is already on the - way out should now be considerably safer than it used to be and - no longer end in recursion. - -- Turned out that in order to be residentable, the constant - __huge_val cannot actually be replaced at runtime with positive - infinity. So the __huge_val is no longer constant, but a cast in - forces it to be. - -- Turns out that the GNU linker visits each library only once. - Bummer. Had to reorganize the source code again and now libnet.a - contains only those special versions of the file access routines - which use Unix-like semantics and behaviour. - -- Updated several instances of signed vs. unsigned comparisons. - -- Updated the GNUMakefil to be more portable and to build all the - library flavours necessary. - -- Updated the object file list. - -- When using socket I/O as a daemon, no error messages are sent to - stderr by abort() or raise(). - -- Whoops. Overlooked two files which should have gone into the - repository much earlier. - -- Workbench startup now opens a default output window. - -- __fixunsdfsi() and __fixunssfsi() didn't actually do anything - useful. Fixed. - -- __locale_exit() should no longer close the same locale twice. - -- __open_iob() now truncates files for "w+" mode. - -- __stdio_exit() and close() should handle closing of an aliased - file descriptor properly now. - -- _main() now checks how much stack space was actually used and - prints that number. - -- access() now always returns an error if a file does not exist. - This fixes open(), which could fail if a file did not exist - even though it should have failed if it existed. - -- assert() now prints the program name. - -- assert() now throughs an Enforcer hit to make bug tracking easier. - -- assert() now uses kprintf() to print its messages. - -- bcopy() no longer calls into memcpy(). - -- bzero() no longer calls into memset(). - -- clock() did not work properly. Fixed. - -- free() and malloc() now mangle the contents of the memory - buffer before they return unless the NDEBUG symbol is defined. - -- free() now also invokes the alloca() drop code. - -- fseek() could end in an assertion if no data had been read from - the file yet. Fixed. - -- fstat() now also works on sockets. - -- getcwd() always trashed memory if "/" was returned. Fixed. - -- getcwd() now takes the / directory into account. - -- index() and rindex() no longer invoke strchr() and strrch(). - -- lseek() returns the file position reached after the file - pointer has been repositioned. - -- mktemp() always changed the wrong string. Fixed. - -- mktemp() ran over the end of the buffer, only that this didn't - really matter up until now. - -- popen() didn't actually compile. Fixed. - -- printf() and friends no longer attempt to NUL terminate streams. - -- qsort() and bsearch() no longer drop into abort() if their - invalid parameters don't matter because there is no data to - examine. - -- readlink() now attempts to let dos.library resolve the path - and then returns an absolute path name. If that doesn't work, - it invokes ReadLink() instead. - -- realloc() no longer needs to know about the manner in which - the allocation itself is managed. - -- remove() now calls unlink(). - -- rename() now returns -1 on error, not 0 as it could have done - accidentally. - -- setvbuf() doesn't really need to go through the memory - allocation debugging code. The memory allocated isn't visible - to the outside. - -- size_t parameters are now tested to see if they might have been - negative integers originally. - -- sleep() tries to be nicer about the timer I/O request in progress. - -- snprintf() now returns the number of characters that would - have been written to the buffer, now matter how many could - really be stored. - -- stat() now makes up pseudo data for the pseudo root directory. - -- statfs() now also knows how to treat the pseudo root directory. - -- strchr() and strrchr() now perform their comparisons on - unsigned characters. - -- strings.h didn't actually compile. Fixed. - -- time() did not add any seconds to the current time. Fixed. - -- tmpnam() could return with AmigaDOS requesters disabled for - the shell. Fixed. - -- unlink() now checks if the file to be deleted has been set up - for deletion before. - -- vfprintf() now uses fputc() to dump strings rather than calling - fwrite(). This has the effect of flushing the buffer properly - if there are line feed characters in the string specified for %s. diff --git a/library/complex_carg.c b/library/complex_carg.c deleted file mode 100644 index 3f6490d..0000000 --- a/library/complex_carg.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: complex_carg.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _COMPLEX_HEADERS_H -#include "complex_headers.h" -#endif /* _COMPLEX_HEADERS_H */ - -/****************************************************************************/ - -#if defined(COMPLEX_SUPPORT) - -/****************************************************************************/ - -double -carg(double complex z) -{ - return(atan2(IMAG(z),REAL(z))); -} - -/****************************************************************************/ - -#endif /* COMPLEX_SUPPORT */ diff --git a/library/complex_cargf.c b/library/complex_cargf.c deleted file mode 100644 index d63d45d..0000000 --- a/library/complex_cargf.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: complex_cargf.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _COMPLEX_HEADERS_H -#include "complex_headers.h" -#endif /* _COMPLEX_HEADERS_H */ - -/****************************************************************************/ - -#if defined(COMPLEX_SUPPORT) - -/****************************************************************************/ - -float -cargf(float complex z) -{ - return(atan2(IMAG(z),REAL(z))); /* ZZZ this really needs to call ata2f(). */ -} - -/****************************************************************************/ - -#endif /* COMPLEX_SUPPORT */ diff --git a/library/complex_cargl.c b/library/complex_cargl.c deleted file mode 100644 index 3293b7c..0000000 --- a/library/complex_cargl.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: complex_cargl.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _COMPLEX_HEADERS_H -#include "complex_headers.h" -#endif /* _COMPLEX_HEADERS_H */ - -/****************************************************************************/ - -#if defined(COMPLEX_SUPPORT) - -/****************************************************************************/ - -long double -cargl(long double complex z) -{ - return(atan2(IMAG(z),REAL(z))); /* ZZZ this really needs to call atan2l(). */ -} - -/****************************************************************************/ - -#endif /* COMPLEX_SUPPORT */ diff --git a/library/complex_cimag.c b/library/complex_cimag.c deleted file mode 100644 index 473300e..0000000 --- a/library/complex_cimag.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: complex_cimag.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _COMPLEX_HEADERS_H -#include "complex_headers.h" -#endif /* _COMPLEX_HEADERS_H */ - -/****************************************************************************/ - -#if defined(COMPLEX_SUPPORT) - -/****************************************************************************/ - -double -cimag(double complex z) -{ - return(IMAG(z)); -} - -/****************************************************************************/ - -#endif /* COMPLEX_SUPPORT */ diff --git a/library/complex_cimagf.c b/library/complex_cimagf.c deleted file mode 100644 index bcd26d0..0000000 --- a/library/complex_cimagf.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: complex_cimagf.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _COMPLEX_HEADERS_H -#include "complex_headers.h" -#endif /* _COMPLEX_HEADERS_H */ - -/****************************************************************************/ - -#if defined(COMPLEX_SUPPORT) - -/****************************************************************************/ - -float -cimagf(float complex z) -{ - return(IMAG(z)); -} - -/****************************************************************************/ - -#endif /* COMPLEX_SUPPORT */ diff --git a/library/complex_cimagl.c b/library/complex_cimagl.c deleted file mode 100644 index 77b4206..0000000 --- a/library/complex_cimagl.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: complex_cimagl.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _COMPLEX_HEADERS_H -#include "complex_headers.h" -#endif /* _COMPLEX_HEADERS_H */ - -/****************************************************************************/ - -#if defined(COMPLEX_SUPPORT) - -/****************************************************************************/ - -long double -cimagl(long double complex z) -{ - return(IMAG(z)); -} - -/****************************************************************************/ - -#endif /* COMPLEX_SUPPORT */ diff --git a/library/complex_conj.c b/library/complex_conj.c deleted file mode 100644 index 7173562..0000000 --- a/library/complex_conj.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: complex_conj.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _COMPLEX_HEADERS_H -#include "complex_headers.h" -#endif /* _COMPLEX_HEADERS_H */ - -/****************************************************************************/ - -#if defined(COMPLEX_SUPPORT) - -/****************************************************************************/ - -double complex -conj(double complex z) -{ - return(CONJ(z)); -} - -/****************************************************************************/ - -#endif /* COMPLEX_SUPPORT */ diff --git a/library/complex_conjf.c b/library/complex_conjf.c deleted file mode 100644 index ff2b778..0000000 --- a/library/complex_conjf.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: complex_conjf.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _COMPLEX_HEADERS_H -#include "complex_headers.h" -#endif /* _COMPLEX_HEADERS_H */ - -/****************************************************************************/ - -#if defined(COMPLEX_SUPPORT) - -/****************************************************************************/ - -float complex -conjf(float complex z) -{ - return(CONJ(z)); -} - -/****************************************************************************/ - -#endif /* COMPLEX_SUPPORT */ diff --git a/library/complex_conjl.c b/library/complex_conjl.c deleted file mode 100644 index 8871b39..0000000 --- a/library/complex_conjl.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: complex_conjl.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _COMPLEX_HEADERS_H -#include "complex_headers.h" -#endif /* _COMPLEX_HEADERS_H */ - -/****************************************************************************/ - -#if defined(COMPLEX_SUPPORT) - -/****************************************************************************/ - -long double complex -conjl(long double complex z) -{ - return(CONJ(z)); -} - -/****************************************************************************/ - -#endif /* COMPLEX_SUPPORT */ diff --git a/library/complex_creal.c b/library/complex_creal.c deleted file mode 100644 index fec8ec1..0000000 --- a/library/complex_creal.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: complex_creal.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _COMPLEX_HEADERS_H -#include "complex_headers.h" -#endif /* _COMPLEX_HEADERS_H */ - -/****************************************************************************/ - -#if defined(COMPLEX_SUPPORT) - -/****************************************************************************/ - -double -creal(double complex z) -{ - return(REAL(z)); -} - -/****************************************************************************/ - -#endif /* COMPLEX_SUPPORT */ diff --git a/library/complex_crealf.c b/library/complex_crealf.c deleted file mode 100644 index 09a4380..0000000 --- a/library/complex_crealf.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: complex_crealf.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _COMPLEX_HEADERS_H -#include "complex_headers.h" -#endif /* _COMPLEX_HEADERS_H */ - -/****************************************************************************/ - -#if defined(COMPLEX_SUPPORT) - -/****************************************************************************/ - -float -crealf(float complex z) -{ - return(REAL(z)); -} - -/****************************************************************************/ - -#endif /* COMPLEX_SUPPORT */ diff --git a/library/complex_creall.c b/library/complex_creall.c deleted file mode 100644 index 4236d03..0000000 --- a/library/complex_creall.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: complex_creall.c,v 1.1 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _COMPLEX_HEADERS_H -#include "complex_headers.h" -#endif /* _COMPLEX_HEADERS_H */ - -/****************************************************************************/ - -#if defined(COMPLEX_SUPPORT) - -/****************************************************************************/ - -long double -creall(long double complex z) -{ - return(REAL(z)); -} - -/****************************************************************************/ - -#endif /* COMPLEX_SUPPORT */ diff --git a/library/complex_headers.h b/library/complex_headers.h deleted file mode 100755 index 415ab90..0000000 --- a/library/complex_headers.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * $Id: complex_headers.h,v 1.3 2005-05-12 14:50:06 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _COMPLEX_HEADERS_H -#define _COMPLEX_HEADERS_H - -/****************************************************************************/ - -#ifndef _MATH_FP_SUPPORT_H -#include "math_fp_support.h" -#endif /* _MATH_FP_SUPPORT_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) && defined(__GNUC__) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#define COMPLEX_SUPPORT - -/****************************************************************************/ - -#define REAL(z) (__real__ (z)) -#define IMAG(z) (__imag__ (z)) -#define CONJ(z) (~(z)) - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT && __GNUC__ && __STDC_VERSION__ */ - -/****************************************************************************/ - -#endif /* _COMPLEX_HEADERS_H */ diff --git a/library/crt0.S b/library/crt0.S deleted file mode 100644 index d952d3e..0000000 --- a/library/crt0.S +++ /dev/null @@ -1,27 +0,0 @@ -// -// $Id: crt0.S,v 1.3 2005-06-26 12:02:56 tfrieden 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 - -#if defined(BASEREL_DATA) - /* We also need to set up the data segment pointer */ - lis r2, _DATA_BASE_@ha - addi r2, r2, _DATA_BASE_@l -#endif - - b _main diff --git a/library/crtbegin.c b/library/crtbegin.c deleted file mode 100644 index b08a9c8..0000000 --- a/library/crtbegin.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * $Id: crtbegin.c,v 1.10 2005-03-18 12:38:22 obarthel Exp $ - * - * :ts=4 - * - * Handles global constructors and destructors for the OS4 GCC build. - */ - -#if defined(__amigaos4__) - -/****************************************************************************/ - -#ifndef EXEC_TYPES_H -#include -#endif /* EXEC_TYPES_H */ - -/****************************************************************************/ - -/* - * 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__(( used, section(".ctors"), aligned(sizeof(void (*)(void))) )); -static void (*__DTOR_LIST__[1]) (void) __attribute__(( used, section(".dtors"), aligned(sizeof(void (*)(void))) )); - -/****************************************************************************/ - -void -_init(void) -{ - int num_ctors,i; - int j; - - for(i = 1, num_ctors = 0 ; __CTOR_LIST__[i] != NULL ; i++) - num_ctors++; - - for(j = 0 ; j < num_ctors ; j++) - __CTOR_LIST__[num_ctors - j](); -} - -/****************************************************************************/ - -void -_fini(void) -{ - int num_dtors,i; - static int j; - - for(i = 1, num_dtors = 0 ; __DTOR_LIST__[i] != NULL ; i++) - num_dtors++; - - while(j++ < num_dtors) - __DTOR_LIST__[j](); -} - -/****************************************************************************/ - -#endif /*__amigaos4__ */ diff --git a/library/crtend.c b/library/crtend.c deleted file mode 100644 index 78fde73..0000000 --- a/library/crtend.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * $Id: crtend.c,v 1.2 2005-03-09 21:07:25 obarthel Exp $ - * - * :ts=4 - * - * End markers for the CTOR and DTOR list. - */ - -#if defined(__amigaos4__) - -/****************************************************************************/ - -static void (*__CTOR_LIST__[1]) (void) __attribute__((used, section(".ctors"), aligned(sizeof(void (*)(void))) )); -static void (*__DTOR_LIST__[1]) (void) __attribute__((used, section(".dtors"), aligned(sizeof(void (*)(void))) )); - -/****************************************************************************/ - -#endif /*__amigaos4__ */ - diff --git a/library/ctype_headers.h b/library/ctype_headers.h deleted file mode 100644 index 5d44e32..0000000 --- a/library/ctype_headers.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * $Id: ctype_headers.h,v 1.5 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_LOCALEBASE_H -#include "stdlib_localebase.h" -#endif /* _STDLIB_LOCALEBASE_H */ - -#ifndef _STDLIB_UTILITYBASE_H -#include "stdlib_utilitybase.h" -#endif /* _STDLIB_UTILITYBASE_H */ - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_H */ - -/****************************************************************************/ - -#include -#include -#include -#include - -/****************************************************************************/ - -#endif /* _CTYPE_HEADERS_H */ diff --git a/library/ctype_isalnum.c b/library/ctype_isalnum.c deleted file mode 100644 index d3e6a4e..0000000 --- a/library/ctype_isalnum.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * $Id: ctype_isalnum.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; - - __locale_lock(); - - if(__locale_table[LC_CTYPE] != NULL) - { - assert( LocaleBase != NULL ); - - /* The parameter must be either EOF or in the range of an - 'unsigned char'. If it's not, then the behaviour is - undefined. */ - if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX))) - result = IsAlNum(__locale_table[LC_CTYPE],(ULONG)(c & 255)); - else - result = FALSE; - } - else - { - result = isalpha(c) || isdigit(c); - } - - __locale_unlock(); - - return(result); -} diff --git a/library/ctype_isalpha.c b/library/ctype_isalpha.c deleted file mode 100644 index 014adfa..0000000 --- a/library/ctype_isalpha.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * $Id: ctype_isalpha.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; - - __locale_lock(); - - if(__locale_table[LC_CTYPE] != NULL) - { - assert( LocaleBase != NULL ); - - /* The parameter must be either EOF or in the range of an - 'unsigned char'. If it's not, then the behaviour is - undefined. */ - if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX))) - result = IsAlpha(__locale_table[LC_CTYPE],(ULONG)(c & 255)); - else - result = FALSE; - } - else - { - result = (('a' <= c && c <= 'z') || - ('A' <= c && c <= 'Z')); - } - - __locale_unlock(); - - return(result); -} diff --git a/library/ctype_isascii.c b/library/ctype_isascii.c deleted file mode 100644 index 7a2db2e..0000000 --- a/library/ctype_isascii.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: ctype_isascii.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/ctype_isblank.c b/library/ctype_isblank.c deleted file mode 100644 index e23c104..0000000 --- a/library/ctype_isblank.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: ctype_isblank.c,v 1.2 2005-05-29 08:19:36 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 isblank - -/****************************************************************************/ - -int -isblank(int c) -{ - int result; - - result = (c == '\t' || c == ' '); - - return(result); -} diff --git a/library/ctype_iscntrl.c b/library/ctype_iscntrl.c deleted file mode 100644 index f5b750d..0000000 --- a/library/ctype_iscntrl.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: ctype_iscntrl.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; - - __locale_lock(); - - if(__locale_table[LC_CTYPE] != NULL) - { - assert( LocaleBase != NULL ); - - /* The parameter must be either EOF or in the range of an - 'unsigned char'. If it's not, then the behaviour is - undefined. */ - if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX))) - result = IsCntrl(__locale_table[LC_CTYPE],(ULONG)(c & 255)); - else - result = FALSE; - } - else - { - result = (('\0' <= c && c < ' ') || (c == 127)); - } - - __locale_unlock(); - - return(result); -} diff --git a/library/ctype_isdigit.c b/library/ctype_isdigit.c deleted file mode 100644 index bca6a35..0000000 --- a/library/ctype_isdigit.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: ctype_isdigit.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; - - __locale_lock(); - - if(__locale_table[LC_CTYPE] != NULL) - { - assert( LocaleBase != NULL ); - - /* The parameter must be either EOF or in the range of an - 'unsigned char'. If it's not, then the behaviour is - undefined. */ - if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX))) - result = IsDigit(__locale_table[LC_CTYPE],(ULONG)(c & 255)); - else - result = FALSE; - } - else - { - result = ('0' <= c && c <= '9'); - } - - __locale_unlock(); - - return(result); -} diff --git a/library/ctype_isgraph.c b/library/ctype_isgraph.c deleted file mode 100644 index b719c96..0000000 --- a/library/ctype_isgraph.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: ctype_isgraph.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; - - __locale_lock(); - - if(__locale_table[LC_CTYPE] != NULL) - { - assert( LocaleBase != NULL ); - - /* The parameter must be either EOF or in the range of an - 'unsigned char'. If it's not, then the behaviour is - undefined. */ - if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX))) - result = IsGraph(__locale_table[LC_CTYPE],(ULONG)(c & 255)); - else - result = FALSE; - } - else - { - result = (' ' < c && c < 127); - } - - __locale_unlock(); - - return(result); -} diff --git a/library/ctype_islower.c b/library/ctype_islower.c deleted file mode 100644 index 60e9548..0000000 --- a/library/ctype_islower.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: ctype_islower.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; - - __locale_lock(); - - if(__locale_table[LC_CTYPE] != NULL) - { - assert( LocaleBase != NULL ); - - /* The parameter must be either EOF or in the range of an - 'unsigned char'. If it's not, then the behaviour is - undefined. */ - if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX))) - result = IsLower(__locale_table[LC_CTYPE],(ULONG)(c & 255)); - else - result = FALSE; - } - else - { - result = ('a' <= c && c <= 'z'); - } - - __locale_unlock(); - - return(result); -} diff --git a/library/ctype_isprint.c b/library/ctype_isprint.c deleted file mode 100644 index 1ab3bbf..0000000 --- a/library/ctype_isprint.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: ctype_isprint.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; - - __locale_lock(); - - if(__locale_table[LC_CTYPE] != NULL) - { - assert( LocaleBase != NULL ); - - /* The parameter must be either EOF or in the range of an - 'unsigned char'. If it's not, then the behaviour is - undefined. */ - if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX))) - result = IsPrint(__locale_table[LC_CTYPE],(ULONG)(c & 255)); - else - result = FALSE; - } - else - { - result = (' ' <= c && c <= '~'); - } - - __locale_unlock(); - - return(result); -} diff --git a/library/ctype_ispunct.c b/library/ctype_ispunct.c deleted file mode 100644 index 1858dd1..0000000 --- a/library/ctype_ispunct.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: ctype_ispunct.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; - - __locale_lock(); - - if(__locale_table[LC_CTYPE] != NULL) - { - assert( LocaleBase != NULL ); - - /* The parameter must be either EOF or in the range of an - 'unsigned char'. If it's not, then the behaviour is - undefined. */ - if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX))) - result = IsPunct(__locale_table[LC_CTYPE],(ULONG)(c & 255)); - else - result = FALSE; - } - else - { - result = (('!' <= c && c <= '/') || - (':' <= c && c <= '@') || - ('[' <= c && c <= '`') || - ('{' <= c && c <= '~')); - } - - __locale_unlock(); - - return(result); -} diff --git a/library/ctype_isspace.c b/library/ctype_isspace.c deleted file mode 100644 index f3be162..0000000 --- a/library/ctype_isspace.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $Id: ctype_isspace.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; - - __locale_lock(); - - if(__locale_table[LC_CTYPE] != NULL) - { - assert( LocaleBase != NULL ); - - /* The parameter must be either EOF or in the range of an - 'unsigned char'. If it's not, then the behaviour is - undefined. */ - if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX))) - result = IsSpace(__locale_table[LC_CTYPE],(ULONG)(c & 255)); - else - result = FALSE; - } - else - { - result = (c == '\t' || - c == '\r' || - c == '\n' || - c == '\v' || - c == '\f' || - c == ' '); - } - - __locale_unlock(); - - return(result); -} diff --git a/library/ctype_isupper.c b/library/ctype_isupper.c deleted file mode 100644 index 6d96aa5..0000000 --- a/library/ctype_isupper.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: ctype_isupper.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; - - __locale_lock(); - - if(__locale_table[LC_CTYPE] != NULL) - { - assert( LocaleBase != NULL ); - - /* The parameter must be either EOF or in the range of an - 'unsigned char'. If it's not, then the behaviour is - undefined. */ - if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX))) - result = IsUpper(__locale_table[LC_CTYPE],(ULONG)(c & 255)); - else - result = FALSE; - } - else - { - result = ('A' <= c && c <= 'Z'); - } - - __locale_unlock(); - - return(result); -} diff --git a/library/ctype_isxdigit.c b/library/ctype_isxdigit.c deleted file mode 100644 index e081484..0000000 --- a/library/ctype_isxdigit.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * $Id: ctype_isxdigit.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; - - __locale_lock(); - - if(__locale_table[LC_CTYPE] != NULL) - { - assert( LocaleBase != NULL ); - - /* The parameter must be either EOF or in the range of an - 'unsigned char'. If it's not, then the behaviour is - undefined. */ - if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX))) - result = IsXDigit(__locale_table[LC_CTYPE],(ULONG)(c & 255)); - else - result = FALSE; - } - else - { - result = (('0' <= c && c <= '9') || - ('a' <= c && c <= 'f') || - ('A' <= c && c <= 'F')); - } - - __locale_unlock(); - - return(result); -} diff --git a/library/ctype_table.c b/library/ctype_table.c deleted file mode 100644 index 3dda739..0000000 --- a/library/ctype_table.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * $Id: ctype_table.c,v 1.3 2005-01-09 15:20:31 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -/****************************************************************************/ - -const unsigned char __ctype_table[2 * 128] = -{ - /* 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 -}; diff --git a/library/ctype_tolower.c b/library/ctype_tolower.c deleted file mode 100644 index 255056d..0000000 --- a/library/ctype_tolower.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * $Id: ctype_tolower.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; - - __locale_lock(); - - if(__locale_table[LC_CTYPE] != NULL) - { - assert( LocaleBase != NULL ); - - /* The parameter must be either EOF or in the range of an - 'unsigned char'. If it's not, then the behaviour is - undefined. */ - if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX))) - result = ConvToLower(__locale_table[LC_CTYPE],(ULONG)(c & 255)); - else - result = c; - } - else - { - result = ('A' <= c && c <= 'Z') ? (c + ('a' - 'A')) : c; - } - - __locale_unlock(); - - return(result); -} diff --git a/library/ctype_toupper.c b/library/ctype_toupper.c deleted file mode 100644 index 392b376..0000000 --- a/library/ctype_toupper.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * $Id: ctype_toupper.c,v 1.4 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; - - __locale_lock(); - - if(__locale_table[LC_CTYPE] != NULL) - { - assert( LocaleBase != NULL ); - - /* The parameter must be either EOF or in the range of an - 'unsigned char'. If it's not, then the behaviour is - undefined. */ - if(c != EOF && ((0 <= c && c <= UCHAR_MAX) || ((c + 256) <= UCHAR_MAX))) - result = ConvToUpper(__locale_table[LC_CTYPE],(ULONG)(c & 255)); - else - result = c; - } - else - { - result = ('a' <= c && c <= 'z') ? (c - ('a' - 'A')) : c; - } - - __locale_unlock(); - - return(result); -} diff --git a/library/debug.c b/library/debug.c deleted file mode 100644 index efcbd7f..0000000 --- a/library/debug.c +++ /dev/null @@ -1,342 +0,0 @@ -/* - * $Id: debug.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=8 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include - -/****************************************************************************/ - -#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); - } -} diff --git a/library/debug.h b/library/debug.h deleted file mode 100644 index a796d1c..0000000 --- a/library/debug.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - * $Id: debug.h,v 1.3 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=8 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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) - -/****************************************************************************/ - -#ifndef _STDLIB_H -#include -#endif /* _STDLIB_H */ - -#ifndef _DOS_H -#include -#endif /* _DOS_H */ - -/****************************************************************************/ - -extern void kprintf(const char *format,...); - -/****************************************************************************/ - - 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 -#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 */ diff --git a/library/debug.lib_rev.c b/library/debug.lib_rev.c deleted file mode 100644 index 2bb7b1a..0000000 --- a/library/debug.lib_rev.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * $Id: debug.lib_rev.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; diff --git a/library/debug.lib_rev.h b/library/debug.lib_rev.h deleted file mode 100644 index d116751..0000000 --- a/library/debug.lib_rev.h +++ /dev/null @@ -1,6 +0,0 @@ -#define VERSION 1 -#define REVISION 193 -#define DATE "4.6.2005" -#define VERS "debug.lib 1.193" -#define VSTRING "debug.lib 1.193 (4.6.2005)\r\n" -#define VERSTAG "\0$VER: debug.lib 1.193 (4.6.2005)" diff --git a/library/debug.lib_rev.rev b/library/debug.lib_rev.rev deleted file mode 100644 index 2455a46..0000000 --- a/library/debug.lib_rev.rev +++ /dev/null @@ -1 +0,0 @@ -193 diff --git a/library/debug_cmpstrexec.c b/library/debug_cmpstrexec.c deleted file mode 100644 index 2e4dc2a..0000000 --- a/library/debug_cmpstrexec.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * $Id: debug_cmpstrexec.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_headers.h b/library/debug_headers.h deleted file mode 100644 index 57fcf39..0000000 --- a/library/debug_headers.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * $Id: debug_headers.h,v 1.3 2005-03-18 12:38:22 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 - -/****************************************************************************/ - -#ifndef EXEC_LIBRARIES_H -#include -#endif /* EXEC_LIBRARIES_H */ - -/****************************************************************************/ - -#if defined(__SASC) - -#include -#include - -LONG RawMayGetChar(VOID); -VOID RawPutChar(UBYTE c); - -#pragma libcall SysBase RawMayGetChar 1fe 00 -#pragma libcall SysBase RawPutChar 204 001 - -#endif /* __SASC */ - -/****************************************************************************/ - -#if defined(__amigaos4__) - -#ifndef EXEC_EMULATION_H -#include -#endif /* EXEC_EMULATION_H */ - -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -#if defined(__GNUC__) - -#define __NOLIBBASE__ -#include - -#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) - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_H */ - -#ifndef _DEBUG_H -#include "debug.h" -#endif /* _DEBUG_H */ - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -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 */ diff --git a/library/debug_kcmpstr.c b/library/debug_kcmpstr.c deleted file mode 100644 index 7e9781b..0000000 --- a/library/debug_kcmpstr.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * $Id: debug_kcmpstr.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kdofmt.c b/library/debug_kdofmt.c deleted file mode 100644 index 9660747..0000000 --- a/library/debug_kdofmt.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: debug_kdofmt.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kgetc.c b/library/debug_kgetc.c deleted file mode 100644 index ef8f643..0000000 --- a/library/debug_kgetc.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id: debug_kgetc.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kgetch1.c b/library/debug_kgetch1.c deleted file mode 100644 index d479e4a..0000000 --- a/library/debug_kgetch1.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * $Id: debug_kgetch1.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kgetch2.c b/library/debug_kgetch2.c deleted file mode 100644 index bc506f5..0000000 --- a/library/debug_kgetch2.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * $Id: debug_kgetch2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kgetchar1.c b/library/debug_kgetchar1.c deleted file mode 100644 index ff3b200..0000000 --- a/library/debug_kgetchar1.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * $Id: debug_kgetchar1.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kgetchar2.c b/library/debug_kgetchar2.c deleted file mode 100644 index f17d556..0000000 --- a/library/debug_kgetchar2.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * $Id: debug_kgetchar2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kgetnum1.c b/library/debug_kgetnum1.c deleted file mode 100644 index fdc5085..0000000 --- a/library/debug_kgetnum1.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * $Id: debug_kgetnum1.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kgetnum2.c b/library/debug_kgetnum2.c deleted file mode 100644 index bf2dc26..0000000 --- a/library/debug_kgetnum2.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * $Id: debug_kgetnum2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kmaygetch.c b/library/debug_kmaygetch.c deleted file mode 100644 index 3180303..0000000 --- a/library/debug_kmaygetch.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * $Id: debug_kmaygetch.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kmaygetchar.c b/library/debug_kmaygetchar.c deleted file mode 100644 index 6c55e84..0000000 --- a/library/debug_kmaygetchar.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * $Id: debug_kmaygetchar.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kprintf1.c b/library/debug_kprintf1.c deleted file mode 100644 index 99c09f2..0000000 --- a/library/debug_kprintf1.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id: debug_kprintf1.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); - } -} diff --git a/library/debug_kprintf2.c b/library/debug_kprintf2.c deleted file mode 100644 index fbed6fe..0000000 --- a/library/debug_kprintf2.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id: debug_kprintf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); - } -} diff --git a/library/debug_kputc.c b/library/debug_kputc.c deleted file mode 100644 index c58ffca..0000000 --- a/library/debug_kputc.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id: debug_kputc.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__ */ -} diff --git a/library/debug_kputch1.c b/library/debug_kputch1.c deleted file mode 100644 index 9e68ba3..0000000 --- a/library/debug_kputch1.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * $Id: debug_kputch1.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kputch2.c b/library/debug_kputch2.c deleted file mode 100644 index 927df6d..0000000 --- a/library/debug_kputch2.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * $Id: debug_kputch2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kputchar1.c b/library/debug_kputchar1.c deleted file mode 100644 index b5ef4c1..0000000 --- a/library/debug_kputchar1.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * $Id: debug_kputchar1.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kputchar2.c b/library/debug_kputchar2.c deleted file mode 100644 index 28c5913..0000000 --- a/library/debug_kputchar2.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * $Id: debug_kputchar2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kputfmt.c b/library/debug_kputfmt.c deleted file mode 100644 index baacf26..0000000 --- a/library/debug_kputfmt.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * $Id: debug_kputfmt.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__ */ - } -} diff --git a/library/debug_kputs1.c b/library/debug_kputs1.c deleted file mode 100644 index df9ed0e..0000000 --- a/library/debug_kputs1.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: debug_kputs1.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kputs2.c b/library/debug_kputs2.c deleted file mode 100644 index d8a0b25..0000000 --- a/library/debug_kputs2.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: debug_kputs2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kputstr1.c b/library/debug_kputstr1.c deleted file mode 100644 index afab177..0000000 --- a/library/debug_kputstr1.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * $Id: debug_kputstr1.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); - } -} diff --git a/library/debug_kputstr2.c b/library/debug_kputstr2.c deleted file mode 100644 index 1ef02e2..0000000 --- a/library/debug_kputstr2.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: debug_kputstr2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kvprintf1.c b/library/debug_kvprintf1.c deleted file mode 100644 index 59fdd59..0000000 --- a/library/debug_kvprintf1.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: debug_kvprintf1.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_kvprintf2.c b/library/debug_kvprintf2.c deleted file mode 100644 index 56a3471..0000000 --- a/library/debug_kvprintf2.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: debug_kvprintf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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); -} diff --git a/library/debug_level.c b/library/debug_level.c deleted file mode 100644 index 629bfac..0000000 --- a/library/debug_level.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * $Id: debug_level.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=8 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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; diff --git a/library/dirent_closedir.c b/library/dirent_closedir.c deleted file mode 100644 index 2fc09f8..0000000 --- a/library/dirent_closedir.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * $Id: dirent_closedir.c,v 1.14 2005-07-03 10:36:46 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* Directories being scanned whose locks need to be freed when shutting down. */ -struct MinList NOCOMMON __directory_list; - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -/****************************************************************************/ - -static struct SignalSemaphore * dirent_lock; - -/****************************************************************************/ - -void -__dirent_lock(void) -{ - if(dirent_lock != NULL) - ObtainSemaphore(dirent_lock); -} - -/****************************************************************************/ - -void -__dirent_unlock(void) -{ - if(dirent_lock != NULL) - ReleaseSemaphore(dirent_lock); -} - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ - -/****************************************************************************/ - -CLIB_CONSTRUCTOR(dirent_init) -{ - BOOL success = FALSE; - - ENTER(); - - NewList((struct List *)&__directory_list); - - #if defined(__THREAD_SAFE) - { - dirent_lock = __create_semaphore(); - if(dirent_lock == NULL) - goto out; - } - #endif /* __THREAD_SAFE */ - - success = TRUE; - - out: - - SHOWVALUE(success); - LEAVE(); - - if(success) - CONSTRUCTOR_SUCCEED(); - else - CONSTRUCTOR_FAIL(); -} - -/****************************************************************************/ - -CLIB_DESTRUCTOR(dirent_exit) -{ - ENTER(); - - if(__directory_list.mlh_Head != NULL) - { - while(NOT IsListEmpty((struct List *)&__directory_list)) - closedir((DIR *)__directory_list.mlh_Head); - } - - #if defined(__THREAD_SAFE) - { - __delete_semaphore(dirent_lock); - dirent_lock = NULL; - } - #endif /* __THREAD_SAFE */ - - LEAVE(); -} - -/****************************************************************************/ - -int -closedir(DIR * directory_pointer) -{ - struct DirectoryHandle * dh; - int result = ERROR; - - ENTER(); - - SHOWPOINTER(directory_pointer); - - if(__check_abort_enabled) - __check_abort(); - - __dirent_lock(); - - if(directory_pointer == NULL) - { - __set_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) - { - __set_errno(EBADF); - goto out; - } - } - #endif /* NDEBUG */ - - dh = (struct DirectoryHandle *)directory_pointer; - - Remove((struct Node *)dh); - - #if defined(UNIX_PATH_SEMANTICS) - { - struct Node * node; - - while((node = RemHead((struct List *)&dh->dh_VolumeList)) != NULL) - free(node); - } - #endif /* UNIX_PATH_SEMANTICS */ - - PROFILE_OFF(); - UnLock(dh->dh_DirLock); - PROFILE_ON(); - - free(dh); - - result = OK; - - out: - - __dirent_unlock(); - - RETURN(result); - return(result); -} diff --git a/library/dirent_headers.h b/library/dirent_headers.h deleted file mode 100644 index 75c76e8..0000000 --- a/library/dirent_headers.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * $Id: dirent_headers.h,v 1.8 2005-03-18 12:38:22 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_H */ - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_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 MinList dh_VolumeList; - BOOL dh_ScanVolumeList; -}; - -/****************************************************************************/ - -extern struct MinList NOCOMMON __directory_list; - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -/****************************************************************************/ - -extern void __dirent_lock(void); -extern void __dirent_unlock(void); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#define __dirent_lock() ((void)0) -#define __dirent_unlock() ((void)0) - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ - -/****************************************************************************/ - -#endif /* _DIRENT_HEADERS_H */ diff --git a/library/dirent_opendir.c b/library/dirent_opendir.c deleted file mode 100644 index 5fb9f15..0000000 --- a/library/dirent_opendir.c +++ /dev/null @@ -1,280 +0,0 @@ -/* - * $Id: dirent_opendir.c,v 1.9 2005-03-18 12:38:22 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _DIRENT_HEADERS_H -#include "dirent_headers.h" -#endif /* _DIRENT_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_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; - - 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"); - - __set_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)); - - #if defined(UNIX_PATH_SEMANTICS) - { - struct Node * node; - - NewList((struct List *)&dh->dh_VolumeList); - - 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); - - __set_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((struct List *)&dh->dh_VolumeList,node->ln_Name) != NULL) - { - free(node); - continue; - } - - D(("adding '%s'",node->ln_Name)); - - AddTail((struct List *)&dh->dh_VolumeList,node); - } - } - - UnLockDosList(LDF_VOLUMES|LDF_READ); - - /* Bail out if we cannot present anything. */ - if(IsListEmpty((struct List *)&dh->dh_VolumeList)) - { - __set_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"); - - __set_errno(__translate_access_io_error_to_errno(IoErr())); - 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"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - if(dh->dh_FileInfo.fib_DirEntryType < 0) - { - SHOWMSG("this isn't a directory"); - - __set_errno(ENOTDIR); - goto out; - } - } - - SHOWMSG("OK, done"); - - assert( __directory_list.mlh_Head != NULL ); - - __dirent_lock(); - - AddTail((struct List *)&__directory_list,(struct Node *)dh); - - __dirent_unlock(); - - result = (DIR *)dh; - dh = NULL; - - out: - - if(dh != NULL) - { - SHOWMSG("ouch. cleaning up"); - - #if defined(UNIX_PATH_SEMANTICS) - { - struct Node * node; - - while((node = RemHead((struct List *)&dh->dh_VolumeList)) != NULL) - free(node); - } - #endif /* UNIX_PATH_SEMANTICS */ - - PROFILE_OFF(); - UnLock(dh->dh_DirLock); - PROFILE_ON(); - - free(dh); - } - - RETURN(result); - return(result); -} diff --git a/library/dirent_readdir.c b/library/dirent_readdir.c deleted file mode 100644 index 9ed2bf9..0000000 --- a/library/dirent_readdir.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * $Id: dirent_readdir.c,v 1.7 2005-02-03 16:56:15 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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"); - - __set_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); - D_S(struct bcpl_name,bcpl_name); - UBYTE * name = bcpl_name->name; - BPTR dir_lock; - - assert( (((ULONG)name) & 3) == 0 ); - - if(dh->dh_VolumeNode == NULL && NOT IsListEmpty((struct List *)&dh->dh_VolumeList)) - dh->dh_VolumeNode = (struct Node *)dh->dh_VolumeList.mlh_Head; - - strcpy(name,"\1:"); /* BSTR for ":" */ - - while(result == NULL && dh->dh_VolumeNode != NULL && dh->dh_VolumeNode->ln_Succ != NULL) - { - if(IsFileSystem(dh->dh_VolumeNode->ln_Name)) - { - struct DevProc * dvp; - - dvp = GetDeviceProc(dh->dh_VolumeNode->ln_Name,NULL); - if(dvp != NULL) - { - dir_lock = DoPkt(dvp->dvp_Port,ACTION_LOCATE_OBJECT,ZERO,MKBADDR(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); - } - - FreeDeviceProc(dvp); - } - } - - 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)) - { - __set_errno(__translate_io_error_to_errno(IoErr())); - 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"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - 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); -} diff --git a/library/dirent_rewinddir.c b/library/dirent_rewinddir.c deleted file mode 100644 index b734506..0000000 --- a/library/dirent_rewinddir.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * $Id: dirent_rewinddir.c,v 1.4 2005-02-03 16:56:15 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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"); - __set_errno(__translate_io_error_to_errno(IoErr())); - } - } - } - - PROFILE_ON(); - - LEAVE(); -} diff --git a/library/errno_data.c b/library/errno_data.c deleted file mode 100644 index a398b7e..0000000 --- a/library/errno_data.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: errno_data.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _ERRNO_H -#include -#endif /* _ERRNO_H */ - -/****************************************************************************/ - -int errno; diff --git a/library/fcntl_close.c b/library/fcntl_close.c deleted file mode 100644 index f1dbbb5..0000000 --- a/library/fcntl_close.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * $Id: fcntl_close.c,v 1.12 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _FCNTL_HEADERS_H -#include "fcntl_headers.h" -#endif /* _FCNTL_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -close(int file_descriptor) -{ - struct file_action_message fam; - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(file_descriptor); - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - if(__check_abort_enabled) - __check_abort(); - - /* We want to affect this very file descriptor and not the - original one associated with an alias of it. */ - fd = __get_file_descriptor_dont_resolve(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - fam.fam_Action = file_action_close; - - assert( fd->fd_Action != NULL ); - - if((*fd->fd_Action)(fd,&fam) < 0) - { - __set_errno(fam.fam_Error); - goto out; - } - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/fcntl_creat.c b/library/fcntl_creat.c deleted file mode 100644 index 8295883..0000000 --- a/library/fcntl_creat.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * $Id: fcntl_creat.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _FCNTL_HEADERS_H -#include "fcntl_headers.h" -#endif /* _FCNTL_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -creat(const char * path_name, mode_t mode) -{ - int result = ERROR; - - ENTER(); - - SHOWSTRING(path_name); - SHOWVALUE(mode); - - if(__check_abort_enabled) - __check_abort(); - - assert( path_name != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(path_name == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = open(path_name,O_WRONLY|O_CREAT|O_TRUNC,mode); - - out: - - RETURN(result); - return(result); -} diff --git a/library/fcntl_fcntl.c b/library/fcntl_fcntl.c deleted file mode 100644 index dee0647..0000000 --- a/library/fcntl_fcntl.c +++ /dev/null @@ -1,284 +0,0 @@ -/* - * $Id: fcntl_fcntl.c,v 1.18 2005-05-27 13:19:30 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _FCNTL_HEADERS_H -#include "fcntl_headers.h" -#endif /* _FCNTL_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -fcntl(int file_descriptor, int cmd, ... /* int arg */ ) -{ - struct file_action_message fam; - struct flock * l; - int vacant_slot; - int result = ERROR; - struct fd * fd = NULL; - va_list arg; - int error; - int flags; - int fdbase; - int i; - - ENTER(); - - SHOWVALUE(file_descriptor); - SHOWVALUE(cmd); - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - if(__check_abort_enabled) - __check_abort(); - - /* F_DUPFD will need to modify the file descriptor table, which is why - the stdio lock needs to be obtained here, before the individual - file descriptor lock is held. */ - if(cmd == F_DUPFD) - __stdio_lock(); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - __fd_lock(fd); - - switch(cmd) - { -#if defined(UNIX_PATH_SEMANTICS) - case F_GETLK: - case F_SETLK: - case F_SETLKW: - - SHOWMSG("cmd=F_GETLK/F_SETLK/F_SETLKW"); - - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET)) - { - __set_errno(EINVAL); - goto out; - } - - if(fd->fd_DefaultFile == ZERO) - { - __set_errno(EBADF); - goto out; - } - - va_start(arg,cmd); - l = va_arg(arg,struct flock *); - va_end(arg); - - assert( l != NULL ); - - if(l->l_type < F_RDLCK || l->l_type > F_WRLCK) - { - SHOWMSG("invalid flock type"); - - __set_errno(EINVAL); - break; - } - - if(l->l_whence < SEEK_SET || l->l_whence > SEEK_END) - { - SHOWMSG("invalid flock offset"); - - __set_errno(EINVAL); - break; - } - - if(__handle_record_locking(cmd,l,fd,&error) < 0) - { - __set_errno(error); - goto out; - } - - result = OK; - - break; -#endif /* UNIX_PATH_SEMANTICS */ - - case F_GETFL: - - SHOWMSG("cmd=F_GETFL"); - - if(FLAG_IS_SET(fd->fd_Flags,FDF_NON_BLOCKING)) - SET_FLAG(result,O_NONBLOCK); - - if(FLAG_IS_SET(fd->fd_Flags,FDF_ASYNC_IO)) - SET_FLAG(result,O_ASYNC); - - result = OK; - - break; - - case F_SETFL: - - SHOWMSG("cmd=F_SETFL"); - - /* If this is a file, make sure that we don't hit a zero file handle. */ - if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_IS_SOCKET) && fd->fd_DefaultFile == ZERO) - { - __set_errno(EBADF); - goto out; - } - - va_start(arg,cmd); - flags = va_arg(arg,int); - va_end(arg); - - if((FLAG_IS_SET(flags,O_NONBLOCK) && FLAG_IS_CLEAR(fd->fd_Flags,FDF_NON_BLOCKING)) || - (FLAG_IS_CLEAR(flags,O_NONBLOCK) && FLAG_IS_SET(fd->fd_Flags,FDF_NON_BLOCKING))) - { - fam.fam_Action = file_action_set_blocking; - fam.fam_Arg = FLAG_IS_CLEAR(flags,O_NONBLOCK); - - assert( fd->fd_Action != NULL ); - - if((*fd->fd_Action)(fd,&fam) < 0) - { - __set_errno(fam.fam_Error); - - goto out; - } - - if(FLAG_IS_SET(flags,O_NONBLOCK)) - SET_FLAG(fd->fd_Flags,FDF_NON_BLOCKING); - else - CLEAR_FLAG(fd->fd_Flags,FDF_NON_BLOCKING); - } - - if((FLAG_IS_SET(flags,O_ASYNC) && FLAG_IS_CLEAR(fd->fd_Flags,FDF_ASYNC_IO)) || - (FLAG_IS_CLEAR(flags,O_ASYNC) && FLAG_IS_SET(fd->fd_Flags,FDF_ASYNC_IO))) - { - fam.fam_Action = file_action_set_async; - fam.fam_Arg = FLAG_IS_SET(flags,O_ASYNC); - - assert( fd->fd_Action != NULL ); - - if((*fd->fd_Action)(fd,&fam) < 0) - { - __set_errno(fam.fam_Error); - - goto out; - } - - if(FLAG_IS_SET(flags,O_ASYNC)) - SET_FLAG(fd->fd_Flags,FDF_ASYNC_IO); - else - CLEAR_FLAG(fd->fd_Flags,FDF_ASYNC_IO); - } - - result = OK; - - break; - - case F_DUPFD: - - SHOWMSG("cmd=F_DUPFD"); - - va_start(arg, cmd); - fdbase = va_arg(arg, int); - va_end(arg); - - if(fdbase < 0) - { - __set_errno(EINVAL); - goto out; - } - - /* Make sure that we have the required number of file - descriptors available. */ - if(__grow_fd_table(fdbase + 1) < 0) - goto out; - - vacant_slot = -1; - - /* Guaranteed to have enough here */ - do - { - __stdio_unlock(); - - if(__check_abort_enabled) - __check_abort(); - - __stdio_lock(); - - for(i = fdbase ; i < __num_fd ; i++) - { - if(FLAG_IS_CLEAR(__fd[i]->fd_Flags,FDF_IN_USE)) - { - vacant_slot = i; - break; - } - } - - /* Didn't really find any, grow the table further */ - if(vacant_slot < 0 && __grow_fd_table(0) < 0) - goto out; - } - while(vacant_slot < 0); - - /* Got a file descriptor, duplicate it */ - __duplicate_fd(__fd[vacant_slot],fd); - - result = vacant_slot; - - break; - - default: - - SHOWMSG("something else"); - - __set_errno(ENOSYS); - break; - } - - out: - - __fd_unlock(fd); - - if(cmd == F_DUPFD) - __stdio_unlock(); - - RETURN(result); - return(result); -} diff --git a/library/fcntl_get_default_file.c b/library/fcntl_get_default_file.c deleted file mode 100644 index bb2d151..0000000 --- a/library/fcntl_get_default_file.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * $Id: fcntl_get_default_file.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _FCNTL_HEADERS_H -#include "fcntl_headers.h" -#endif /* _FCNTL_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -__get_default_file(int file_descriptor,long * file_ptr) -{ - struct fd * fd; - int result = ERROR; - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - assert( file_ptr != NULL ); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - (*file_ptr) = (long)fd->fd_DefaultFile; - - result = 0; - - out: - - return(result); -} diff --git a/library/fcntl_headers.h b/library/fcntl_headers.h deleted file mode 100644 index 4ce48c0..0000000 --- a/library/fcntl_headers.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * $Id: fcntl_headers.h,v 1.4 2005-03-18 12:38:22 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _FCNTL_HEADERS_H -#define _FCNTL_HEADERS_H - -/****************************************************************************/ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_H */ - -/****************************************************************************/ - -#endif /* _FCNTL_HEADERS_H */ diff --git a/library/fcntl_lock.c b/library/fcntl_lock.c deleted file mode 100644 index 1584e91..0000000 --- a/library/fcntl_lock.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * $Id: fcntl_lock.c,v 1.3 2005-04-01 18:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -/****************************************************************************/ - -void -__fd_lock(struct fd * fd) -{ - if(fd != NULL && fd->fd_Lock != NULL) - ObtainSemaphore(fd->fd_Lock); -} - -/****************************************************************************/ - -void -__fd_unlock(struct fd * fd) -{ - if(fd != NULL && fd->fd_Lock != NULL) - ReleaseSemaphore(fd->fd_Lock); -} - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ diff --git a/library/fcntl_lseek.c b/library/fcntl_lseek.c deleted file mode 100644 index f19218a..0000000 --- a/library/fcntl_lseek.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * $Id: fcntl_lseek.c,v 1.9 2005-04-24 09:53:11 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _FCNTL_HEADERS_H -#include "fcntl_headers.h" -#endif /* _FCNTL_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -off_t -lseek(int file_descriptor, off_t offset, int mode) -{ - struct file_action_message fam; - off_t result = SEEK_ERROR; - off_t position; - struct fd * fd; - - ENTER(); - - SHOWVALUE(file_descriptor); - SHOWVALUE(offset); - SHOWVALUE(mode); - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - if(__check_abort_enabled) - __check_abort(); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - if(mode < SEEK_SET || mode > SEEK_END) - { - SHOWMSG("seek mode is invalid"); - - __set_errno(EINVAL); - goto out; - } - - fam.fam_Action = file_action_seek; - fam.fam_Offset = offset; - fam.fam_Mode = mode; - - assert( fd->fd_Action != NULL ); - - /* Note that a return value of -1 (= SEEK_ERROR) may be a - valid file position in files larger than 2 GBytes. Just - to be sure, we therefore also check the secondary error - to verify that what could be a file position is really - an error indication. */ - position = (*fd->fd_Action)(fd,&fam); - if(position == SEEK_ERROR && fam.fam_Error != OK) - { - __set_errno(fam.fam_Error); - goto out; - } - - /* If this is a valid file position, clear 'errno' so that - it cannot be mistaken for an error. */ - if(position < 0) - __set_errno(OK); - - result = position; - - out: - - RETURN(result); - return(result); -} diff --git a/library/fcntl_open.c b/library/fcntl_open.c deleted file mode 100644 index 001623a..0000000 --- a/library/fcntl_open.c +++ /dev/null @@ -1,476 +0,0 @@ -/* - * $Id: fcntl_open.c,v 1.16 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _FCNTL_HEADERS_H -#include "fcntl_headers.h" -#endif /* _FCNTL_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* This is used in place of ChangeMode() in order to work around a bug in - dos.library V40 and below: a "NIL:" file handle will crash the - caller of the ChangeMode() function. */ -STATIC LONG -safe_change_mode(LONG type,BPTR file_handle,LONG mode) -{ - LONG result = DOSFALSE; - - #ifndef __amigaos4__ - { - struct FileHandle * fh = (struct FileHandle *)BADDR(file_handle); - - assert( type == CHANGE_FH ); - - if(fh == NULL || fh->fh_Type == NULL) - { - SetIoErr(ERROR_OBJECT_WRONG_TYPE); - goto out; - } - } - #endif /* __amigaos4__ */ - - PROFILE_OFF(); - result = ChangeMode(type,file_handle,mode); - PROFILE_ON(); - - out: - - return(result); -} - -/****************************************************************************/ - -int -open(const char *path_name, int open_flag, ... /* mode_t mode */ ) -{ - DECLARE_UTILITYBASE(); - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info path_name_nti; - #endif /* UNIX_PATH_SEMANTICS */ - D_S(struct FileInfoBlock,fib); - struct SignalSemaphore * fd_lock; - LONG is_file_system = FALSE; - LONG open_mode; - BPTR lock = ZERO; - BPTR handle = ZERO; - BOOL create_new_file = FALSE; - LONG is_interactive; - int fd_slot_number; - struct fd * fd; - int access_mode; - int result = ERROR; - int i; - - ENTER(); - - SHOWSTRING(path_name); - SHOWVALUE(open_flag); - - assert(path_name != NULL); - assert( UtilityBase != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - __stdio_lock(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(path_name == NULL) - { - SHOWMSG("path name is invalid"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - access_mode = (open_flag & 3); - if(access_mode < O_RDONLY && access_mode > O_RDWR) - { - SHOWMSG("access mode is invalid"); - - __set_errno(EINVAL); - goto out; - } - - fd_slot_number = __find_vacant_fd_entry(); - if(fd_slot_number < 0) - { - if(__grow_fd_table(0) < 0) - { - SHOWMSG("couldn't find a vacant file descriptor, and couldn't allocate one either"); - goto out; - } - - fd_slot_number = __find_vacant_fd_entry(); - assert( fd_slot_number >= 0 ); - } - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0) - goto out; - - if(path_name_nti.is_root) - { - __set_errno(EACCES); - goto out; - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - if (Strnicmp(path_name, "PIPE:",5) == SAME && FLAG_IS_SET(open_flag, O_CREAT)) - { - open_mode = MODE_NEWFILE; - } - else if (Strnicmp(path_name,"NIL:",4) != SAME && FLAG_IS_SET(open_flag,O_CREAT)) - { - if(FLAG_IS_SET(open_flag,O_EXCL)) - { - LONG error; - - SHOWMSG("checking if the file to create already exists"); - - PROFILE_OFF(); - lock = Lock((STRPTR)path_name,SHARED_LOCK); - PROFILE_ON(); - - if(lock != ZERO) - { - SHOWMSG("the file already exists"); - - __set_errno(EEXIST); - goto out; - } - - error = IoErr(); - - if(error == ERROR_OBJECT_WRONG_TYPE) - { - SHOWMSG("there's something not a directory on the path"); - - __set_errno(ENOTDIR); - goto out; - } - else if (error != ERROR_OBJECT_NOT_FOUND && error != ERROR_ACTION_NOT_KNOWN) - { - SHOWMSG("error accessing the object"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - SHOWMSG("the object does not already exist"); - } - - open_mode = MODE_READWRITE; - - if(FLAG_IS_SET(open_flag,O_TRUNC)) - { - SHOWMSG("checking if the file to create already exists"); - - PROFILE_OFF(); - lock = Lock((STRPTR)path_name,SHARED_LOCK); - PROFILE_ON(); - - if(lock != ZERO) - { - LONG status; - - PROFILE_OFF(); - status = Examine(lock,fib); - PROFILE_ON(); - - if(status == DOSFALSE) - { - SHOWMSG("could not examine the object"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - /* We can open only files, but never directories. */ - if(fib->fib_DirEntryType >= 0) - { - SHOWMSG("can't open a directory"); - - __set_errno(EISDIR); - goto out; - } - - if(FLAG_IS_SET(fib->fib_Protection,FIBF_WRITE) || - FLAG_IS_SET(fib->fib_Protection,FIBF_DELETE)) - { - SHOWMSG("this object is not write enabled"); - - __set_errno(EACCES); - goto out; - } - - open_mode = MODE_NEWFILE; - - PROFILE_OFF(); - - UnLock(lock); - lock = ZERO; - - PROFILE_ON(); - } - else - { - LONG error; - - error = IoErr(); - - if(error == ERROR_OBJECT_WRONG_TYPE) - { - SHOWMSG("there's something not a directory on the path"); - - __set_errno(ENOTDIR); - goto out; - } - else if (error != ERROR_OBJECT_NOT_FOUND && error != ERROR_ACTION_NOT_KNOWN) - { - SHOWMSG("error accessing the object"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - } - } - - create_new_file = TRUE; - } - else - { - open_mode = MODE_OLDFILE; - } - - SHOWSTRING(path_name); - - PROFILE_OFF(); - handle = Open((STRPTR)path_name,open_mode); - PROFILE_ON(); - - if(handle == ZERO) - { - LONG io_err = IoErr(); - - D(("the file '%s' didn't open in mode %ld",path_name,open_mode)); - __set_errno(__translate_access_io_error_to_errno(io_err)); - - /* Check if ended up trying to open a directory as if - it were a plain file. */ - if(io_err == ERROR_OBJECT_WRONG_TYPE) - { - PROFILE_OFF(); - - lock = Lock((STRPTR)path_name,SHARED_LOCK); - if(lock != ZERO) - { - if(Examine(lock,fib) && fib->fib_DirEntryType >= 0) - __set_errno(EISDIR); - } - - PROFILE_ON(); - } - - goto out; - } - - #if defined(__THREAD_SAFE) - { - fd_lock = __create_semaphore(); - if(fd_lock == NULL) - { - __set_errno(ENOMEM); - goto out; - } - } - #else - { - fd_lock = NULL; - } - #endif /* __THREAD_SAFE */ - - fd = __fd[fd_slot_number]; - - __initialize_fd(fd,__fd_hook_entry,handle,0,fd_lock); - - /* Figure out if this stream is attached to a console. */ - PROFILE_OFF(); - is_interactive = IsInteractive(handle); - PROFILE_ON(); - - if(is_interactive) - { - SET_FLAG(fd->fd_Flags,FDF_IS_INTERACTIVE); - - if(FLAG_IS_SET(open_flag,O_NONBLOCK)) - { - SHOWMSG("enabling non-blocking mode"); - - if(SetMode(handle,DOSTRUE)) /* single character mode */ - SET_FLAG(fd->fd_Flags,FDF_NON_BLOCKING); - } - } - else - { - size_t len; - - len = 0; - - for(i = 0 ; path_name[i] != '\0' ; i++) - { - if(path_name[i] == ':') - { - len = i+1; - break; - } - } - - if(len > 0) - { - char * path_name_copy; - - path_name_copy = malloc(len+1); - if(path_name_copy != NULL) - { - memmove(path_name_copy,path_name,len); - path_name_copy[len] = '\0'; - - PROFILE_OFF(); - is_file_system = IsFileSystem(path_name_copy); - PROFILE_ON(); - - free(path_name_copy); - } - } - else - { - PROFILE_OFF(); - is_file_system = IsFileSystem(""); - PROFILE_ON(); - } - - if(is_file_system) - { - /* We opened the file in exclusive access mode. Switch it back - into shared access mode so that its contents can be read - while it's still open. */ - if(open_mode == MODE_NEWFILE) - safe_change_mode(CHANGE_FH,handle,SHARED_LOCK); - - /* We should be able to seek in this file. */ - SET_FLAG(fd->fd_Flags,FDF_CACHE_POSITION); - } - } - - if(FLAG_IS_SET(open_flag,O_APPEND)) - { - SHOWMSG("appending; seeking to end of file"); - - PROFILE_OFF(); - Seek(handle,0,OFFSET_END); - PROFILE_ON(); - - SET_FLAG(fd->fd_Flags,FDF_APPEND); - } - - switch(access_mode) - { - case O_RDONLY: - - SET_FLAG(fd->fd_Flags,FDF_READ); - break; - - case O_WRONLY: - - SET_FLAG(fd->fd_Flags,FDF_WRITE); - break; - - case O_RDWR: - - SET_FLAG(fd->fd_Flags,FDF_READ); - SET_FLAG(fd->fd_Flags,FDF_WRITE); - break; - } - - if(create_new_file && is_file_system) - SET_FLAG(fd->fd_Flags,FDF_CREATED); - - SET_FLAG(fd->fd_Flags,FDF_IN_USE); - - result = fd_slot_number; - - handle = ZERO; - - assert( result != ERROR ); - - out: - - PROFILE_OFF(); - - if(handle != ZERO) - Close(handle); - - UnLock(lock); - - __stdio_unlock(); - - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/fcntl_read.c b/library/fcntl_read.c deleted file mode 100644 index ecb1857..0000000 --- a/library/fcntl_read.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * $Id: fcntl_read.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _FCNTL_HEADERS_H -#include "fcntl_headers.h" -#endif /* _FCNTL_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -ssize_t -read(int file_descriptor, void * buffer, size_t num_bytes) -{ - ssize_t num_bytes_read; - ssize_t result = EOF; - struct fd * fd; - - ENTER(); - - SHOWVALUE(file_descriptor); - SHOWPOINTER(buffer); - SHOWVALUE(num_bytes); - - assert( buffer != NULL ); - assert( (int)num_bytes >= 0); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(buffer == NULL) - { - SHOWMSG("invalid buffer"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_READ)) - { - SHOWMSG("this descriptor is not read-enabled"); - - __set_errno(EBADF); - goto out; - } - - if(num_bytes > 0) - { - struct file_action_message fam; - - SHOWMSG("calling the hook"); - - fam.fam_Action = file_action_read; - fam.fam_Data = buffer; - fam.fam_Size = num_bytes; - - assert( fd->fd_Action != NULL ); - - num_bytes_read = (*fd->fd_Action)(fd,&fam); - if(num_bytes_read == EOF) - { - __set_errno(fam.fam_Error); - goto out; - } - } - else - { - num_bytes_read = 0; - } - - result = num_bytes_read; - - out: - - RETURN(result); - return(result); -} diff --git a/library/fcntl_write.c b/library/fcntl_write.c deleted file mode 100644 index 3dc4f65..0000000 --- a/library/fcntl_write.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * $Id: fcntl_write.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _FCNTL_HEADERS_H -#include "fcntl_headers.h" -#endif /* _FCNTL_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -ssize_t -write(int file_descriptor, const void * buffer, size_t num_bytes) -{ - ssize_t num_bytes_written; - ssize_t result = EOF; - struct fd * fd; - - ENTER(); - - SHOWVALUE(file_descriptor); - SHOWPOINTER(buffer); - SHOWVALUE(num_bytes); - - assert( buffer != NULL ); - assert( (int)num_bytes >= 0 ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(buffer == NULL) - { - SHOWMSG("invalid buffer address"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_WRITE)) - { - SHOWMSG("file descriptor is not write-enabled"); - - __set_errno(EBADF); - goto out; - } - - if(num_bytes > 0) - { - struct file_action_message fam; - - SHOWMSG("calling the hook"); - - fam.fam_Action = file_action_write; - fam.fam_Data = (void *)buffer; - fam.fam_Size = num_bytes; - - assert( fd->fd_Action != NULL ); - - num_bytes_written = (*fd->fd_Action)(fd,&fam); - if(num_bytes_written == EOF) - { - __set_errno(fam.fam_Error); - goto out; - } - } - else - { - num_bytes_written = 0; - } - - result = num_bytes_written; - - out: - - RETURN(result); - return(result); -} diff --git a/library/ftw_ftw.c b/library/ftw_ftw.c deleted file mode 100644 index 08d1887..0000000 --- a/library/ftw_ftw.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * $Id: ftw_ftw.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* - * This ftw() implementation builds heavily on existing functionality and could certainly - * be made more efficient (e.g. by combining walk & stat using ExAll()/ExNext()) but this - * way the Unix pathname translation is free. - */ - -/****************************************************************************/ - -#ifndef _FTW_HEADERS_H -#include "ftw_headers.h" -#endif /* _FTW_HEADERS_H */ - -/****************************************************************************/ - -static int -walk(const char *path,int (*func)(const char *,const struct stat *,int),int depth,int level) -{ - int result = OK; - DIR *dp; - struct dirent *de; - struct stat st; - char *next_name; - int type; - int old_length; - int errtmp; - - ENTER(); - - SHOWSTRING(path); - SHOWPOINTER(func); - SHOWVALUE(depth); - SHOWVALUE(level); - - if(__check_abort_enabled) - __check_abort(); - - if(level > depth) - goto out; - - if(stat(path,&st) == OK) - { - if (S_ISDIR(st.st_mode)) - { - if(FLAG_IS_SET(st.st_mode,S_IRUSR)) - type = FTW_D; /* Directory */ - else - type = FTW_DNR; /* Directory No Read-permission */ - } - else if (S_ISREG(st.st_mode)) - { - type = FTW_F; /* File */ - } - else - { - /* Skip */ - goto out; - } - } - else - { - type = FTW_NS; /* No Stat */ - } - - result = (*func)(path,&st,type); - if(result != 0) - goto out; - - if(type == FTW_D) - { - dp = opendir(path); /* Also takes care of Unix->Amiga pathname conversion. */ - if(dp == NULL) - { - result = ERROR; /* Pass errno from opendir() */ - goto out; - } - - old_length = strlen(path); - - next_name = malloc(old_length + NAME_MAX + 2); /* Allocate new for each recursive step to handle extremely long path names. */ - if(next_name == NULL) - { - __set_errno(ENOMEM); - - result = ERROR; - goto out; - } - - strcpy(next_name,path); - - if(old_length > 0 && next_name[old_length - 1] != ':' && next_name[old_length-1] != '/') - next_name[old_length++] = '/'; - - while((result == 0) && (de = readdir(dp)) != NULL) - { - strlcpy(&next_name[old_length],de->d_name,NAME_MAX + 2); - - result = walk(next_name,func,depth,level+1); - } - - errtmp = __get_errno(); - - closedir(dp); - free(next_name); - - __set_errno(errtmp); - } - - out: - - RETURN(result); - return(result); -} - -int -ftw(const char *path,int (*func)(const char *,const struct stat *,int),int depth) -{ - int result = ERROR; - char *base; - int len; - - ENTER(); - - SHOWSTRING(path); - SHOWPOINTER(func); - SHOWVALUE(depth); - - if(path == NULL) - { - SHOWMSG("NULL pathname to ftw()."); - - __set_errno(EFAULT); - goto out; - } - - if(func == NULL) - { - SHOWMSG("No function supplied."); - - __set_errno(EFAULT); - goto out; - } - - if(depth < 0) - { - SHOWMSG("Invalid depth.\n"); - - __set_errno(EINVAL); - goto out; - } - - /* Make sure the path never ends with '/' unless used to indicate parent directory. */ - len = strlen(path); - if(len > 1 && path[len - 1] == '/' && path[len - 2] != '/') - { - int error; - - base = strdup(path); - if(base == NULL) - { - __set_errno(ENOMEM); - goto out; - } - - base[len - 1] = '\0'; - - result = walk(base,func,depth,0); - - error = __get_errno(); - - free(base); - - __set_errno(error); - } - else - { - result = walk(path,func,depth,0); - } - - out: - - RETURN(result); - return(result); -} diff --git a/library/ftw_headers.h b/library/ftw_headers.h deleted file mode 100644 index 4afae92..0000000 --- a/library/ftw_headers.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id: ftw_headers.h,v 1.2 2005-03-18 12:38:22 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _FTW_HEADERS_H -#define _FTW_HEADERS_H - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_H */ - -#ifndef _DEBUG_H -#include "debug.h" -#endif /* _DEBUG_H */ - -/****************************************************************************/ - -#endif /* _FTW_HEADERS_H */ diff --git a/library/ftw_nftw.c b/library/ftw_nftw.c deleted file mode 100644 index f792ee4..0000000 --- a/library/ftw_nftw.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - * $Id: ftw_nftw.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* - * This nftw() implementation builds heavily on existing functionality and could certainly - * be made more efficient. - */ - -/****************************************************************************/ - -#ifndef _FTW_HEADERS_H -#include "ftw_headers.h" -#endif /* _FTW_HEADERS_H */ - -/****************************************************************************/ - -static int -walk(const char *path,int (*func)(const char *,const struct stat *,int,struct FTW *),const int depth,int level,const int flags,const int base,int * const prune) -{ - int result = OK; - DIR *dp; - struct dirent *de; - struct stat st; - char *next_name; - char *old_cwd = 0; - int type; - int old_length; - int errtmp; - struct FTW extra_info; - int stat_result; - - ENTER(); - - SHOWSTRING(path); - SHOWPOINTER(func); - SHOWVALUE(depth); - SHOWVALUE(level); - SHOWVALUE(flags); - - if(__check_abort_enabled) - __check_abort(); - - if(level > depth) - goto out; - - if(FLAG_IS_SET(flags,FTW_PHYS)) - stat_result = lstat(path,&st); - else - stat_result = stat(path,&st); - - if(stat_result == OK) - { - if (S_ISLNK(st.st_mode)) /* Should only be possible if lstat() is used. */ - { - type = FTW_SL; - } - else if (S_ISDIR(st.st_mode)) - { - if(FLAG_IS_SET(st.st_mode,S_IRUSR)) - type = FTW_D; /* Directory */ - else - type = FTW_DNR; /* Directory No Read-permission */ - } - else if (S_ISREG(st.st_mode)) - { - type = FTW_F; /* File */ - } - else - { - /* Skip */ - goto out; - } - } - else - { - if(FLAG_IS_CLEAR(flags,FTW_PHYS) && lstat(path,&st) == OK) - type = FTW_SLN; /* Broken link. */ - else - type = FTW_NS; /* No Stat */ - } - - extra_info.quit = 0; - extra_info.base = base; - extra_info.level = level; - - if(type == FTW_D) - { - old_length = strlen(path); - - if(FLAG_IS_CLEAR(flags,FTW_DEPTH)) - result = (*func)(path,&st,type,&extra_info); - - if(extra_info.quit == 0) - { - dp = opendir(path); /* Also takes care of Unix->Amiga pathname conversion. */ - if(dp == NULL) - { - result = ERROR; - goto out; - } - - if(FLAG_IS_SET(flags,FTW_CHDIR)) /* Change to directory before traversing. */ - { - old_cwd = malloc(old_length + NAME_MAX); - if(old_cwd == NULL) - { - __set_errno(ENOMEM); - - result = ERROR; - goto out; - } - - getcwd(old_cwd,old_length + NAME_MAX); - chdir(path); - } - - next_name = malloc(old_length + NAME_MAX + 2); /* Allocate new for each recursive step to handle extremely long path names. */ - if(next_name == NULL) - { - __set_errno(ENOMEM); - - result = ERROR; - goto out; - } - - strcpy(next_name,path); - if(old_length > 0 && next_name[old_length - 1] != ':' && next_name[old_length - 1] != '/') - next_name[old_length++] = '/'; - - while((result == 0) && (de = readdir(dp)) != NULL) - { - strlcpy(&next_name[old_length],de->d_name,NAME_MAX + 2); - - result = walk(next_name,func,depth,level + 1,flags,old_length,prune); - if((*prune) != 0) - { - (*prune) = 0; - break; - } - } - - errtmp = __get_errno(); - - closedir(dp); - - __set_errno(errtmp); - - free(next_name); - - if((result == 0) && FLAG_IS_SET(flags,FTW_DEPTH)) - result = (*func)(path,&st,FTW_DP,&extra_info); - } - - if(extra_info.quit == FTW_PRUNE) /* Abort traversal of current directory. */ - (*prune) = 1; - } - else - { - result = (*func)(path,&st,type,&extra_info); - } - - out: - - if(old_cwd != NULL) - { - errtmp = __get_errno(); - - chdir(old_cwd); /* Restore (pop) old directory. */ - free(old_cwd); - - __set_errno(errtmp); - } - - RETURN(result); - return(result); -} - -/****************************************************************/ - -static int -index_of_end_part(const char *path) -{ - int result = OK; - int i; - - i = strlen(path) - 1; - while(i-- > 0) - { - if(path[i] == '/' || path[i] == ':') - { - result = i + 1; - break; - } - } - - return(result); -} - -/****************************************************************/ - -int -nftw(const char *path,int (*func)(const char *,const struct stat *,int,struct FTW *),int depth,int flags) -{ - char *base; - int len; - int base_index; - int prune = 0; - int result = ERROR; - - ENTER(); - - SHOWSTRING(path); - SHOWPOINTER(func); - SHOWVALUE(depth); - SHOWVALUE(flags); - - if(path == NULL) - { - SHOWMSG("NULL pathname to nftw()."); - __set_errno(EFAULT); - goto out; - } - - if(func == NULL) - { - SHOWMSG("No function supplied."); - __set_errno(EFAULT); - goto out; - } - - if(depth < 0) - { - SHOWMSG("Invalid depth.\n"); - __set_errno(EINVAL); - goto out; - } - - if((flags & ~FTW_ALL_FLAGS) != 0) - { - SHOWMSG("Bogus flags."); - - __set_errno(EINVAL); - goto out; - } - - /* Make sure the path never ends with '/' unless used to indicate parent directory. */ - - len = strlen(path); - if(len > 1 && path[len - 1] == '/' && path[len - 2] != '/') - { - int error; - - base = strdup(path); - if(base == NULL) - { - __set_errno(ENOMEM); - goto out; - } - - base[len - 1] = '\0'; - - base_index = index_of_end_part(base); - - result = walk(base,func,depth,0,flags,base_index,&prune); - - error = __get_errno(); - free(base); - __set_errno(error); - } - else - { - base_index = index_of_end_part(path); - - result = walk(path,func,depth,0,flags,base_index,&prune); - } - - out: - - RETURN(result); - return(result); -} diff --git a/library/getopt_getopt_long.c b/library/getopt_getopt_long.c deleted file mode 100644 index 7bd065d..0000000 --- a/library/getopt_getopt_long.c +++ /dev/null @@ -1,408 +0,0 @@ -/* - * $Id: getopt_getopt_long.c,v 1.3 2005-06-26 12:01:50 tfrieden Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#include - -extern int opterr; -extern int optind; -extern int optopt; -extern char * optarg; -int optreset = 0; - -#define GETOPTF_LONG_ONLY (1L << 0) /* Operate in getopt_long_only more */ -#define GETOPTF_GNUEXT (1L << 1) /* Allow -W extension */ -#define GETOPTF_POSIX (1L << 2) /* Will disallow permutation */ -#define GETOPTF_ONE_ARG (1L << 3) /* Non-option argv will be handled as -\1 */ - -static int getopt_long_internal(int argc, const char **argv, const char *optstring, - const struct option *longopts, int *longindex, int flags); - - -int getopt_long(int argc, const char **argv, const char *optstring, - const struct option *longopts, int *longindex) -{ - return getopt_long_internal(argc, argv, optstring, longopts, longindex, 0); -} - -#if 0 -int getopt_long_only(int argc, const char **argv, const char *optstring, - const struct option *longopts, int *longindex) -{ - return getopt_long_internal(argc, argv, optstring, longopts, longindex, - GETOPTF_LONG_ONLY); -} -#endif - - -static int parse_long_option(int argc, char **argv, const struct option *longopts, - int *longindex, int flags) -{ - char *current = argv[optind] + 2; /* Skip the '--' */ - char *argument; - int keylen = 0; - int i; - int idx = -1; - int result = '?'; - - (void)flags; - - optind ++; - - /* If there's an equals sign in the option, the actual word to check is - * between the -- and = characters. Otherwise, it's the length of the - * remainder (without --) - */ - argument = strchr(current, '='); - if (argument) - { - keylen = (int)(argument - current); - /* Skip the '=' sign */ - argument++; - } - else - keylen = strlen(current); - - for (i = 0; longopts[i].name; i++) - { - if (strncmp(longopts[i].name, current, keylen)) - continue; - - if (strlen(longopts[i].name) == (size_t)keylen) - { - /* Exact match */ - idx = i; - break; - } - - /* Partial match. Check if we already found another partial match, in - * which case the match is ambigous. - */ - if (idx == -1) - { - idx = i; - } - else - { - *longindex = -1; - return '?'; - } - } - - *longindex = idx; - - if (idx != -1) - { - /* Found a match. Check if it needs an argument */ - if (longopts[idx].has_arg == optional_argument) - { - /* Optional arguments must be given as --foo=bar, it will not - * advance to the next argv element - */ - if (argument) - optarg = argument; - else - optarg = 0; - } - else if (longopts[idx].has_arg == required_argument) - { - /* Either argument was given as --foo=bar, or the next argv element - * (if present) will be returned - */ - if (argument) - optarg = argument; - else - { - if (optind < argc) - { - optarg = argv[optind]; - optind++; - } - else - { - if (opterr) - fprintf(stderr, "%s: option requires an argument -- %s\n", - argv[0], longopts[idx].name); - - optarg = 0; - - return '?'; - } - } - } - else - { - /* No argument */ - optarg = 0; - - if (argument) - { - if (opterr) - fprintf(stderr, "%s: option does not take an argument -- %s\n", - argv[0], longopts[idx].name); - - return '?'; - } - } - - if (longopts[idx].flag) - { - *longopts[idx].flag = longopts[idx].val; - optopt = 0; - result = 0; - } - else - { - result = optopt = longopts[idx].val; - } - - return result; - } - - optopt = 0; - - return '?'; -} - - - -/* Note: This implementation currently does not permute argv vectors, and will - * stop parsing input on the first non-option argument - */ - -static int getopt_long_internal(int argc, const char **argv, const char *optstring, - const struct option *longopts, int *longindex, int flags) -{ - static char *nextchar = 0; - int result = EOF; - int c; - char *optp; - int longidx_subst; - - ENTER(); - SHOWVALUE(argc); - SHOWPOINTER(argv); - SHOWSTRING(optstring); - SHOWPOINTER(longopts); - SHOWPOINTER(longindex); - SHOWVALUE(flags); - - if(__check_abort_enabled) - __check_abort(); - - if (NULL == optstring) - goto out; - - if (!longindex) - longindex = &longidx_subst; - - /* Check options */ - /* FIXME: Should probably also check environment variable */ - if (*optstring == '+') - { - flags |= GETOPTF_POSIX; - optstring++; - } - - if (*optstring == '-') - { - flags |= GETOPTF_ONE_ARG; - optstring++; - } - - /* Check for reset */ - if (optreset || optind == 0) - { - optind = 1; - optreset = 0; - nextchar = 0; - } - - if (optind >= argc) - goto out; - - /* Begin or continue scanning - * First off, check for a short option and set nextchar, if present. - * if nextchar is not 0, there's a compound option waiting or just begun. - */ - if (!nextchar - && argv[optind][0] == '-' - && argv[optind][1] != '\0' - && argv[optind][1] != '-') - { - /* It's a short option. */ - nextchar = (char *)&argv[optind][1]; - } - - if (nextchar) - { - c = *nextchar ++; - - /* Advancing nextchar. If it points to a 0 character now, it's reached - * the end of the current argv string, so set it to 0 and advance optind - * to the next argv element. - */ - if (0 == *nextchar) - { - nextchar = 0; - optind ++; - } - - optp = strchr(optstring, c); - - /* We never find a long option in a compound option */ - *longindex = 0; - - /* Check if it's legal */ - if (c == ':' || (optp == NULL)) - { - /* Illegal option */ - if (opterr) - fprintf(stderr, "%s: illegal option -- %c\n", argv[0], c); - - result = '?'; - - goto out; - } - else - { - /* It is legal. Three possibilities here: - * 1. It doesn't have arguments. Return the character. - * 2. It has an argument. Return the character, and point optarg - * to the rest of the argv entry. - * 3. It has an optional argument. If there are non-0 characters - * following, point optarg there, otherwise, clear optarg. - */ - if (optp[1] != ':') - { - /* Case 1 (no argument). */ - result = c; - goto out; - } - else - { - /* Argument may follow */ - if (optp[2] == ':') - { - /* Optional argument. nextchar is 0 if there's no further - * stuff following, which means the option is without - * argument - */ - if (nextchar) - { - optarg = nextchar; - nextchar = 0; - optind++; - } - else - optarg = 0; - } - else - { - /* Mandatory argument. Either nextchar points to the rest - * of this argv element, or we use the next argv element - */ - if (nextchar) - { - optarg = nextchar; - nextchar = 0; - optind++; - } - else - { - if (optind >= argc) - { - if (opterr) - fprintf(stderr, "%s: option requires an argument -- %c\n", - argv[0], c); - - result = '?'; - - goto out; - } - - optarg = (char *)argv[optind++]; - } - } - - result = c; - goto out; - } - } - } /* if (nextchar) */ - - /* Start checking an argv element for an option. - * There are different possibilities here: - * 1. We ran out of argv elements - * 2. We have an argv element that's just "-" or not an option - * 3. We have an argv element that's just "--" - * 4. we habe a long option (--xxx pr -W xxx) - */ - - /* Check case 3 and 1*/ - if ((strcmp(argv[optind], "--") == 0) || optind >= argc) - { - result = EOF; - goto out; - } - - /* Check case 4 */ - if (argv[optind][0] == '-' && argv[optind][1] == '-' && longopts) - { - /* It is a long option */ - result = parse_long_option(argc, (char **)argv, longopts, longindex, flags); - goto out; - } - - /* Case 2 */ - - - out: - RETURN(result); - return result; -} diff --git a/library/include/assert.h b/library/include/assert.h deleted file mode 100644 index fcbe531..0000000 --- a/library/include/assert.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * $Id: assert.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _ASSERT_H -#define _ASSERT_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef assert - -/****************************************************************************/ - -#ifndef NDEBUG - -/****************************************************************************/ - -extern void __assertion_failure(const char *file_name,int line_number,const char * expression); - -/****************************************************************************/ - -#define assert(expression) \ - ((void)((expression) ? 0 : (__assertion_failure(__FILE__,__LINE__,#expression),0))) - -#else - -/****************************************************************************/ - -#define assert(expression) ((void)0) - -/****************************************************************************/ - -#endif /* NDEBUG */ - -/****************************************************************************/ - -#endif /* assert */ - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _ASSERT_H */ diff --git a/library/include/complex.h b/library/include/complex.h deleted file mode 100644 index a430cea..0000000 --- a/library/include/complex.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * $Id: complex.h,v 1.3 2005-05-12 13:21:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _COMPLEX_H -#define _COMPLEX_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -#ifndef __GNUC__ -#error Unsupported compiler. -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#if defined(__cplusplus) -#warning C99 header file used in C++. -#endif /* __cplusplus */ - -/****************************************************************************/ - -#if !defined(__STDC_VERSION__) || (__GNUC__ < 3 && __STDC_VERSION__ < 199901L) -#error Complex numbers are not supported by/for this compiler. -#endif /* __GNUC__ && __STDC_VERSION__ */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -/* Basic types; imaginary is assumed not to be implemented yet. */ -#define complex _Complex - -/****************************************************************************/ - -/* Constants */ -#define _Complex_I (__extension__ 0.0+1.0fi) -#define I _Complex_I - -/****************************************************************************/ - -extern double creal(double complex z); -extern float crealf(float complex z); -extern long double creall(long double complex z); - -extern double cimag(double complex z); -extern float cimagf(float complex z); -extern long double cimagl(long double complex z); - -extern double complex conj(double complex z); -extern float complex conjf(float complex z); -extern long double complex conjl(long double complex z); - -extern double carg(double complex z); -extern float cargf(float complex z); -extern long double cargl(long double complex z); - -/****************************************************************************/ - -/* Unimplemented functions (so far)... */ - -/****************************************************************************/ - -#if 0 - -extern double complex cacos(double complex z); -extern float complex cacosf(float complex z); -extern long double complex cacosl(long double complex z); - -extern double complex casin(double complex z); -extern float complex casinf(float complex z); -extern long double complex casinl(long double complex z); - -extern double complex catan(double complex z); -extern float complex catanf(float complex z); -extern long double complex catanl(long double complex z); - -extern double complex ccos(double complex z); -extern float complex ccosf(float complex z); -extern long double complex ccosl(long double complex z); - -extern double complex csin(double complex z); -extern float complex csinf(float complex z); -extern long double complex csinl(long double complex z); - -extern double complex ctan(double complex z); -extern float complex ctanf(float complex z); -extern long double complex ctanl(long double complex z); - -extern double complex cacosh(double complex z); -extern float complex cacoshf(float complex z); -extern long double complex cacoshl(long double complex z); - -extern double complex casinh(double complex z); -extern float complex casinhf(float complex z); -extern long double complex casinhl(long double complex z); - -extern double complex catanh(double complex z); -extern float complex catanhf(float complex z); -extern long double complex catanhl(long double complex z); - -extern double complex ccosh(double complex z); -extern float complex ccoshf(float complex z); -extern long double complex ccoshl(long double complex z); - -extern double complex csinh(double complex z); -extern float complex csinhf(float complex z); -extern long double complex csinhl(long double complex z); - -extern double complex ctanh(double complex z); -extern float complex ctanhf(float complex z); -extern long double complex ctanhl(long double complex z); - -extern double complex cexp(double complex z); -extern float complex cexpf(float complex z); -extern long double complex cexpl(long double complex z); - -extern double complex clog(double complex z); -extern float complex clogf(float complex z); -extern long double complex clogl(long double complex z); - -extern double cabs(double complex z); -extern float cabsf(float complex z); -extern long double cabsl(long double complex z); - -extern double complex cpow(double complex z); -extern float complex cpowf(float complex z); -extern long double complex cpowl(long double complex z); - -extern double complex csqrt(double complex z); -extern float complex csqrtf(float complex z); -extern long double complex csqrtl(long double complex z); - -extern double complex cproj(double complex z); -extern float complex cprojf(float complex z); -extern long double complex cprojl(long double complex z); - -#endif - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _COMPLEX_H */ diff --git a/library/include/ctype.h b/library/include/ctype.h deleted file mode 100644 index 163f44e..0000000 --- a/library/include/ctype.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * $Id: ctype.h,v 1.6 2005-05-11 20:15:28 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _CYTPE_H -#define _CYTPE_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -extern int isalnum(int c); -extern int isalpha(int c); -extern int iscntrl(int c); - -extern int isdigit(int c); -extern int isxdigit(int c); - -extern int isgraph(int c); -extern int ispunct(int c); -extern int isprint(int c); - -extern int islower(int c); -extern int isupper(int c); - -extern int isspace(int c); -extern int isblank(int c); - -extern int tolower(int c); -extern int toupper(int c); - -/****************************************************************************/ - -/* - * If requested, reimplement the character classification functions as macros; - * note that the macro variants ignore the current locale and default to the - * 'C' locale rules. - */ - -#ifdef __C_MACROS__ - -/****************************************************************************/ - -extern const unsigned char __ctype_table[]; - -/****************************************************************************/ - -#define __CTYPE_CONTROL 0x01 /* This is a control character */ -#define __CTYPE_DIGIT 0x02 /* This is a 'decimal' digit */ -#define __CTYPE_HEX_DIGIT 0x04 /* This is a hexadecimal digit */ -#define __CTYPE_PUNCTUATION 0x08 /* This is a punctuation character */ -#define __CTYPE_PRINTABLE 0x10 /* This is a printable character */ -#define __CTYPE_WHITE_SPACE 0x20 /* This is a blank space character */ -#define __CTYPE_LOWER_CASE 0x40 /* This is a lower case letter */ -#define __CTYPE_UPPER_CASE 0x80 /* This is an upper case letter */ - -/****************************************************************************/ - -#define isalnum(c) ((__ctype_table[(c) & 255] & (__CTYPE_DIGIT|__CTYPE_LOWER_CASE|__CTYPE_UPPER_CASE)) != 0) -#define isalpha(c) ((__ctype_table[(c) & 255] & (__CTYPE_LOWER_CASE|__CTYPE_UPPER_CASE)) != 0) -#define iscntrl(c) ((__ctype_table[(c) & 255] & __CTYPE_CONTROL) != 0) -#define isdigit(c) ((__ctype_table[(c) & 255] & __CTYPE_DIGIT) != 0) -#define isxdigit(c) ((__ctype_table[(c) & 255] & __CTYPE_HEX_DIGIT) != 0) -#define isgraph(c) ((__ctype_table[(c) & 255] & (__CTYPE_DIGIT|__CTYPE_PUNCTUATION|__CTYPE_LOWER_CASE|__CTYPE_UPPER_CASE)) != 0) -#define ispunct(c) ((__ctype_table[(c) & 255] & __CTYPE_PUNCTUATION) != 0) -#define isprint(c) ((__ctype_table[(c) & 255] & __CTYPE_PRINTABLE) != 0) -#define islower(c) ((__ctype_table[(c) & 255] & __CTYPE_LOWER_CASE) != 0) -#define isupper(c) ((__ctype_table[(c) & 255] & __CTYPE_UPPER_CASE) != 0) -#define isspace(c) ((__ctype_table[(c) & 255] & __CTYPE_WHITE_SPACE) != 0) -#define isblank(c) ((c) == ' ' || (c) == '\t') - -/****************************************************************************/ - -#endif /* __C_MACROS__ */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -#define isascii(c) ((unsigned)(c) <= 127) - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _CYTPE_H */ diff --git a/library/include/dirent.h b/library/include/dirent.h deleted file mode 100644 index 9a34f00..0000000 --- a/library/include/dirent.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * $Id: dirent.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_H -#define _DIRENT_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _SYS_TYPES_H -#include -#endif /* _SYS_TYPES_H */ - -#ifndef _STDIO_H -#include -#endif /* _STDIO_H */ - -/****************************************************************************/ - -#define NAME_MAX FILENAME_MAX - -/****************************************************************************/ - -typedef long DIR; - -/****************************************************************************/ - -struct dirent -{ - ino_t d_ino; - char d_name[NAME_MAX+1]; -}; - -/****************************************************************************/ - -extern DIR * opendir(const char * path_name); -extern struct dirent * readdir(DIR * directory_pointer); -extern void rewinddir(DIR * directory_pointer); -extern int closedir(DIR * directory_pointer); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _DIRENT_H */ diff --git a/library/include/dos.h b/library/include/dos.h deleted file mode 100644 index 5660cc2..0000000 --- a/library/include/dos.h +++ /dev/null @@ -1,373 +0,0 @@ -/* - * $Id: dos.h,v 1.10 2005-07-03 10:36:48 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _DOS_H -#define _DOS_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _STDIO_H -#include -#endif /* _STDIO_H */ - -/****************************************************************************/ - -#ifndef EXEC_LIBRARIES_H -#include -#endif /* EXEC_LIBRARIES_H */ - -#ifndef WORKBENCH_STARTUP_H -#include -#endif /* WORKBENCH_STARTUP_H */ - -/****************************************************************************/ - -/* - * The Workbench startup message passed to this program; this may be NULL - * if the program was started from shell instead. - * - * The variable name is set up to be __WBenchMsg to make it fit into the - * ISO 'C' standard context. It is redefined to WBenchMsg to make it - * compatible with the original Amiga program startup code which would - * refer to the variable under that name. - * - * It is recommended to access the Workbench startup message as part of your - * program's main() function, like this: - * - * int - * main(int argc,char ** argv) - * { - * struct WBStartup * wb_startup_message; - * - * if(argc == 0) - * wb_startup_message = (struct WBStartup *)argv; - * else - * wb_startup_message = NULL; - * - * ... - * } - * - * This approach has the advantage that your program does not rely upon a - * global variable initialized by the startup code, whose name you might - * not even know exactly. - */ -extern struct WBStartup * __WBenchMsg; -#define WBenchMsg __WBenchMsg - -/****************************************************************************/ - -/* This is filled in with a pointer to the name of the program being run. */ -extern char * __program_name; - -/****************************************************************************/ - -/* Set this to FALSE to disable all Ctrl+C checking in the program. */ -extern BOOL __check_abort_enabled; - -/* - * You can replace this function with your own and perform your own - * Ctrl+C checking. - */ -extern void __check_abort(void); - -/****************************************************************************/ - -/* - * Call this function to set up the environment information for your - * program to access its data. This is typically used in Task or Process - * functions, as launched from the main program. - * - * Note: this function is unavailable for residentable programs and may - * not be available for PowerPC programs. - */ -extern void geta4(void); - -/****************************************************************************/ - -/* - * Read and modify the current value of register A4; helpful for - * programs which are residentable, yet need to be able to pass the - * context information around A4 points to. - * - * Note: this function may not be available for PowerPC programs. - */ -extern unsigned long __get_a4(void); -extern void __set_a4(unsigned long value); - -/****************************************************************************/ - -/* - * Obtain the low level 'file' handle or socket ID bound to a file - * descriptor. This function returns 0 for success and non-zero - * otherwise (if, for example, the file descriptor value you - * provided is not valid; errno will be set to the appropriate - * error code, too). Put a pointer to the file handle variable you - * want to be filled in into the second parameter to this function. - */ -extern int __get_default_file(int file_descriptor,long * file_ptr); - -/****************************************************************************/ - -/* - * This will be set to TRUE if the current program was launched from - * the internet superserver ('inetd') or an equivalent facility. - */ -extern BOOL __is_daemon; - -/****************************************************************************/ - -/* - * If the library is built with memory debugging features enabled, - * the following variable controls whether memory allocated, to be - * released, will actually get released. If set to TRUE all memory - * allocations will persist until the program exits. - */ -extern BOOL __never_free; - -/****************************************************************************/ - -/* - * Before memory is allocated, a quick check can be performed in order - * to avoid draining so much system memory that both the operating system - * and application software becomes unstable. This test checks for the - * largest available block of memory, which has to be larger than a - * threshold value for the memory allocation to proceed. That size - * can be configured here. It defaults to 0, which means that no test - * is performed. If this feature is enabled, a minimum threshold value - * of 250000 bytes is recommended. - */ -extern ULONG __free_memory_threshold; - -/****************************************************************************/ - -/* - * The following section lists variables and function pointers which are used - * by the startup code right after the program is launched. These variables are - * looked up before your program's main() function is invoked. Therefore, you - * would have to declare these variables in your program's data section and have - * them initialized to certain well-defined values to get the desired effect. - */ - -/* - * The minimum required operating system version number is 37, which - * corresponds to Workbench/Kickstart 2.04. You may request a higher - * version number by defining the following variable; if you do so, - * please provide a fitting error message, too. Note that you cannot - * request a minimum version number lower than 37. - */ -extern int __minimum_os_lib_version; -extern char * __minimum_os_lib_error; - -/* - * If your program is launched from Workbench it will not necessarily - * have a window to send console output to and from which console - * input can be read. The startup code attempts to set up such a console - * window for you, but it uses defaults for the window specification. - * These defaults can be overridden by your program if you define a - * variable to point to the specification string. Note that if you - * request a specific window specification, this will also override - * any tool window definition stored in the program's icon. - */ -extern char * __stdio_window_specification; - -/* - * If set to TRUE, your program's process->pr_WindowPtr will be set to -1 - * when it starts. The process->pr_WindowPtr will be automatically restored - * to the initial value before it exits. - */ -extern BOOL __disable_dos_requesters; - -/* - * If set to TRUE, your program will disconnect itself from the shell it was - * launched from and keep running in the background. This service is unavailable - * for residentable programs. Note that you should not use this feature for - * programs which are supposed to be launched by the internet superserver. - * Also, note that when a program is run in the background, its input and - * output streams will be connected to NIL:. - */ -extern BOOL __detach; - -/* - * If this function pointer is not NULL, it must point to a function which - * figures out whether the program should detach itself from the shell it - * was launched from. The function return value replaces the value of the - * __detach variable. - * - * At the time this function is invoked, dos.library and utility.library - * have already been opened for you. - */ -extern BOOL (* __check_detach)(void); - -/* - * If this pointer is not NULL, it refers the name that will be given to - * the process which is created when the program detaches. The default - * is to reuse the program name instead. - */ -extern char * __process_name; - -/* - * This variable controls the task priority of the program, when running. - * It must be in the range -128..127 to be useful. By default, the task - * priority will not be changed. - */ -extern int __priority; - -/* - * This variable can be set up to contain the minimum stack size the program - * should be launched with. If the startup code finds that there is not enough - * stack space available to start with, it will attempt to allocate more and - * then proceed to run your program. - * - * If this variable is set to 0 (the default) then no stack size test will - * be performed upon startup. - */ -extern unsigned int __stack_size; - -/* - * If this function pointer is not NULL, it must point to a function which - * figures out how much stack space is required to run the program. The - * function return value replaces the value of the __stack_size variable - * if it is not equal to zero. - * - * At the time this function is invoked, dos.library and utility.library - * have already been opened for you. - */ -extern unsigned int (* __get_default_stack_size)(void); - -/****************************************************************************/ - -/* - * This library falls back onto locale.library to perform string collation - * in strcoll(), character conversion in toupper() and various other - * functions. This may not your intention. To restrict the library to use - * only the "C" language locale, declare the following variable in your - * code and set it to FALSE, so that it overrides the default settings. - * The variable value is checked during program startup and, if set to - * TRUE, has the effect of opening locale.library and obtaining the - * default locale. - */ -extern BOOL __open_locale; - -/* - * Two functions control how this library uses the locale.library API to - * perform string collation, character and time conversion, etc. - * - * __locale_init() opens locale.library and attempts to open the default - * locale. If it succeeds, it will return 0 and -1 otherwise. - * - * __locale_exit() releases the default locale and closes locale.library. - */ -extern int __locale_init(void); -extern void __locale_exit(void); - -/****************************************************************************/ - -/* - * If linked with -lunix, Unix path names are translated to Amiga path - * names (and the other way round). If you wish to disable this, set the - * following variable to FALSE. Only the path name translation is affected - * by setting this variable to FALSE. You will always get Unix-like behaviour - * from certain functions regardless of whether the path names are translated - * or not. - */ -extern BOOL __unix_path_semantics; - -/****************************************************************************/ - -/* A data structures used by the path translation routines below. */ -struct name_translation_info -{ - char substitute[MAXPATHLEN]; - char * original_name; - int is_root; -}; - -/****************************************************************************/ - -extern int __translate_relative_path_name(char const ** name_ptr,char *replace,size_t max_replace_len); -extern void __restore_path_name(char const ** name_ptr,struct name_translation_info * nti); -extern int __translate_amiga_to_unix_path_name(char const ** name_ptr,struct name_translation_info * nti); -extern int __translate_unix_to_amiga_path_name(char const ** name_ptr,struct name_translation_info * nti); -extern int __translate_io_error_to_errno(LONG io_error); - -/****************************************************************************/ - -/* - * Routines for use with shared libraries: invoke __lib_init() in your own - * shared library initialization function and __lib_exit() in your shared - * library cleanup function. - * - * __lib_init() will initialize the global SysBase/DOSBase variables - * (and the IExec/IDOS variables for OS4) and invoke the constructor - * functions required by your library code. It returns FALSE upon - * failure and TRUE otherwise. Make this the very first function you - * call in your shared library initialization function. The __lib_init() - * function expects to be called with a pointer to the exec.library - * base, which is normally passed to your shared library as part of the - * library startup code initialization performed by the operating - * system. - * - * __lib_exit() will undo all the initializations performed by the - * __lib_init() function, but leave the global SysBase variable - * (and the IExec variable for OS4) intact. Make this the very last - * function you call in your shared library cleanup function. - * - * Note that neither __lib_init() nor __lib_exit() are reentrant. You must - * make sure that while you are calling them no other library user can - * call them by accident. - * - * Both functions are only available as part of the thread-safe clib2 - * linker library. - */ -extern VOID __lib_exit(VOID); -extern BOOL __lib_init(struct Library * SysBase); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _DOS_H */ diff --git a/library/include/errno.h b/library/include/errno.h deleted file mode 100644 index c249d73..0000000 --- a/library/include/errno.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * $Id: errno.h,v 1.2 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _ERRNO_H -#define _ERRNO_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -extern int errno; - -/****************************************************************************/ - -#define EPERM 1 /* Operation not permitted */ -#define ENOENT 2 /* No such file or directory */ -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted system call */ -#define EIO 5 /* Input/output error */ -#define ENXIO 6 /* Device not configured */ -#define E2BIG 7 /* Argument list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file descriptor */ -#define ECHILD 10 /* No child processes */ -#define EDEADLK 11 /* Resource deadlock avoided */ - -#define ENOMEM 12 /* Cannot allocate memory */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ - -#define ENOTBLK 15 /* Block device required */ -#define EBUSY 16 /* Device busy */ - -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Cross-device link */ -#define ENODEV 19 /* Operation not supported by device */ -#define ENOTDIR 20 /* Not a directory */ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* Too many open files in system */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Inappropriate ioctl for device */ - -#define ETXTBSY 26 /* Text file busy */ - -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Illegal seek */ -#define EROFS 30 /* Read-only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ - -#define EDOM 33 /* Numerical argument out of domain */ -#define ERANGE 34 /* Result too large */ - -/* non-blocking and interrupt i/o */ -#define EAGAIN 35 /* Resource temporarily unavailable */ -#define EWOULDBLOCK EAGAIN /* Operation would block */ -#define EINPROGRESS 36 /* Operation now in progress */ -#define EALREADY 37 /* Operation already in progress */ - -/* ipc/network software -- argument errors */ -#define ENOTSOCK 38 /* Socket operation on non-socket */ -#define EDESTADDRREQ 39 /* Destination address required */ -#define EMSGSIZE 40 /* Message too long */ -#define EPROTOTYPE 41 /* Protocol wrong type for socket */ -#define ENOPROTOOPT 42 /* Protocol not available */ -#define EPROTONOSUPPORT 43 /* Protocol not supported */ -#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ -#define EOPNOTSUPP 45 /* Operation not supported on socket */ -#define EPFNOSUPPORT 46 /* Protocol family not supported */ -#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ -#define EADDRINUSE 48 /* Address already in use */ -#define EADDRNOTAVAIL 49 /* Can't assign requested address */ - -/* ipc/network software -- operational errors */ -#define ENETDOWN 50 /* Network is down */ -#define ENETUNREACH 51 /* Network is unreachable */ -#define ENETRESET 52 /* Network dropped connection on reset */ -#define ECONNABORTED 53 /* Software caused connection abort */ -#define ECONNRESET 54 /* Connection reset by peer */ -#define ENOBUFS 55 /* No buffer space available */ -#define EISCONN 56 /* Socket is already connected */ -#define ENOTCONN 57 /* Socket is not connected */ -#define ESHUTDOWN 58 /* Can't send after socket shutdown */ -#define ETOOMANYREFS 59 /* Too many references: can't splice */ -#define ETIMEDOUT 60 /* Connection timed out */ -#define ECONNREFUSED 61 /* Connection refused */ - -#define ELOOP 62 /* Too many levels of symbolic links */ -#define ENAMETOOLONG 63 /* File name too long */ - -#define EHOSTDOWN 64 /* Host is down */ -#define EHOSTUNREACH 65 /* No route to host */ -#define ENOTEMPTY 66 /* Directory not empty */ - -/* quotas & mush */ -#define EPROCLIM 67 /* Too many processes */ -#define EUSERS 68 /* Too many users */ -#define EDQUOT 69 /* Disc quota exceeded */ - -/* Network File System */ -#define ESTALE 70 /* Stale NFS file handle */ -#define EREMOTE 71 /* Too many levels of remote in path */ -#define EBADRPC 72 /* RPC struct is bad */ -#define ERPCMISMATCH 73 /* RPC version wrong */ -#define EPROGUNAVAIL 74 /* RPC prog. not avail */ -#define EPROGMISMATCH 75 /* Program version wrong */ -#define EPROCUNAVAIL 76 /* Bad procedure for program */ - -#define ENOLCK 77 /* No locks available */ -#define ENOSYS 78 /* Function not implemented */ - -#define EFTYPE 79 /* Inappropriate file type or format */ - -#define EAUTH 80 /* Authentication error. */ - -#define ENEEDAUTH 81 /* Need authenticator. */ - -#define EIDRM 82 /* Identifier removed. */ - -#define ENOMSG 83 /* No message of the desired type. */ - -#define EOVERFLOW 84 /* Value too large to be stored in data type. */ - -#define EILSEQ 85 /* Encoding error detected */ - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _ERRNO_H */ diff --git a/library/include/fcntl.h b/library/include/fcntl.h deleted file mode 100644 index 42e7048..0000000 --- a/library/include/fcntl.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * $Id: fcntl.h,v 1.5 2005-04-03 10:22:48 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _FCNTL_H -#define _FCNTL_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _SYS_TYPES_H -#include -#endif /* _SYS_TYPES_H */ - -#ifndef _STDDEF_H -#include -#endif /* _STDDEF_H */ - -/****************************************************************************/ - -#define O_RDONLY 0 -#define O_WRONLY 1 -#define O_RDWR 2 - -#define O_APPEND (1<<2) -#define O_CREAT (1<<3) -#define O_EXCL (1<<4) -#define O_TRUNC (1<<5) -#define O_NONBLOCK (1<<6) -#define O_NDELAY O_NONBLOCK -#define O_SYNC (0) -#define O_NOCTTY (0) -#define O_ASYNC (1<<7) - -/****************************************************************************/ - -#define F_DUPFD 0 -#define F_GETFD 1 -#define F_SETFD 2 -#define F_GETFL 3 -#define F_SETFL 4 -#define F_GETOWN 5 -#define F_SETOWN 6 - -/****************************************************************************/ - -/* - * Advisory file segment locking data type - - * information passed to system by user - */ -struct flock -{ - short l_type; /* lock type: read/write, etc. */ - short l_whence; /* type of l_start */ - off_t l_start; /* starting offset */ - off_t l_len; /* len = 0 means until end of file */ - pid_t l_pid; /* lock owner */ -}; - -#define F_GETLK 100 /* get record locking information */ -#define F_SETLK 101 /* set record locking information */ -#define F_SETLKW 102 /* F_SETLK; wait if blocked */ - -#define F_RDLCK 1 /* shared or read lock */ -#define F_UNLCK 2 /* unlock */ -#define F_WRLCK 3 /* exclusive or write lock */ - -/****************************************************************************/ - -extern int open(const char *path_name, int open_flag, ... /* mode_t mode */ ); -extern int creat(const char * path_name, mode_t mode); -extern int close(int file_descriptor); -extern off_t lseek(int file_descriptor, off_t offset, int mode); -extern ssize_t read(int file_descriptor, void * buffer, size_t num_bytes); -extern ssize_t write(int file_descriptor, const void * buffer, size_t num_bytes); -extern int fcntl(int file_descriptor, int cmd, ... /* int arg */ ); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _FCNTL_H */ diff --git a/library/include/float.h b/library/include/float.h deleted file mode 100644 index d64f1a3..0000000 --- a/library/include/float.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $Id: float.h,v 1.2 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _FLOAT_H -#define _FLOAT_H - -/****************************************************************************/ - -#define FLT_EPSILON 1.19209290E-07F -#define FLT_DIG 6 -#define FLT_MANT_DIG 24 -#define FLT_MAX 3.40282347E+38F -#define FLT_MAX_EXP 128 -#define FLT_MAX_10_EXP 38 -#define FLT_MIN 1.17549435E-38F -#define FLT_MIN_EXP (-125) -#define FLT_MIN_10_EXP (-37) -#define FLT_RADIX 2 -#define FLT_ROUNDS 1 - -/****************************************************************************/ - -#define DBL_EPSILON 2.2204460492503131E-16 -#define DBL_DIG 15 -#define DBL_MANT_DIG 53 -#define DBL_MAX 1.7976931348623157E+308 -#define DBL_MAX_EXP 1024 -#define DBL_MAX_10_EXP 308 -#define DBL_MIN 2.2250738585072014E-308 -#define DBL_MIN_EXP (-1021) -#define DBL_MIN_10_EXP (-307) - -/****************************************************************************/ - -#define LDBL_EPSILON 2.2204460492503131E-16L -#define LDBL_DIG 15 -#define LDBL_MANT_DIG 53 -#define LDBL_MAX 1.7976931348623157E+308L -#define LDBL_MAX_EXP 1024 -#define LDBL_MAX_10_EXP 308 -#define LDBL_MIN 2.2250738585072014E-308L -#define LDBL_MIN_EXP (-1021) -#define LDBL_MIN_10_EXP (-307) - -/****************************************************************************/ - -#endif /* _FLOAT_H */ diff --git a/library/include/ftw.h b/library/include/ftw.h deleted file mode 100644 index fcfba01..0000000 --- a/library/include/ftw.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * $Id: ftw.h,v 1.1 2005-03-02 12:57:56 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _FTW_H -#define _FTW_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -/* Values passed to the user function (argument #3). */ -enum -{ - FTW_F, /* Regular file. */ - FTW_D, /* Directory. */ - FTW_DP, /* Directory, already visited. (nftw() only) */ - FTW_SL, /* Symlink. (nftw() only) */ - FTW_SLN, /* Broken Symlink. (does not point to an existing file, nftw() only) */ - FTW_DNR, /* Directory which can not be read (e.g. not enough permissions) */ - FTW_NS /* Stat failed. */ -}; - -/****************************************************************************/ - -/* Flags for FTW.quit */ -#define FTW_SKD (1L<<0) /* Skip directory. */ -#define FTW_PRUNE (1L<<1) /* Prune traversal. (skip up) */ - -/****************************************************************************/ - -/* Flags for nftw() */ -#define FTW_PHYS (1L<<0) -#define FTW_MOUNT (1L<<1) /* Currently unsupported. */ -#define FTW_DEPTH (1L<<2) -#define FTW_CHDIR (1L<<3) -#define FTW_ALL_FLAGS (0x0000000f) - -/****************************************************************************/ - -struct FTW -{ - int quit; /* Flags passed out from the user function to ftw()/nftw() */ - int base; /* Index of current item from start of string. e.g. 4 for "foo/bar" */ - int level; /* Current depth. (counted from 0) */ -}; - -/****************************************************************************/ - -extern int ftw(const char *path,int (*func)(const char *,const struct stat *,int),int depth); -extern int nftw(const char *path,int (*func)(const char *,const struct stat *,int,struct FTW *),int depth,int flags); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _FTW_H */ diff --git a/library/include/getopt.h b/library/include/getopt.h deleted file mode 100644 index a22fbc2..0000000 --- a/library/include/getopt.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * $Id: getopt.h,v 1.2 2005-06-26 09:06:12 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _GETOPT_H -#define _GETOPT_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 - -struct option -{ - const char * name; - int has_arg; - int * flag; - int val; -}; - -/****************************************************************************/ - -extern int getopt_long(int argc, const char **argv, const char *optstring, - const struct option *longopts, int *longindex); - -/*extern int getopt_long_only(int argc, const char **argv, const char *optstring, - const struct option *longopts, int *longindex); -*/ -extern int optreset; - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _GETOPT_H */ diff --git a/library/include/grp.h b/library/include/grp.h deleted file mode 100644 index 031a802..0000000 --- a/library/include/grp.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * $Id: grp.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _GRP_H -#define _GRP_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _SYS_TYPES_H -#include -#endif /* _SYS_TYPES_H */ - -/****************************************************************************/ - -struct group -{ - char * gr_name; /* group name */ - char * gr_passwd; /* group password */ - gid_t gr_gid; /* group id */ - char ** gr_mem; /* group members */ -}; - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _GRP_H */ diff --git a/library/include/inttypes.h b/library/include/inttypes.h deleted file mode 100644 index 81c1cc4..0000000 --- a/library/include/inttypes.h +++ /dev/null @@ -1,318 +0,0 @@ -/* - * $Id: inttypes.h,v 1.2 2005-05-12 13:21:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _INTTYPES_H -#define _INTTYPES_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* Integral types with specified size; contributed by Peter Bengtsson */ - -/****************************************************************************/ - -#ifndef _STDINT_H -#include -#endif /* _STDINT_H */ - -/****************************************************************************/ - -#ifndef _STDDEF_H -#include -#endif /* _STDDEF_H */ - -/****************************************************************************/ - -/* printf() format specifications for different types. */ - -/* "Decimal" */ -#define PRId8 "d" -#define PRId16 "d" -#define PRId32 "d" -#define PRId64 "lld" - -#define PRIdLEAST8 "d" -#define PRIdLEAST16 "d" -#define PRIdLEAST32 "d" -#define PRIdLEAST64 "lld" - -#define PRIdFAST8 "d" -#define PRIdFAST16 "d" -#define PRIdFAST32 "d" -#define PRIdFAST64 "lld" - -#define PRIdPTR "ld" - -/* "Integer" */ -#define PRIi8 "i" -#define PRIi16 "i" -#define PRIi32 "i" -#define PRIi64 "lli" - -#define PRIiLEAST8 "i" -#define PRIiLEAST16 "i" -#define PRIiLEAST32 "i" -#define PRIiLEAST64 "lli" - -#define PRIiFAST8 "i" -#define PRIiFAST16 "i" -#define PRIiFAST32 "i" -#define PRIiFAST64 "lli" - -#define PRIiPTR "li" - -/* "Unsigned" */ -#define PRIu8 "u" -#define PRIu16 "u" -#define PRIu32 "u" -#define PRIu64 "llu" - -#define PRIuLEAST8 "u" -#define PRIuLEAST16 "u" -#define PRIuLEAST32 "u" -#define PRIuLEAST64 "llu" - -#define PRIuFAST8 "u" -#define PRIuFAST16 "u" -#define PRIuFAST32 "u" -#define PRIuFAST64 "llu" - -#define PRIuPTR "lu" - -/* "Hexadecimal - lowercase " */ -#define PRIx8 "x" -#define PRIx16 "x" -#define PRIx32 "x" -#define PRIx64 "llx" - -#define PRIxLEAST8 "x" -#define PRIxLEAST16 "x" -#define PRIxLEAST32 "x" -#define PRIxLEAST64 "llx" - -#define PRIxFAST8 "x" -#define PRIxFAST16 "x" -#define PRIxFAST32 "x" -#define PRIxFAST64 "llx" - -#define PRIxPTR "lx" - -/* "Hexadecimal - Uppercase" */ -#define PRIX8 "X" -#define PRIX16 "X" -#define PRIX32 "X" -#define PRIX64 "llX" - -#define PRIXLEAST8 "X" -#define PRIXLEAST16 "X" -#define PRIXLEAST32 "X" -#define PRIXLEAST64 "llX" - -#define PRIXFAST8 "X" -#define PRIXFAST16 "X" -#define PRIXFAST32 "X" -#define PRIXFAST64 "llX" - -#define PRIXPTR "lX" - -/* "Octal" */ -#define PRIo8 "o" -#define PRIo16 "o" -#define PRIo32 "o" -#define PRIo64 "llo" - -#define PRIoLEAST8 "o" -#define PRIoLEAST16 "o" -#define PRIoLEAST32 "o" -#define PRIoLEAST64 "llo" - -#define PRIoFAST8 "o" -#define PRIoFAST16 "o" -#define PRIoFAST32 "o" -#define PRIoFAST64 "llo" - -#define PRIoPTR "lo" - -/* intmax_t is 32 bits for SAS/C, 64-bits for GCC or if using a conforming C99 compiler. */ - -#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) -#define PRIdMAX "lld" -#define PRIiMAX "lli" -#define PRIuMAX "llu" -#define PRIxMAX "llx" -#define PRIXMAX "llX" -#define PRIoMAX "llo" -#else -#define PRIdMAX "ld" -#define PRIiMAX "li" -#define PRIuMAX "lu" -#define PRIxMAX "lx" -#define PRIXMAX "lX" -#define PRIoMAX "lo" -#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */ - -/* scanf() format specifiers. */ - -/* "Decimal" */ -#define SCNd8 "hhd" -#define SCNd16 "hd" -#define SCNd32 "d" -#define SCNd64 "lld" - -#define SCNdLEAST8 "hhd" -#define SCNdLEAST16 "hd" -#define SCNdLEAST32 "d" -#define SCNdLEAST64 "lld" - -#define SCNdFAST8 "hhd" -#define SCNdFAST16 "d" -#define SCNdFAST32 "d" -#define SCNdFAST64 "lld" - -#define SCNdPTR "d" - -/* "Integer" */ -#define SCNi8 "hhi" -#define SCNi16 "hi" -#define SCNi32 "i" -#define SCNi64 "lli" - -#define SCNiLEAST8 "hhi" -#define SCNiLEAST16 "hi" -#define SCNiLEAST32 "i" -#define SCNiLEAST64 "lli" - -#define SCNiFAST8 "hhi" -#define SCNiFAST16 "i" -#define SCNiFAST32 "i" -#define SCNiFAST64 "lli" - -#define SCNiPTR "i" - -/* "Unsigned" */ -#define SCNu8 "hhu" -#define SCNu16 "hu" -#define SCNu32 "u" -#define SCNu64 "llu" - -#define SCNuLEAST8 "hhu" -#define SCNuLEAST16 "hu" -#define SCNuLEAST32 "u" -#define SCNuLEAST64 "llu" - -#define SCNuFAST8 "hhu" -#define SCNuFAST16 "u" -#define SCNuFAST32 "u" -#define SCNuFAST64 "llu" - -#define SCNuPTR "u" - -/* "Hexadecimal" */ -#define SCNx8 "hhx" -#define SCNx16 "hx" -#define SCNx32 "x" -#define SCNx64 "llx" - -#define SCNxLEAST8 "hhx" -#define SCNxLEAST16 "hx" -#define SCNxLEAST32 "x" -#define SCNxLEAST64 "llx" - -#define SCNxFAST8 "hhx" -#define SCNxFAST16 "x" -#define SCNxFAST32 "x" -#define SCNxFAST64 "llx" - -#define SCNxPTR "x" - -/* "Octal" */ -#define SCNo8 "hho" -#define SCNo16 "ho" -#define SCNo32 "o" -#define SCNo64 "llo" - -#define SCNoLEAST8 "hho" -#define SCNoLEAST16 "ho" -#define SCNoLEAST32 "o" -#define SCNoLEAST64 "llo" - -#define SCNoFAST8 "hho" -#define SCNoFAST16 "o" -#define SCNoFAST32 "o" -#define SCNoFAST64 "llo" - -#define SCNoPTR "o" - -#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) -#define SCNdMAX "lld" -#define SCNiMAX "lli" -#define SCNuMAX "llu" -#define SCNxMAX "llx" -#define SCNoMAX "llo" -#else -#define SCNdMAX "ld" -#define SCNiMAX "li" -#define SCNuMAX "lu" -#define SCNxMAX "lx" -#define SCNoMAX "lo" -#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */ - -/****************************************************************************/ - -#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) -typedef struct { long long quot; long long rem; } imaxdiv_t; -#else -typedef struct { long quot; long rem; } imaxdiv_t; -#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */ - -/****************************************************************************/ - -extern intmax_t imaxabs(intmax_t x); -extern imaxdiv_t imaxdiv(intmax_t n,intmax_t d); - -/****************************************************************************/ - -extern intmax_t strtoimax(const char *str, char **ptr, int base); -extern uintmax_t strtoumax(const char *str, char **ptr, int base); - -/****************************************************************************/ - -extern intmax_t wcstoimax(const wchar_t *str, char **ptr, int base); -extern uintmax_t wcstoumax(const wchar_t *str, char **ptr, int base); - -/****************************************************************************/ - -#endif /* _INTTYPES_H */ diff --git a/library/include/iso646.h b/library/include/iso646.h deleted file mode 100644 index 0c79d0d..0000000 --- a/library/include/iso646.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: iso646.h,v 1.2 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _ISO646_H -#define _ISO646_H - -/****************************************************************************/ - -#define and && -#define and_eq &= -#define bitand & -#define bitor | -#define compl ~ -#define not ! -#define not_eq != -#define or || -#define or_eq |= -#define xor ^ -#define xor_eq ^= - -/****************************************************************************/ - -#endif /* _ISO646_H */ diff --git a/library/include/libgen.h b/library/include/libgen.h deleted file mode 100644 index e706260..0000000 --- a/library/include/libgen.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * $Id: libgen.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _LIBGEN_H -#define _LIBGEN_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -char * basename(char *path); -char * dirname(char *path); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _LIBGEN_H */ diff --git a/library/include/limits.h b/library/include/limits.h deleted file mode 100644 index 78e8608..0000000 --- a/library/include/limits.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * $Id: limits.h,v 1.8 2005-06-04 10:46:23 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _LIMITS_H -#define _LIMITS_H - -/****************************************************************************/ - -#define CHAR_BIT 8 - -/****************************************************************************/ - -#define SCHAR_MIN -128 -#define SCHAR_MAX 127 -#define UCHAR_MAX 255 - -/****************************************************************************/ - -/* - * The following defines the range a 'char' can cover by checking a - * preprocessor symbol; we support both SAS/C and GCC here. - */ - -#if (defined(__GNUC__) && defined(__CHAR_UNSIGNED__)) || (defined(__SASC) && defined(_UNSCHAR)) - -#define CHAR_MIN 0 -#define CHAR_MAX 255 - -#else - -#define CHAR_MIN -128 -#define CHAR_MAX 127 - -#endif /* (__GNUC__ && __CHAR_UNSIGNED) || (__SASC && _UNSCHAR) */ - -/****************************************************************************/ - -#define SHRT_MIN -32768 -#define SHRT_MAX 32767 -#define USHRT_MAX 65535 - -/****************************************************************************/ - -#define INT_MIN (-2147483647L - 1) -#define INT_MAX 2147483647L -#define UINT_MAX 4294967295UL - -/****************************************************************************/ - -#define LONG_MIN (-2147483647L - 1) -#define LONG_MAX 2147483647L -#define ULONG_MAX 4294967295UL - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -#define LLONG_MIN (-0x7fffffffffffffffLL-1) -#define LLONG_MAX 0x7fffffffffffffffLL -#define ULLONG_MAX 0xffffffffffffffffULL - -/****************************************************************************/ - -#define MB_LEN_MAX 1 - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#define SSIZE_MAX 2147483647L - -/****************************************************************************/ - -#define PATH_MAX 1024 - -/****************************************************************************/ - -#define WORD_BIT 32 -#define LONG_BIT 32 /* For now, at least. */ - -/****************************************************************************/ - -/* - * POSIX, POSIX... These are minimum maximum values. I.e. the maximum must be - * at least this large. I am not sure all of these make much sense on the Amiga - * (yet), but here they are anyway. - * - * Actually, these symbols should be defined only if the preprocessor symbol - * _POSIX_SOURCE is defined. Other symbols which should be defined, too, are - * ARG_MAX, CHILD_MAX, LINK_MAX, MAX_CANON, MAX_INPUT, NAME_MAX, NGROUPS_MAX, - * OPEN_MAX, PATH_MAX, PIPE_BUF, SSIZE_MAX, STREAM_MAX and TZNAME_MAX. - */ - -#define _POSIX_AIO_LISTIO_MAX 2 -#define _POSIX_AIO_MAX 1 -#define _POSIX_ARG_MAX 4096 -#define _POSIX_CHILD_MAX 6 -#define _POSIX_DELAYTIMER_MAX 32 -#define _POSIX_LINK_MAX 8 -#define _POSIX_LOGIN_NAME_MAX 9 -#define _POSIX_MAX_CANON 255 -#define _POSIX_MAX_INPUT 255 -#define _POSIX_MQ_OPEN_MAX 8 -#define _POSIX_MQ_PRIO_MAX 32 -#define _POSIX_NAME_MAX 14 -#define _POSIX_NGROUPS_MAX 0 -#define _POSIX_OPEN_MAX 16 -#define _POSIX_PATH_MAX 255 -#define _POSIX_PIPE_BUF 512 -#define _POSIX_RTSIG_MAX 8 -#define _POSIX_SEM_NSEMS_MAX 256 -#define _POSIX_SEM_VALUE_MAX 32767 -#define _POSIX_SIGQUEUE_MAX 32 -#define _POSIX_SSIZE_MAX 32767 -#define _POSIX_STREAM_MAX 8 -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -#define _POSIX_THREAD_KEYS_MAX 128 -#define _POSIX_THREADS_MAX 64 -#define _POSIX_TIMER_MAX 32 -#define _POSIX_TTY_NAME_MAX 9 -#define _POSIX_TZNAME_MAX 3 -#define _POSIX2_BC_BASE_MAX 99 -#define _POSIX2_BC_DIM_MAX 2048 -#define _POSIX2_BC_SCALE_MAX 99 -#define _POSIX2_BC_STRING_MAX 1000 -#define _POSIX2_COLL_WEIGHTS_MAX 2 -#define _POSIX2_EXPR_NEST_MAX 32 -#define _POSIX2_LINE_MAX 2048 -#define _POSIX2_RE_DUP_MAX 255 -#define _XOPEN_IOV_MAX 16 - -/* And a maximum minimum value. */ -#define _POSIX_CLOCKRES_MIN 20000000 /* Nanoseconds */ - -/****************************************************************************/ - -#endif /* _LIMITS_H */ diff --git a/library/include/locale.h b/library/include/locale.h deleted file mode 100644 index 962b3e5..0000000 --- a/library/include/locale.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * $Id: locale.h,v 1.2 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _LOCALE_H -#define _LOCALE_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#define LC_ALL 0 /* all behaviour */ -#define LC_COLLATE 1 /* behaviour of strcoll() and strxfrm() */ -#define LC_CTYPE 2 /* character handling */ -#define LC_MONETARY 3 /* monetary information returned by localeconv() */ -#define LC_NUMERIC 4 /* decimal point and non-monetary information - returned by localeconv() */ -#define LC_TIME 5 /* behaviour of strftime() */ - -/****************************************************************************/ - -struct lconv -{ - char * decimal_point; /* Decimal point character (non-monetary). */ - char * thousands_sep; /* Non-monetary digit group separator - character(s). */ - char * grouping; /* Non-monetary digit groupings. */ - char * int_curr_symbol; /* International currency symbol, followed - by the character that separates it from - the monetary quantity. */ - char * currency_symbol; /* The local currency symbol for the - current locale. */ - char * mon_decimal_point; /* Decimal point character for monetary - quantities. */ - char * mon_thousands_sep; /* Monetary digit group separator - character(s). */ - char * mon_grouping; /* Monetary digit groupings. */ - char * positive_sign; /* Sign character(s) for non-negative - monetary quantities. */ - char * negative_sign; /* Sign character(s) for negative - monetary quantities. */ - char int_frac_digits; /* Digits shown right of the decimal - point in international monetary - format. */ - char frac_digits; /* Digits shown to the right of the decimal - point in other monetary formats. */ - char p_cs_precedes; /* If currency symbol precedes non-negative - monetary values this will be 1, otherwise - it will be 0. */ - char p_sep_by_space; /* If currency symbol is separated from - non-negative monetary values by a blank - space this will be 1, otherwise it will - be 0. */ - char n_cs_precedes; /* If currency symbol precedes negative - monetary values this will be 1, otherwise - it will be 0. */ - char n_sep_by_space; /* If currency symbol is separated from - negative monetary values by a blank - space this will be 1, otherwise it will - be 0. */ - char p_sign_posn; /* Where to place the positive sign and the - currency symbol for a non-negative monetary - quantity. */ - char n_sign_posn; /* Where to place the negative sign and the - currency symbol for a negative monetary - quantity. */ -}; - -/****************************************************************************/ - -extern char *setlocale(int category, const char *locale); -extern struct lconv *localeconv(void); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _LOCALE_H */ diff --git a/library/include/math.h b/library/include/math.h deleted file mode 100644 index 6dff2b5..0000000 --- a/library/include/math.h +++ /dev/null @@ -1,314 +0,0 @@ -/* - * $Id: math.h,v 1.16 2005-06-26 09:06:12 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_H -#define _MATH_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _STDLIB_H -#include -#endif /* _STDLIB_H */ - -/****************************************************************************/ - -extern double __huge_val; - -/****************************************************************************/ - -#define HUGE_VAL ((const double)__huge_val) - -/****************************************************************************/ - -extern double acos(double x); -extern double asin(double x); -extern double atan(double x); -extern double atan2(double y,double x); -extern double ceil(double x); -extern double cos(double x); -extern double cosh(double x); -extern double exp(double x); -extern double fabs(double x); -extern double floor(double x); -extern double fmod(double x,double y); -extern double frexp(double x,int *nptr); -extern double ldexp(double x,int n); -extern double log(double x); -extern double log10(double x); -extern double modf(double x,double *nptr); -extern double pow(double x,double y); -extern double sin(double x); -extern double sinh(double x); -extern double sqrt(double x); -extern double tan(double x); -extern double tanh(double x); - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#define M_E 2.7182818284590452354 -#define M_LOG2E 1.4426950408889634074 -#define M_LOG10E 0.43429448190325182765 -#define M_LN2 0.69314718055994530942 -#define M_LN10 2.30258509299404568402 -#define M_PI 3.14159265358979323846 -#define M_PI_2 1.57079632679489661923 -#define M_PI_4 0.78539816339744830962 -#define M_1_PI 0.31830988618379067154 -#define M_2_PI 0.63661977236758134308 -#define M_2_SQRTPI 1.12837916709551257390 -#define M_SQRT2 1.41421356237309504880 -#define M_SQRT1_2 0.70710678118654752440 - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -/* Note that the comparison operations performed on the floating point - data types ought to include float, double and long double. However, - because the current (2005-06-12) compiler technology available on the - Amiga does not support the long double type yet, this library is - restricted to operations on float and double. */ - -/****************************************************************************/ - -extern float __huge_val_float; - -/****************************************************************************/ - -#define HUGE_VALF ((const float)__huge_val_float) - -/****************************************************************************/ - -extern float __infinity; -extern float __nan; - -/****************************************************************************/ - -#define INFINITY ((const float)__infinity) -#define NAN ((const float)__nan) - -/****************************************************************************/ - -#define FP_INFINITE 0 /* -/+ infinity */ -#define FP_NAN 1 /* not a number */ -#define FP_NORMAL 2 /* normalized floating point number */ -#define FP_SUBNORMAL 3 /* very small floating point number; special - case of IEEE 754 */ -#define FP_ZERO 4 /* exponent/fraction are zero */ - -/****************************************************************************/ - -extern int __fpclassify_float(float x); -extern int __fpclassify_double(double x); -extern int __isfinite_float(float x); -extern int __isfinite_double(double x); -extern int __signbit_float(float x); -extern int __signbit_double(double x); - -/****************************************************************************/ - -#define fpclassify(x) \ - (sizeof(x) == sizeof(float) ? \ - __fpclassify_float(x) : \ - __fpclassify_double(x)) - -#define isfinite(x) \ - (sizeof(x) == sizeof(float) ? \ - __isfinite_float(x) : \ - __isfinite_double(x)) - -#define isinf(x) \ - ((sizeof(x) == sizeof(float) ? \ - __fpclassify_float(x) : \ - __fpclassify_double(x)) \ - == FP_INFINITE) - -#define isnan(x) \ - ((sizeof(x) == sizeof(float) ? \ - __fpclassify_float(x) : \ - __fpclassify_double(x)) \ - == FP_NAN) - -#define isnormal(x) \ - ((sizeof(x) == sizeof(float) ? \ - __fpclassify_float(x) : \ - __fpclassify_double(x)) \ - == FP_NORMAL) - -#define signbit(x) \ - (sizeof(x) == sizeof(float) ? \ - __signbit_float(x) : \ - __signbit_double(x)) - -/****************************************************************************/ - -extern int __isunordered_float(float x,float y); -extern int __isunordered_float_double(float x,double y); -extern int __isunordered_double(double x,double y); - -/****************************************************************************/ - -#define isunordered(x,y) \ - (sizeof(x) == sizeof(float) ? \ - (sizeof(y) == sizeof(float) ? \ - __isunordered_float((x),y) : \ - __isunordered_float_double((x),(y))) : \ - (sizeof(y) == sizeof(float) ? \ - __isunordered_float_double((y),(x)) : \ - __isunordered_double((x),(y)))) - -#define isgreater(x,y) \ - (isunordered(x,y) ? 0 : (x) > (y)) - -#define isgreaterequal(x,y) \ - (isunordered(x,y) ? 0 : (x) >= (y)) - -#define isless(x,y) \ - (isunordered(x,y) ? 0 : (x) < (y)) - -#define islessequal(x,y) \ - (isunordered(x,y) ? 0 : (x) <= (y)) - -#define islessgreater(x,y) \ - (isunordered(x,y) ? 0 : (x) < (y) || (x) > (y)) /* ZZZ don't evaluate twice! */ - -/****************************************************************************/ - -extern float acosf(float x); -extern float asinf(float x); -extern float atanf(float x); -extern float atan2f(float y, float x); -extern float ceilf(float x); -extern float cosf(float x); -extern float coshf(float x); -extern float expf(float x); -extern float fabsf(float x); -extern float floorf(float x); -extern float fmodf(float x, float y); -extern float frexpf(float x, int *eptr); -extern float ldexpf(float x,int exp); -extern float logf(float x); -extern float log10f(float x); -extern float modff(float x, float *iptr); -extern float powf(float x, float y); -extern float sinf(float x); -extern float sinhf(float x); -extern float sqrtf(float x); -extern float tanf(float x); -extern float tanhf(float x); - -/****************************************************************************/ - -extern float acoshf(float x); -extern float asinhf(float x); -extern float cbrtf(float x); -extern float copysignf(float x, float y); -extern float erfcf(float x); -extern float erff(float x); -extern float expm1f(float x); -extern float fdimf(float x,float y); -extern float fmaxf(float x,float y); -extern float fminf(float x,float y); -extern float hypotf(float x, float y); -extern float lgammaf(float x); -extern float log1pf(float x); -extern float logbf(float x); -extern float nanf(const char *tagp); -extern float nextafterf(float x,float y); -extern float remainderf(float x, float p); -extern float rintf(float x); -extern float scalbnf (float x, int n); -extern int ilogbf(float x); - -/****************************************************************************/ - -extern double acosh(double x); -extern double asinh(double x); -extern double cbrt(double x); -extern double copysign(double x, double y); -extern double erf(double x); -extern double erfc(double x); -extern double expm1(double x); -extern double fdim(double x,double y); -extern double fmax(double x,double y); -extern double fmin(double x,double y); -extern double hypot(double x,double y); -extern double lgamma(double x); -extern double log1p(double x); -extern double logb(double x); -extern double nan(const char *tagp); -extern double nextafter(double x,double y); -extern double remainder(double x, double p); -extern double rint(double x); -extern double scalbn (double x, int n); -extern int ilogb(double x); - -/****************************************************************************/ - -extern float exp2f(float x); -extern double exp2(double x); - -extern double log2(double x); -extern float log2f(float x); - -/****************************************************************************/ - -#define FLT_EVAL_METHOD 0 - -/****************************************************************************/ - -typedef float float_t; -typedef double double_t; - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _MATH_H */ diff --git a/library/include/pwd.h b/library/include/pwd.h deleted file mode 100644 index 1f874f0..0000000 --- a/library/include/pwd.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * $Id: pwd.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _PWD_H -#define _PWD_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _SYS_TYPES_H -#include -#endif /* _SYS_TYPES_H */ - -/****************************************************************************/ - -struct passwd -{ - char * pw_name; /* Username */ - char * pw_passwd; /* Encrypted password */ - uid_t pw_uid; /* User ID */ - gid_t pw_gid; /* Group ID */ - char * pw_gecos; /* Real name etc */ - char * pw_dir; /* Home directory */ - char * pw_shell; /* Shell */ -}; - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _PWD_H */ diff --git a/library/include/setjmp.h b/library/include/setjmp.h deleted file mode 100644 index 143c9fd..0000000 --- a/library/include/setjmp.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * $Id: setjmp.h,v 1.2 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SETJMP_H -#define _SETJMP_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef __PPC__ - -struct __jmp_buf -{ - void * jb_ReturnAddress; - long jb_D[7]; - void * jb_A[8]; - long jb_F[8 * 3]; -}; - -#else - -struct __jmp_buf -{ - void * jb_ReturnAddress; - unsigned long jb_CondCode; - void * jb_StackPointer; - unsigned long jb_GPR[19]; - double jb_FPR[18]; -}; - -#endif /* __PPC__ */ - -/****************************************************************************/ - -typedef struct __jmp_buf jmp_buf[1]; - -/****************************************************************************/ - -extern int setjmp(jmp_buf env); -extern void longjmp(jmp_buf env,int status); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _SETJMP_H */ diff --git a/library/include/signal.h b/library/include/signal.h deleted file mode 100644 index a9e3813..0000000 --- a/library/include/signal.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * $Id: signal.h,v 1.5 2005-05-12 13:21:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SIGNAL_H -#define _SIGNAL_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#define SIG_IGN ((void (*)(int))0) -#define SIG_DFL ((void (*)(int))1) -#define SIG_ERR ((void (*)(int))-1) - -/****************************************************************************/ - -#define SIGABRT 1 -#define SIGFPE 2 -#define SIGILL 3 -#define SIGINT 4 -#define SIGSEGV 5 -#define SIGTERM 6 - -/****************************************************************************/ - -extern void (*signal(int sig, void (*)(int)))(int); -extern int raise(int sig); - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -typedef int sig_atomic_t; - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifndef _SYS_TYPES_H -#include -#endif /* _SYS_TYPES_H */ - -/****************************************************************************/ - -typedef void (*sig_t)(int); - -/****************************************************************************/ - -typedef int sigset_t; - -/****************************************************************************/ - -#define SIG_BLOCK 0 -#define SIG_UNBLOCK 1 -#define SIG_SETMASK 2 - -/****************************************************************************/ - -extern int sigmask(int signum); -extern int sigblock(int signal_mask); -extern int sigsetmask(int signal_mask); -extern int sigprocmask(int how, const sigset_t *set, sigset_t *oset); -extern int sigemptyset(sigset_t * set); -extern int sigaddset(sigset_t * set,int sig); -extern int kill(pid_t pid, int signal_number); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _SIGNAL_H */ diff --git a/library/include/stdarg.h b/library/include/stdarg.h deleted file mode 100644 index 05844b5..0000000 --- a/library/include/stdarg.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * $Id: stdarg.h,v 1.4 2005-04-03 10:22:48 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDARG_H -#define _STDARG_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef __amigaos4__ - -/****************************************************************************/ - -typedef char * va_list; - -/****************************************************************************/ - -#define va_start(ap, last) ((void)(ap = (va_list)&(last) + sizeof(last))) -#define va_arg(ap, type) ((type *)(ap += sizeof(type)))[-1] -#define va_end(ap) ((void)0) - -/****************************************************************************/ - -/* The following macro is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -#define va_copy(dst,src) ((void)((dst) = (src))) - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#if defined(__GNUC__) - -/* Use the compiler supplied, machine specific file. */ -#undef _STDARG_H -#include_next "stdarg.h" - -#include - -#else - -#error "Unknown compiler" - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _STDARG_H */ diff --git a/library/include/stdbool.h b/library/include/stdbool.h deleted file mode 100644 index 796bb05..0000000 --- a/library/include/stdbool.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * $Id: stdbool.h,v 1.2 2005-05-12 13:21:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDBOOL_H -#define _STDBOOL_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -#if defined(__cplusplus) && defined(__GNUC__) -#warning C99 header used in C++. -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) -#warning C99 header file used by non-C99 compliant compiler. -#endif /* !__STDC_VERSION__ || __STDC_VERSION__ < 199901L */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#define bool _Bool - -/****************************************************************************/ - -#define false 0 -#define true 1 - -/****************************************************************************/ - -#define __bool_true_and_false_are_defined 1 - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _STDBOOL_H */ diff --git a/library/include/stddef.h b/library/include/stddef.h deleted file mode 100644 index 48c8ba6..0000000 --- a/library/include/stddef.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * $Id: stddef.h,v 1.4 2005-05-12 13:21:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDDEF_H -#define _STDDEF_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef NULL -#ifndef __cplusplus -#define NULL ((void *)0L) -#else -#define NULL 0L -#endif /* __cplusplus */ -#endif /* NULL */ - -/****************************************************************************/ - -typedef int ptrdiff_t; -typedef unsigned int size_t; -typedef unsigned short wchar_t; - -/****************************************************************************/ - -#define offsetof(type, member) ((size_t)&((type *)0)->member) - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _STDDEF_H */ diff --git a/library/include/stdint.h b/library/include/stdint.h deleted file mode 100644 index 51e5c3b..0000000 --- a/library/include/stdint.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - * $Id: stdint.h,v 1.2 2005-05-12 13:21:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDINT_H -#define _STDINT_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* C99 integer type definitions; contributed by Peter Bengtsson */ - -/****************************************************************************/ - -#ifndef _LIMITS_H -#include -#endif /* _LIMITS_H */ - -/****************************************************************************/ - -/* Common for all supported compilers. */ - -typedef signed char int8_t; -typedef signed short int16_t; -typedef signed int int32_t; -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; - -typedef signed char int_least8_t; -typedef signed short int_least16_t; -typedef signed int int_least32_t; -typedef unsigned char uint_least8_t; -typedef unsigned short uint_least16_t; -typedef unsigned int uint_least32_t; - -/* This is mostly guesswork. */ -typedef signed char int_fast8_t; -typedef signed int int_fast16_t; -typedef signed int int_fast32_t; -typedef unsigned char uint_fast8_t; -typedef unsigned int uint_fast16_t; -typedef unsigned int uint_fast32_t; - -typedef signed long intptr_t; -typedef unsigned long uintptr_t; - -#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) -typedef signed long long int64_t; -typedef unsigned long long uint64_t; -typedef signed long long int_least64_t; -typedef unsigned long long uint_least64_t; -typedef signed long long int_fast64_t; -typedef unsigned long long uint_fast64_t; -typedef signed long long intmax_t; -typedef unsigned long long uintmax_t; -#else -typedef signed long intmax_t; -typedef unsigned long uintmax_t; -#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */ - -#define INT8_MIN SCHAR_MIN -#define INT8_MAX SCHAR_MAX -#define UINT8_MAX UCHAR_MAX -#define INT16_MIN SHRT_MIN -#define INT16_MAX SHRT_MAX -#define UINT16_MAX USHRT_MAX -#define INT32_MIN INT_MIN -#define INT32_MAX INT_MAX -#define UINT32_MAX UINT_MAX -#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) -#define INT64_MIN LLONG_MIN -#define INT64_MAX LLONG_MAX -#define UINT64_MAX ULLONG_MAX -#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */ - -#define INT_LEAST8_MIN SCHAR_MIN -#define INT_LEAST8_MAX SCHAR_MAX -#define UINT_LEAST8_MAX UCHAR_MAX -#define INT_LEAST16_MIN SHRT_MIN -#define INT_LEAST16_MAX SHRT_MAX -#define UINT_LEAST16_MAX USHRT_MAX -#define INT_LEAST32_MIN INT_MIN -#define INT_LEAST32_MAX INT_MAX -#define UINT_LEAST32_MAX UINT_MAX -#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) -#define INT_LEAST64_MIN LLONG_MIN -#define INT_LEAST64_MAX LLONG_MAX -#define UINT_LEAST64_MAX ULLONG_MAX -#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */ - -#define INT_FAST8_MIN SCHAR_MIN -#define INT_FAST8_MAX SCHAR_MAX -#define UINT_FAST8_MAX UCHAR_MAX -#define INT_FAST16_MIN INT_MIN -#define INT_FAST16_MAX INT_MAX -#define UINT_FAST16_MAX UINT_MAX -#define INT_FAST32_MIN INT_MIN -#define INT_FAST32_MAX INT_MAX -#define UINT_FAST32_MAX UINT_MAX -#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) -#define INT_FAST64_MIN LLONG_MIN -#define INT_FAST64_MAX LLONG_MAX -#define UINT_FAST64_MAX ULLONG_MAX -#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */ - -#define INTPTR_MIN LONG_MIN -#define INTPTR_MAX LONG_MAX -#define UINTPTR_MAX ULONG_MAX - -#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) -#define INTMAX_MIN LLONG_MIN -#define INTMAX_MAX LLONG_MAX -#define UINTMAX_MAX ULLONG_MAX -#else -#define INTMAX_MIN LONG_MIN -#define INTMAX_MAX LONG_MAX -#define UINTMAX_MAX ULONG_MAX -#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */ - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) -/* sigatomic_t is an int. */ -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -/* Maximum value of size_t */ -#define SIZE_MAX UINT_MAX -#endif /* not C++ or LIMIT_MACROS */ - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) -#define INT8_C(x) x -#define INT16_C(x) x -#define INT32_C(x) x -#define INT64_C(x) x ## LL - -#define UINT8_C(x) x ## U -#define UINT16_C(x) x ## U -#define UINT32_C(x) x ## U -#define UINT64_C(x) x ## ULL - -#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) -#define INTMAX_C(x) x ## LL -#define UINTMAX_C(x) x ## ULL -#else -#define INTMAX_C(x) x ## L -#define UINTMAX_C(x) x ## UL -#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */ - -#endif /* not C++ or CONSTANT_MACROS */ - -/****************************************************************************/ - -#define PTRDIFF_MIN INT_MIN -#define PTRDIFF_MAX INT_MAX - -#define WCHAR_MIN 0 -#define WCHAR_MAX USHRT_MAX - -#define WINT_MIN INT_MIN -#define WINT_MAX INT_MAX - -/****************************************************************************/ - -#endif /* _STDINT_H */ diff --git a/library/include/stdio.h b/library/include/stdio.h deleted file mode 100644 index 65631f5..0000000 --- a/library/include/stdio.h +++ /dev/null @@ -1,452 +0,0 @@ -/* - * $Id: stdio.h,v 1.16 2005-06-18 07:23:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_H -#define _STDIO_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _STDDEF_H -#include -#endif /* _STDDEF_H */ - -#ifndef _STDARG_H -#include -#endif /* _STDARG_H */ - -#ifndef _SYS_TYPES_H -#include -#endif /* _SYS_TYPES_H */ - -/****************************************************************************/ - -/* 'End of file' indicator returned by, for example, fgetc() */ -#define EOF (-1) - -/****************************************************************************/ - -/* - * Maximum number of files that can be open at a time. This number does not - * correspond to a real limitation for this 'C' runtime library and is - * included solely for ISO 'C' (1994) compliance. - */ -#define FOPEN_MAX 64 - -/****************************************************************************/ - -/* Maximum size of a file/path name. */ -#define FILENAME_MAX 256 - -/****************************************************************************/ - -/* Default size for all standard I/O file buffers. */ -#define BUFSIZ 8192 - -/****************************************************************************/ - -/* File buffering modes for use with setvbuf() */ - -#define _IOFBF 0 /* Full buffering (flush when buffer is full) */ - -#define _IOLBF 1 /* Line buffering (flush when buffer is full or when - a line feed character is written) */ - -#define _IONBF 2 /* Perform no buffering at all */ - -/****************************************************************************/ - -/* Positioning modes for use with fseek() */ - -#define SEEK_SET 0 /* New position is absolute */ -#define SEEK_CUR 1 /* New position is relative to current file position */ -#define SEEK_END 2 /* New position is relative to end of file */ - -/****************************************************************************/ - -/* Used by fgetpos() and fsetpos() */ - -#if defined(__GNUC__) -typedef long long fpos_t; -#else -typedef long fpos_t; -#endif /* __GNUC__ */ - -/****************************************************************************/ - -/* - * This is part of the internal 'FILE' structure; this is guaranteed not to - * change in future library releases. However, the private portion of this - * data structure may change. - */ -typedef struct -{ - unsigned long flags; /* See below for some of the public - flag bits defined; this is by no - means a complete list, though! */ - unsigned char * buffer; /* Points to the first byte of the - buffer; this could be NULL! */ - long size; /* How many bytes will fit into the - buffer; this could be 0! */ - long position; /* Current buffer position, which is - usually a number between 0 and - size-1 */ - long num_read_bytes; /* How many bytes can be read from - the buffer; this can be 0! */ - long num_write_bytes; /* How many bytes have been copied - to the buffer which have not been - written back yet; this can be 0! */ - - /* Private fields follow... */ -} FILE; - -/****************************************************************************/ - -/* Field and flag definitions for the getc/putc macros below. */ -#define __FILE_BUFFER_MASK 3 /* Masks off the buffering mode */ -#define __FILE_EOF (1<<2) /* EOF reached */ -#define __FILE_READABLE (1<<3) /* File is readable */ -#define __FILE_WRITABLE (1<<4) /* File is writable */ -#define __FILE_IN_USE (1<<5) /* File is in use */ -#define __FILE_ERROR (1<<6) /* Error detected */ - -/****************************************************************************/ - -/* - * Maximum file name buffer size for use with tmpfile() and tmpnam(); - * note that the maximum file name length is shorter by one character - */ -#define L_tmpnam 10 - -/* Maximum number of unique file names tmpnam() can generate */ -#define TMP_MAX 0x3ffff - -/****************************************************************************/ - -/* Anchor for the buffered standard I/O streams */ -extern struct iob ** __iob; - -/****************************************************************************/ - -/* The three standard I/O streams */ -#define stdin ((FILE *)__iob[0]) -#define stdout ((FILE *)__iob[1]) -#define stderr ((FILE *)__iob[2]) - -/****************************************************************************/ - -extern void perror(const char * s); - -/****************************************************************************/ - -extern FILE *fopen(const char *filename, const char *mode); -extern int fclose(FILE *stream); -extern int fflush(FILE *stream); -extern FILE *freopen(const char *filename, const char *mode, FILE *stream); -extern int setvbuf(FILE *stream,char *buf,int bufmode,size_t size); -extern void setbuf(FILE *stream, char *buf); - -/****************************************************************************/ - -extern int fseek(FILE *stream, long int offset, int wherefrom); -extern long int ftell(FILE *stream); -extern void rewind(FILE *stream); -extern int fgetpos(FILE *stream, fpos_t *pos); -extern int fsetpos(FILE *stream, fpos_t *pos); - -/****************************************************************************/ - -extern int fgetc(FILE *stream); -extern int getc(FILE *stream); -extern int getchar(void); -extern int ungetc(int c,FILE *stream); - -/****************************************************************************/ - -extern int fputc(int c,FILE *stream); -extern int putc(int c,FILE *stream); -extern int putchar(int c); - -/****************************************************************************/ - -extern char *fgets(char *s,int n,FILE *stream); -extern char *gets(char *s); - -/****************************************************************************/ - -extern int fscanf(FILE *stream, const char *format, ...); -extern int scanf(const char *format, ...); -extern int sscanf(const char *s,const char *format, ...); - -/****************************************************************************/ - -extern int fputs(const char *s, FILE *stream); -extern int puts(const char *s); - -/****************************************************************************/ - -extern int fprintf(FILE *stream,const char *format,...); -extern int printf(const char *format, ...); -extern int sprintf(char *s, const char *format, ...); - -/****************************************************************************/ - -extern int vfprintf(FILE *stream,const char *format,va_list arg); -extern int vprintf(const char *format,va_list arg); -extern int vsprintf(char *s, const char *format,va_list arg); - -/****************************************************************************/ - -extern size_t fread(void *ptr,size_t element_size,size_t count,FILE *stream); -extern size_t fwrite(const void *ptr,size_t element_size,size_t count,FILE *stream); - -/****************************************************************************/ - -extern int feof(FILE *stream); -extern int ferror(FILE *stream); -extern void clearerr(FILE *stream); - -/****************************************************************************/ - -extern int rename(const char *oldname,const char *newname); -extern int remove(const char *filename); - -/****************************************************************************/ - -extern FILE *tmpfile(void); -extern char *tmpnam(char *buf); - -/****************************************************************************/ - -/* - * fgetc() implemented as a "simple" macro; note that fgetc() does much more than - * can be conveniently expressed as a macro! - */ -#define __getc_unlocked(f) \ - (((((FILE *)(f))->flags & (__FILE_IN_USE|__FILE_READABLE|__FILE_EOF)) == (__FILE_IN_USE|__FILE_READABLE) && \ - (((FILE *)(f))->flags & __FILE_BUFFER_MASK) != _IONBF && \ - ((FILE *)(f))->position < ((FILE *)(f))->num_read_bytes) ? \ - ((FILE *)(f))->buffer[((FILE *)(f))->position++] : \ - fgetc(f)) - -/****************************************************************************/ - -/* - * fputc() implemented as a "simple" macro; note that fputc() does much more than - * can be conveniently expressed as a macro! - */ -#define __putc_unlocked(c,f) \ - (((((FILE *)(f))->flags & (__FILE_IN_USE|__FILE_WRITABLE)) == (__FILE_IN_USE|__FILE_WRITABLE) && \ - (((FILE *)(f))->flags & __FILE_BUFFER_MASK) != _IONBF && \ - (((FILE *)(f))->num_write_bytes < ((FILE *)(f))->size)) ? \ - (((FILE *)(f))->buffer[((FILE *)(f))->num_write_bytes++] = (c), \ - (((((FILE *)(f))->flags & __FILE_BUFFER_MASK) == _IOLBF && \ - ((FILE *)(f))->buffer[((FILE *)(f))->num_write_bytes-1] == '\n') ? \ - __flush(f) : \ - (((FILE *)(f))->buffer[((FILE *)(f))->num_write_bytes-1]))) : \ - fputc((c),(f))) - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -#define getc(f) (flockfile(f), __unlockfile((f),__getc_unlocked(f))) -#define putc(c,f) (flockfile(f), __unlockfile((f),__putc_unlocked((c),(f)))) - -#else - -#define getc(f) __getc_unlocked(f) -#define putc(c,f) __putc_unlocked((c),(f)) - -#endif /* __THREAD_SAFE */ - -/****************************************************************************/ - -#define getchar() getc(stdin) -#define putchar(c) putc((c),stdout) - -/****************************************************************************/ - -/* - * If requested, reimplement some of the file I/O routines as macros. - */ - -#ifdef __C_MACROS__ - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -/****************************************************************************/ - -#define clearerr(file) ((void)(flockfile(file), (file)->flags &= ~(__FILE_EOF|__FILE_ERROR), funlockfile(file))) -#define feof(file) (flockfile(file), __unlockfile((file),((file)->flags & __FILE_EOF) != 0)) -#define ferror(file) (flockfile(file), __unlockfile((file),((file)->flags & __FILE_ERROR) != 0)) - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#define clearerr(file) ((void)((file)->flags &= ~(__FILE_EOF|__FILE_ERROR))) -#define feof(file) (((file)->flags & __FILE_EOF) != 0) -#define ferror(file) (((file)->flags & __FILE_ERROR) != 0) - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ - -/****************************************************************************/ - -#endif /* __C_MACROS__ */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#define MAXPATHLEN (4 * FILENAME_MAX) - -/****************************************************************************/ - -#define L_ctermid 32 - -/****************************************************************************/ - -extern char *ctermid(char *); - -/****************************************************************************/ - -/* - * A special buffer flush routine which returns the last character written - * in case of success and EOF in case of failure. This is used by the - * __putc_unlocked() macro defined above. - */ -extern int __flush(FILE *stream); - -/****************************************************************************/ - -/* - * A special function which returns the input character. This is used by - * the __getc_unlocked() macro defined above. - */ -extern int __unlockfile(FILE *stream,int c); - -/****************************************************************************/ - -extern int getc_unlocked(FILE *stream); -extern int getchar_unlocked(void); -extern int putc_unlocked(int c,FILE *stream); -extern int putchar_unlocked(int c); - -/****************************************************************************/ - -#define getc_unlocked(f) __getc_unlocked(f) -#define putc_unlocked(c,f) __putc_unlocked((c),(f)) - -#define getchar_unlocked() __getc_unlocked(stdin) -#define putchar_unlocked(c) __putc_unlocked((c),stdout) - -/****************************************************************************/ - -extern FILE * fdopen(int file_descriptor, const char * type); -extern int fileno(FILE * file); -extern int asprintf(char **ret, const char *format, ...); -extern int vsnprintf(char *s,size_t size,const char *format,va_list arg); -extern int pclose(FILE *stream); -extern FILE * popen(const char *command, const char *type); -extern int fseeko(FILE *stream, off_t offset, int wherefrom); -extern off_t ftello(FILE *stream); - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -/****************************************************************************/ - -extern void flockfile(FILE * file); -extern void funlockfile(FILE * file); -extern int ftrylockfile(FILE * file); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#define flockfile(file) ((void)0) -#define funlockfile(file) ((void)0) -#define ftrylockfile(file) (0) - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ - -/****************************************************************************/ - -extern int vasprintf(char **ret,const char *format,va_list arg); - -#ifdef __MEM_DEBUG -extern int __vasprintf(const char *file,int line,char **ret,const char *format,va_list arg); - -#define vasprintf(ret,format,arg) __vasprintf(__FILE__,__LINE__,(ret),(format),(arg)) -#endif /* __MEM_DEBUG */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -extern int vfscanf(FILE *stream, const char *format, va_list arg); -extern int vsscanf(const char *s, const char *format, va_list arg); -extern int vscanf(const char *format,va_list arg); -extern int snprintf(char *s,size_t size,const char *format,...); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _STDIO_H */ diff --git a/library/include/stdlib.h b/library/include/stdlib.h deleted file mode 100644 index a4f50e4..0000000 --- a/library/include/stdlib.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * $Id: stdlib.h,v 1.11 2005-05-12 13:21:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_H -#define _STDLIB_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _STDDEF_H -#include -#endif /* _STDDEF_H */ - -/****************************************************************************/ - -/* Maximum number of bytes in a multibyte character */ -#define MB_CUR_MAX 2 - -/****************************************************************************/ - -/* The maximum value that can be returned by the rand() function */ -#define RAND_MAX 2147483647 - -/****************************************************************************/ - -/* Return values to be passed to exit() */ -#define EXIT_FAILURE 20 -#define EXIT_SUCCESS 0 - -/****************************************************************************/ - -/* Data structures used by the div() and ldiv() functions */ -typedef struct { int quot; int rem; } div_t; -typedef struct { long quot; long rem; } ldiv_t; - -/****************************************************************************/ - -extern int mblen(const char *s, size_t n); -extern int mbtowc(wchar_t *pwc, const char *s, size_t n); -extern int wctomb(char *s, wchar_t wchar); -extern size_t mbstowcs(wchar_t *pwcs, const char *s, size_t n); -extern size_t wcstombs(char *s, const wchar_t *pwcs, size_t n); - -/****************************************************************************/ - -extern void *malloc(size_t size); -extern void *calloc(size_t num_elements,size_t element_size); -extern void free(void *ptr); -extern void *realloc(void *ptr,size_t size); - -#ifdef __MEM_DEBUG -extern void *__malloc(size_t size,const char *file,int line); -extern void *__calloc(size_t num_elements,size_t element_size,const char *file,int line); -extern void __free(void *ptr,const char *file,int line); -extern void *__realloc(void *ptr,size_t size,const char *file,int line); - -#define malloc(size) __malloc((size),__FILE__,__LINE__) -#define calloc(num_elements,element_size) __calloc((num_elements),(element_size),__FILE__,__LINE__) -#define free(ptr) __free((ptr),__FILE__,__LINE__) -#define realloc(ptr,size) __realloc((ptr),(size),__FILE__,__LINE__) -#endif /* __MEM_DEBUG */ - -/****************************************************************************/ - -extern int abs(int x); -extern long labs(long x); -extern div_t div(int n,int d); -extern ldiv_t ldiv(long n,long d); - -/****************************************************************************/ - -extern int rand(void); -extern void srand(unsigned seed); - -/****************************************************************************/ - -extern int system(const char *command); - -/****************************************************************************/ - -extern void exit(int status); -extern void abort(void); - -/****************************************************************************/ - -extern int atexit(void (*)(void)); - -/****************************************************************************/ - -extern char * getenv(const char *name); - -/****************************************************************************/ - -extern void * bsearch(const void *key, const void *base, size_t count, size_t size, - int (*compare)(const void * key,const void * value)); -extern void qsort(void *base,size_t count,size_t size, - int (*compare)(const void * element1,const void * element2)); - -/****************************************************************************/ - -extern double strtod(const char *str, char ** ptr); -extern long strtol(const char *str, char **ptr, int base); -extern unsigned long strtoul(const char *str, char **ptr, int base); - -/****************************************************************************/ - -extern double atof(const char *str); -extern int atoi(const char *str); -extern long atol(const char *str); - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -extern int rand_r(unsigned int * seed); - -/****************************************************************************/ - -#if defined(__GNUC__) - #undef alloca - #define alloca(size) __builtin_alloca(size) -#else - extern void * alloca(size_t size); - - #ifdef __MEM_DEBUG - extern void * __alloca(size_t size,const char *file,int line); - - #define alloca(size) __alloca((size),__FILE__,__LINE__) - #endif /* __MEM_DEBUG */ -#endif /* __GNUC__ */ - -/****************************************************************************/ - -extern int setenv(const char *name, const char *value, int overwrite); -extern int putenv(const char *string); -extern void unsetenv(const char *name); -extern char * mktemp(char * name_template); -extern int mkstemp(char *name_template); -extern char * mkdtemp(char *name_template); - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -#if defined(__GNUC__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) - -/****************************************************************************/ - -extern long long strtoll(const char *str, char **ptr, int base); -extern unsigned long long strtoull(const char *str, char **ptr, int base); -extern long long atoll(const char *str); - -/****************************************************************************/ - -typedef struct { long long quot; long long rem; } lldiv_t; - -/****************************************************************************/ - -extern long long llabs(long long x); -extern lldiv_t lldiv(long long n,long long d); - -/****************************************************************************/ - -#endif /* __GNUC__ || (__STDC_VERSION__ && __STDC_VERSION__ >= 199901L) */ - -/****************************************************************************/ - -extern float strtof(const char *str, char ** ptr); - -/****************************************************************************/ - -extern void _Exit(int status); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _STDLIB_H */ diff --git a/library/include/string.h b/library/include/string.h deleted file mode 100644 index 9946646..0000000 --- a/library/include/string.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * $Id: string.h,v 1.7 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_H -#define _STRING_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _STDDEF_H -#include -#endif /* _STDDEF_H */ - -/****************************************************************************/ - -extern char *strerror(int error_number); -extern char *strcat(char *dest, const char *src); -extern char *strncat(char *dest, const char *src, size_t n); -extern int strcmp(const char *s1, const char * s2); -extern int strncmp(const char *s1, const char *s2, size_t n); -extern char *strcpy(char *dest, const char *src); -extern char *strncpy(char *dest, const char *src, size_t n); -extern size_t strlen(const char *s); -extern char *strchr(const char *s, int c); -extern char *strrchr(const char *s, int c); -extern size_t strspn(const char *s, const char *set); -extern size_t strcspn(const char *s, const char *set); -extern char *strpbrk(const char *s, const char *set); -extern char *strtok(char *str, const char *set); -extern char *strstr(const char *src, const char *sub); - -/****************************************************************************/ - -extern int strcoll(const char *s1, const char *s2); -extern size_t strxfrm(char *dest, const char *src, size_t len); - -/****************************************************************************/ - -extern void *memmove(void *dest, const void * src, size_t len); -extern void *memchr(const void * ptr, int val, size_t len); - -/* This is ugly: GCC 2.95.x assumes that 'unsigned long' is used in the built-in - memcmp/memcpy/memset functions instead of 'size_t'. This can produce warnings - where none are necessary. */ -#if defined(__GNUC__) && (__GNUC__ < 3) -extern int memcmp(const void *ptr1, const void *ptr2, unsigned long len); -extern void *memcpy(void *dest, const void *src, unsigned long len); -extern void *memset(void *ptr, int val, unsigned long len); -#else -extern int memcmp(const void *ptr1, const void *ptr2, size_t len); -extern void *memcpy(void *dest, const void *src, size_t len); -extern void *memset(void *ptr, int val, size_t len); -#endif /* __GNUC__ && __GNUC__ < 3 */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifndef _STRINGS_H -#include -#endif /* _STRINGS_H */ - -/****************************************************************************/ - -extern char * index(const char *s, int c); -extern char * rindex(const char *s, int c); - -/****************************************************************************/ - -extern char * strdup(const char *s); - -#ifdef __MEM_DEBUG -extern char * __strdup(const char *s,const char *file,int line); - -#define strdup(s) __strdup((s),__FILE__,__LINE__) -#endif /* __MEM_DEBUG */ - -/****************************************************************************/ - -extern void bcopy(const void *from,void *to,size_t len); -extern void bzero(void *m,size_t len); -extern int bcmp(const void *a,const void *b,size_t len); - -/****************************************************************************/ - -extern size_t strlcpy(char *dst, const char *src, size_t siz); -extern size_t strlcat(char *dst, const char *src, size_t siz); - -/****************************************************************************/ - -extern char * strtok_r(char *str, const char *separator_set,char ** state_ptr); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _STRING_H */ diff --git a/library/include/strings.h b/library/include/strings.h deleted file mode 100644 index 5fa8b64..0000000 --- a/library/include/strings.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * $Id: strings.h,v 1.4 2005-03-02 12:57:56 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRINGS_H -#define _STRINGS_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _STDDEF_H -#include -#endif /* _STDDEF_H */ - -/****************************************************************************/ - -/* These come from 4.4BSD. */ -extern int strcasecmp(const char *s1, const char *s2); -extern int strncasecmp(const char *s1, const char *s2, size_t len); -extern int ffs(int i); - -/****************************************************************************/ - -/* - * These two provide functions which are available with the Lattice and - * SAS/C compiler runtime libraries. Which probably makes them more exotic - * than XENIX. - */ -#define stricmp(s1, s2) strcasecmp((s1), (s2)) -#define strnicmp(s1, s2, len) strncasecmp((s1), (s2), (len)) - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _STRINGS_H */ diff --git a/library/include/sys/amigaos-va.h b/library/include/sys/amigaos-va.h deleted file mode 100644 index 01f2272..0000000 --- a/library/include/sys/amigaos-va.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * $Id: amigaos-va.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SYS_AMIGAOS_VA_H -#define _SYS_AMIGAOS_VA_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _STDARG_H -#include -#endif /* _STDARG_H */ - -/****************************************************************************/ - -/* Define the AmigaOS specific varargs macros, - if didn't already define them. */ - -#ifndef va_startlinear - #define va_startlinear(AP,ARG) \ - va_start(AP,ARG) -#endif - -#ifndef va_getlinearva - #if defined(__GNUC__) && defined(__PPC__) - #define va_getlinearva(AP,TYPE) \ - ((TYPE)__builtin_getlinearva(AP)) - #else - #define va_getlinearva(AP,TYPE) \ - ((TYPE)(void *)(AP)) - #endif -#endif - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _SYS_AMIGAOS_VA_H */ diff --git a/library/include/sys/clib2_stdc.h b/library/include/sys/clib2_stdc.h deleted file mode 100644 index 1519104..0000000 --- a/library/include/sys/clib2_stdc.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $Id: clib2_stdc.h,v 1.1 2005-05-12 13:21:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SYS_CLIB2_STDC_H -#define _SYS_CLIB2_STDC_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* Make the "restrict" qualifier work well with 'C' compilers that do - not support it. We do assume that __STDC__ is defined, though. */ -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) -#define restrict -#endif /* !__STDC_VERSION__ || __STDC_VERSION__ < 199901L */ - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _SYS_CLIB2_STDC_H */ diff --git a/library/include/sys/mount.h b/library/include/sys/mount.h deleted file mode 100644 index 7d0e4fc..0000000 --- a/library/include/sys/mount.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * $Id: mount.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SYS_MOUNT_H -#define _SYS_MOUNT_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _SYS_TYPES_H -#include -#endif /* _SYS_TYPES_H */ - -/****************************************************************************/ - -typedef struct { long val[2]; } fsid_t; /* file system id type */ - -/****************************************************************************/ - -#define MFSNAMELEN 16 /* length of fs type name, including nul */ -#define MNAMELEN 90 /* length of buffer for returned name */ - -/****************************************************************************/ - -struct statfs -{ - long f_bsize; /* fundamental file system block size */ - long f_iosize; /* optimal transfer block size */ - long f_blocks; /* total data blocks in file system */ - long f_bfree; /* free blocks in fs */ - long f_bavail; /* free blocks avail to non-superuser */ - long f_files; /* total file nodes in file system */ - long f_ffree; /* free file nodes in fs */ - fsid_t f_fsid; /* file system id */ - uid_t f_owner; /* user that mounted the file system */ - long f_flags; /* copy of mount flags */ - long f_syncwrites; /* count of sync writes since mount */ - long f_asyncwrites; /* count of async writes since mount */ - char f_fstypename[MFSNAMELEN]; /* fs type name */ - char f_mntonname[MNAMELEN]; /* directory on which mounted */ - char f_mntfromname[MNAMELEN]; /* mounted file system */ -}; - -/****************************************************************************/ - -#define MNT_RDONLY (1<<0) /* The filesystem is mounted read-only */ -#define MNT_NOEXEC 0 -#define MNT_NOSUID 0 -#define MNT_NODEV 0 -#define MNT_SYNCHRONOUS 0 -#define MNT_ASYNC 0 -#define MNT_UNION 0 -#define MNT_NOCOREDUMP 0 -#define MNT_NOATIME (1<<1) /* Never update access times */ -#define MNT_SYMPERM (1<<2) /* Recognize symbolic link permission */ -#define MNT_NODEVMTIME 0 -#define MNT_SOFTDEP 0 -#define MNT_LOCAL (1<<3) /* The filesystem resides locally */ -#define MNT_QUOTA 0 -#define MNT_ROOTFS 0 -#define MNT_EXRDONLY 0 -#define MNT_EXPORTED 0 -#define MNT_DEFEXPORTED 0 -#define MNT_EXPORTANON 0 -#define MNT_EXKERB 0 -#define MNT_EXNORESPORT 0 -#define MNT_EXPUBLIC 0 - -/****************************************************************************/ - -int statfs(const char *path, struct statfs *buf); -int fstatfs(int fd, struct statfs *buf); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _SYS_MOUNT_H */ diff --git a/library/include/sys/stat.h b/library/include/sys/stat.h deleted file mode 100644 index 0f24284..0000000 --- a/library/include/sys/stat.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * $Id: stat.h,v 1.5 2005-04-02 13:25:55 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SYS_STAT_H -#define _SYS_STAT_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _SYS_TYPES_H -#include -#endif /* _SYS_TYPES_H */ - -#ifndef _STDDEF_H -#include -#endif /* _STDDEF_H */ - -#ifndef _TIME_H -#include -#endif /* _TIME_H */ - -/****************************************************************************/ - -#define S_ISUID 0004000 /* set user id on execution */ -#define S_ISGID 0002000 /* set group id on execution */ -#define S_ISVTX 0001000 /* save swapped text even after use */ - -#define S_IRWXU 0000700 /* RWX mask for owner */ -#define S_IRUSR 0000400 /* R for owner */ -#define S_IWUSR 0000200 /* W for owner */ -#define S_IXUSR 0000100 /* X for owner */ - -#define S_IRWXG 0000070 /* RWX mask for group */ -#define S_IRGRP 0000040 /* R for group */ -#define S_IWGRP 0000020 /* W for group */ -#define S_IXGRP 0000010 /* X for group */ - -#define S_IRWXO 0000007 /* RWX mask for other */ -#define S_IROTH 0000004 /* R for other */ -#define S_IWOTH 0000002 /* W for other */ -#define S_IXOTH 0000001 /* X for other */ - -/****************************************************************************/ - -/* Aliases for the owner RWX mask. */ -#define S_IREAD S_IRUSR -#define S_IWRITE S_IWUSR -#define S_IEXEC S_IXUSR - -/****************************************************************************/ - -#define S_IFMT 0170000 /* type of file */ -#define S_IFIFO 0010000 /* named pipe (fifo) */ -#define S_IFCHR 0020000 /* character special */ -#define S_IFDIR 0040000 /* directory */ -#define S_IFBLK 0060000 /* block special */ -#define S_IFREG 0100000 /* regular */ -#define S_IFLNK 0120000 /* symbolic link */ -#define S_IFSOCK 0140000 /* socket */ - -/****************************************************************************/ - -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */ -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* char special */ -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */ -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* symbolic link */ -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo */ -#define S_ISBLK(m) (0) /* block special */ - -/****************************************************************************/ - -struct stat -{ - mode_t st_mode; - ino_t st_ino; - dev_t st_dev; - dev_t st_rdev; - nlink_t st_nlink; - uid_t st_uid; - gid_t st_gid; - off_t st_size; - time_t st_atime; - time_t st_mtime; - time_t st_ctime; - long st_blksize; - long st_blocks; -}; - -/****************************************************************************/ - -extern int stat(const char * path_name, struct stat * buffer); -extern int fstat(int file_descriptor, struct stat * buffer); -extern int lstat(const char * path_name, struct stat * buffer); -extern int chmod(const char * path_name, mode_t mode); -extern int fchmod(int file_descriptor, mode_t mode); -extern int mkdir(const char * path_name, mode_t mode); -extern int rmdir(const char * path_name); -extern mode_t umask(mode_t new_mask); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _SYS_STAT_H */ diff --git a/library/include/sys/time.h b/library/include/sys/time.h deleted file mode 100644 index 8b74791..0000000 --- a/library/include/sys/time.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * $Id: time.h,v 1.8 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SYS_TIME_H -#define _SYS_TIME_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -/* This is a tough one. Some code takes a bad turn if the - header file is pulled in, which rules out that the structure definitions - in are used. We are only interested in the timeval - structure and try to get by with this definition. Sometimes it works, - sometimes it doesn't. Not sure if there really is a good solution for - this problem... */ -#if !defined(__TIMEVAL_ALREADY_DEFINED) && !defined(__USE_CLIB2_TIMEVAL) - -/****************************************************************************/ - -/* The V40 header files (OS 3.x) and below will always define the - 'struct timeval' in . But the V50 header - files and beyond will not define 'struct timeval' if it is - included from here. We start by checking which header files - are being used. */ -#ifndef EXEC_TYPES_H -#include -#endif /* EXEC_TYPES_H */ - -/****************************************************************************/ - -/* Which header file version is being used? */ -#if INCLUDE_VERSION < 50 - -/****************************************************************************/ - -/* This will define the 'struct timeval' */ -#ifndef DEVICES_TIMER_H -#include -#endif /* DEVICES_TIMER_H */ - -/* Assume that the 'struct timeval' definition is now in place. */ -#define __TIMEVAL_ALREADY_DEFINED - -/****************************************************************************/ - -#endif /* INCLUDE_VERSION */ - -/****************************************************************************/ - -#endif /* !__TIMEVAL_ALREADY_DEFINED && !__USE_CLIB2_TIMEVAL */ - -/****************************************************************************/ - -/* If the timeval is still undefined or should be defined locally, - define our own now... */ -#if !defined(__TIMEVAL_ALREADY_DEFINED) - -/****************************************************************************/ - -/* We will have to make our own... */ -struct timeval -{ - unsigned long tv_secs; - unsigned long tv_micro; -}; - -/* Make sure that the 'struct timeval' is not redefined, should - get included again. */ -#define __TIMEVAL_ALREADY_DEFINED - -/****************************************************************************/ - -#endif /* !__TIMEVAL_ALREADY_DEFINED */ - -/****************************************************************************/ - -#ifndef tv_sec -#define tv_sec tv_secs -#endif /* tv_sec */ - -#ifndef tv_usec -#define tv_usec tv_micro -#endif /* tv_usec */ - -/****************************************************************************/ - -struct timezone -{ - int tz_minuteswest; /* of Greenwich */ - int tz_dsttime; /* type of dst correction to apply */ -}; - -/****************************************************************************/ - -int gettimeofday(struct timeval *tp, struct timezone *tzp); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _SYS_TIME_H */ diff --git a/library/include/sys/types.h b/library/include/sys/types.h deleted file mode 100644 index 4efac94..0000000 --- a/library/include/sys/types.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * $Id: types.h,v 1.4 2005-02-20 15:46:57 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SYS_TYPES_H -#define _SYS_TYPES_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -typedef char * caddr_t; -typedef unsigned int comp_t; -typedef unsigned long dev_t; -typedef unsigned int gid_t; -typedef unsigned int ino_t; -typedef unsigned int mode_t; -typedef unsigned int nlink_t; -typedef long int off_t; -typedef int pid_t; -typedef unsigned int rlim_t; -typedef int ssize_t; -typedef unsigned int uid_t; - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _SYS_TYPES_H */ diff --git a/library/include/sys/uio.h b/library/include/sys/uio.h deleted file mode 100644 index 1d71a18..0000000 --- a/library/include/sys/uio.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * $Id: uio.h,v 1.1 2005-04-03 10:22:48 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SYS_UIO_H -#define _SYS_UIO_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _SYS_TYPES_H -#include -#endif /* _SYS_TYPES_H */ - -#ifndef _STDDEF_H -#include -#endif /* _STDDEF_H */ - -/****************************************************************************/ - -/* - * The size of MAX_IOVEC is rather arbitrary since there is no kernel support - * for vectored I/O and even a single struct iovec can overflow a ssize_t. - */ -#define MAX_IOVEC 1024 - -typedef struct iovec -{ - void * iov_base; - size_t iov_len; -} iovec_t; - -/****************************************************************************/ - -extern ssize_t readv(int file_descriptor,const struct iovec *iov,int vec_count); -extern ssize_t writev(int file_descriptor,const struct iovec *iov,int vec_count); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _SYS_UIO_H */ diff --git a/library/include/sys/utsname.h b/library/include/sys/utsname.h deleted file mode 100644 index 8ab1fb9..0000000 --- a/library/include/sys/utsname.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * $Id: utsname.h,v 1.1 2005-03-02 12:57:56 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SYS_UTSNAME_H -#define _SYS_UTSNAME_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#define SYS_NMLN 32 - -/****************************************************************************/ - -struct utsname -{ - char sysname[SYS_NMLN]; /* OS Name ("AmigaOS") */ - char nodename[SYS_NMLN]; /* Usually Hostname, but there appears to be no standard. */ - char release[SYS_NMLN]; /* Release e.g. "51.1" (The Version of version.library) */ - char version[SYS_NMLN]; /* Version e.h. "4.0" (OS Version) */ - char machine[SYS_NMLN]; /* Machine e.g. "m68k" or "ppc" */ -}; - -/****************************************************************************/ - -extern int uname(struct utsname *); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _SYS_UTSNAME_H */ diff --git a/library/include/termios.h b/library/include/termios.h deleted file mode 100644 index 8e7a88c..0000000 --- a/library/include/termios.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * $Id: termios.h,v 1.1 2005-06-04 10:46:23 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - - -/* - * Almost-but-not-quite termios. - */ - -#ifndef _TERMIOS_H -#define _TERMIOS_H - -typedef unsigned int tcflag_t; -typedef unsigned char cc_t; -typedef unsigned int speed_t; - -#define NCCS 16 /* Number of Control Characters = Length of the c_cc array. */ - -enum { /* All the control characters in c_cc[] in a struct termios (below) */ - VINTR=0, /* ^C (break) */ - VQUIT, /* ^\ (quit) */ - VERASE, /* ^H (eraase) */ - VKILL, /* ^X (erase-line) */ - VEOF, /* ^D (end-of-file) */ - VMIN, /* Minimum number of characters to read. Interacts with VTIME. */ - VEOL, /* NUL */ - VTIME, /* Timeout in 1/10:ths of a second. Interacts with VMIN. */ - VSTART, /* ^Q (continue) */ - VSTOP, /* ^S (stop) */ - VSUSP, /* ^Z (suspend) */ - VWERASE, /* ^W (word-erase) */ -}; - -struct termios { - tcflag_t c_iflag; - tcflag_t c_oflag; - tcflag_t c_cflag; - tcflag_t c_lflag; - cc_t c_cc[NCCS]; - /* Private */ - speed_t c_ispeed; - speed_t c_ospeed; - int type; - unsigned int flags; -}; - -/* c_iflag */ - -#define IGNBRK (1<<0L) /* Ignore VINTR */ -#define BRKINT (1<<1L) /* Unimpl. */ -#define IGNPAR (1<<2L) /* Unimpl. */ -#define PARMRK (1<<3L) /* Unimpl. */ -#define INPCK (1<<4L) /* Unimpl. */ -#define ISTRIP (1<<5L) /* 7-bit data (strip high bit) */ -#define INLCR (1<<6L) /* Map NL->CR */ -#define IGNCR (1<<7L) /* Map CR->nothing */ -#define ICRNL (1<<8L) /* Map CR->NL */ -#define IXON (1<<9L) /* Unimpl. Enable XON/XOFF for output. */ -#define IXOFF (1<<10L) /* Unimpl. Enable XON/XOFF for input. */ - -/* c_oflag */ - -#define OPOST (1<<0L) /* Enable output processing. */ -#define ONLCR (1<<1L) /* Map NL->CR+NL */ -#define OCRNL (1<<2L) /* Map CR->NL */ -#define ONOCR (1<<3L) /* Map CR->nothing, but only in column 0. */ -#define ONLRET (1<<4L) /* Map CR->nothing */ - -/* c_cflag */ - -#define CSIZE (0x07) /* Bit-width mask. */ -#define CS5 (0x01) /* 5-bits */ -#define CS6 (0x02) /* 6-bits */ -#define CS7 (0x03) /* 7-bits */ -#define CS8 (0x04) /* 8-bits */ -#define CSTOPB (1<<3L) /* Use 2 stop bits. */ -#define CREAD (1<<4L) /* Enable reading/receiving. */ -#define PARENB (1<<5L) /* Enable parity generation/checking. */ -#define PARODD (1<<6L) /* Parity is odd. */ -#define HUPCL (1<<7L) /* Hangup on close (when the device is closed). */ -#define CLOCAL (1<<8L) /* Ignore modem control lines (i.e. a null-modem) */ - -/* c_lflag */ - -#define ISIG (1<<0L) /* Send SIGINT for ^C, SIGQUIT for ^\ etc. */ -#define ICANON (1<<1L) /* Canonical mode. Line buffered with EOF, EOL etc. enabled. */ -#define ECHO (1<<2L) /* Echo input characters. */ -#define ECHONL (1<<3L) /* Echo newline characters even if ECHO is not set. */ -#define IEXTEN (1<<4L) /* Enable implementation defined input processing. (none) */ - -/* Speeds */ - -enum { - B0=0, /* 0 baud => disconnect. */ - B50=50, - B75=75, - B110=110, - B134=134, - B150=150, - B200=200, - B300=300, - B600=600, - B1200=1200, - B1800=1800, - B2400=2400, - B4800=4800, - B9600=9600, - B19200=19200, - B31250=31250, - B38400=38400, - B57600=57600, - B115200=115200, - B230400=230400, - B460800=460800, - B576000=576000, - B1152000=1152000 -}; - -#define EXTA 1 /* Tell applications we have speeds > 9600 baud. */ - -/* Action types for tcsetattr() */ - -enum { - TCSANOW, - TCSADRAIN, - TCSAFLUSH -}; - -/* Action types for tcflush() */ - -enum { - TCIFLUSH, - TCOFLUSH, - TCIOFLUSH -}; - -/* Action types for tcflow() */ - -enum { - TCOOFF, - TCOON, - TCIOFF, - TCION -}; - -/* Prototypes. */ - -extern int tcgetattr(int file_descriptor,struct termios *tios_p); -extern int tcsetattr(int file_descriptor,int action,struct termios *tios_p); -extern int tcsendbreak(int file_descriptor,int duration); -extern int tcdrain(int file_descriptor); -extern int tcflush(int file_descriptor,int what); -extern int tcflow(int file_descriptor,int action); -extern int cfmakeraw(struct termios *tios_p); -extern speed_t cfgetispeed(struct termios *tios_p); -extern speed_t cfgetospeed(struct termios *tios_p); -extern int cfsetispeed(struct termios *tios_p,speed_t input_speed); -extern int cfsetospeed(struct termios *tios_p,speed_t output_speed); - -#endif /* _TERMIOS_H */ diff --git a/library/include/time.h b/library/include/time.h deleted file mode 100644 index 7d41061..0000000 --- a/library/include/time.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * $Id: time.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_H -#define _TIME_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _STDDEF_H -#include -#endif /* _STDDEF_H */ - -/****************************************************************************/ - -/* - * Divide the number returned by clock() by CLOCKS_PER_SEC to obtain - * the elapsed time in seconds - */ -#define CLOCKS_PER_SEC 50 - -/****************************************************************************/ - -typedef unsigned long clock_t; -typedef unsigned long time_t; - -/****************************************************************************/ - -struct tm -{ - int tm_sec; /* Number of seconds past the minute (0..59) */ - int tm_min; /* Number of minutes past the hour (0..59) */ - int tm_hour; /* Number of hours past the day (0..23) */ - int tm_mday; /* Day of the month (1..31) */ - int tm_mon; /* Month number (0..11) */ - int tm_year; /* Year number minus 1900 */ - int tm_wday; /* Day of the week (0..6; 0 is Sunday) */ - int tm_yday; /* Day of the year (0..365) */ - int tm_isdst; /* Is this date using daylight savings time? */ -}; - -/****************************************************************************/ - -extern clock_t clock(void); -extern time_t time(time_t * t); -extern char *asctime(const struct tm *tm); -extern char *ctime(const time_t *t); -extern struct tm *gmtime(const time_t *t); -extern struct tm *localtime(const time_t *t); -extern time_t mktime(struct tm *tm); - -/****************************************************************************/ - -extern double difftime(time_t t1,time_t t0); - -/****************************************************************************/ - -extern size_t strftime(char *s, size_t maxsize, const char *format, - const struct tm *tm); - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -extern char * asctime_r(const struct tm *tm,char * buffer); -extern char * ctime_r(const time_t *tptr,char * buffer); -extern struct tm * gmtime_r(const time_t *t,struct tm * tm_ptr); -extern struct tm * localtime_r(const time_t *t,struct tm * tm_ptr); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _TIME_H */ diff --git a/library/include/unistd.h b/library/include/unistd.h deleted file mode 100644 index 9ec4fbb..0000000 --- a/library/include/unistd.h +++ /dev/null @@ -1,298 +0,0 @@ -/* - * $Id: unistd.h,v 1.12 2005-06-18 07:23:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_H -#define _UNISTD_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _FCNTL_H -#include -#endif /* _FCNTL_H */ - -/****************************************************************************/ - -/* Endianness: we assume a big endian memory layout (for 68k and PowerPC). */ -#define LITTLE_ENDIAN 1234 -#define BIG_ENDIAN 4321 -#define BYTE_ORDER BIG_ENDIAN - -/****************************************************************************/ - -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 - -/****************************************************************************/ - -#define R_OK 0 -#define W_OK 1 -#define X_OK 2 -#define F_OK 4 - -/****************************************************************************/ - -extern int opterr; -extern int optind; -extern int optopt; -extern char * optarg; - -/****************************************************************************/ - -extern int isatty(int file_descriptor); -extern int dup(int file_descriptor); -extern int dup2(int file_descriptor1, int file_descriptor2); -extern int access(const char * path_name, int mode); -extern int chown(const char * path_name, uid_t owner, gid_t group); -extern int fchown(int file_descriptor, uid_t owner, gid_t group); -extern int lchown(const char * path_name, uid_t owner, gid_t group); -extern int truncate(const char * path_name, off_t length); -extern int ftruncate(int file_descriptor, off_t length); -extern int link(const char * existing_path,const char * new_path); -extern int unlink(const char * path_name); -extern int symlink(const char * actual_path, const char * symbolic_path); -extern int readlink(const char * path_name, char * buffer, int buffer_size); -extern int chdir(const char * path_name); -extern unsigned int sleep(unsigned int seconds); -extern void usleep(unsigned long microseconds); -extern int getopt(int argc, char * argv[], char *opts); -extern pid_t getpid(void); -extern char *realpath(const char *file_name, char *resolved_name); -extern int fsync(int file_descriptor); -extern int fdatasync(int file_descriptor); -extern char *ttyname(int); -extern int ttyname_r(int file_descriptor,char *name,size_t buflen); -extern int ttyname_t(int,char *,size_t); - -extern int profil(unsigned short *buffer, size_t bufSize, size_t offset, unsigned int scale); - -/****************************************************************************/ - -extern char * getcwd(char * buffer, size_t buffer_size); - -#ifdef __MEM_DEBUG -extern char * __getcwd(char * buffer,size_t buffer_size,const char *file,int line); - -#define getcwd(buffer,buffer_size) __getcwd((buffer),(buffer_size),__FILE__,__LINE__) -#endif /* __MEM_DEBUG */ - -/****************************************************************************/ - -/* - * The following may have been predefined by local TCP/IP header files. We - * don't want to be any trouble... - */ - -#if !defined(FD_SET) && !defined(__NO_NET_API) - -/****************************************************************************/ - -#ifndef _STRING_H -#include -#endif /* _STRING_H */ - -#ifndef _STDLIB_H -#include -#endif /* _STDLIB_H */ - -#ifndef _SYS_TIME_H -#include -#endif /* _SYS_TIME_H */ - -#ifndef _SYS_TYPES_H -#include -#endif /* _SYS_TYPES_H */ - -/****************************************************************************/ - -/* - * select() uses bit masks of file descriptors in longs. These macros - * manipulate such bit fields. - * - * FD_SETSIZE may be defined by the user, but the default here should - * be enough for most uses. - */ -#ifndef FD_SETSIZE -#define FD_SETSIZE 256 -#endif - -typedef struct fd_set -{ - unsigned long bits[(FD_SETSIZE + 31) / 32]; -} fd_set; - -#define FD_SET(n,p) ((void)((p)->bits[((unsigned long)n) >> 5] |= (1UL << (((unsigned long)n) & 31)))) -#define FD_CLR(n,p) ((void)((p)->bits[((unsigned long)n) >> 5] &= ~(1UL << (((unsigned long)n) & 31)))) -#define FD_ISSET(n,p) (((p)->bits[((unsigned long)n) >> 5] & (1UL << (((unsigned long)n) & 31))) != 0) -#define FD_COPY(f,t) ((void)memmove(t,f,sizeof(*(f)))) -#define FD_ZERO(p) ((void)memset(p,0,sizeof(*(p)))) - -/****************************************************************************/ - -/* Forward declarations for below... */ -struct hostent; -struct netent; -struct protoent; -struct servent; -struct passwd; -struct msghdr; -struct sockaddr; - -/****************************************************************************/ - -/* - * You might want to have included in place of - * this local definition. - */ -#if defined(__USE_NETINET_IN_H) - -#include - -#else - -/* - * These two symbols are typically defined by , which also - * happens to define 'struct in_addr'. We don't want to redefine it. - */ -#if !defined(_NETINET_IN_H) && !defined(IPPROTO_IP) - -/* Internet address (a structure for historical reasons) */ -struct in_addr -{ - unsigned long s_addr; -}; - -#endif /* !_NETINET_IN_H && !IPPROTO_IP */ - -#endif /* __USE_NETINET_IN_H */ - -/****************************************************************************/ - -/* Error codes set by the name<->address resolution functions. */ -extern int h_errno; - -/****************************************************************************/ - -typedef unsigned long socklen_t; - -/****************************************************************************/ - -extern int accept(int sockfd,struct sockaddr *cliaddr,socklen_t *addrlen); -extern int bind(int sockfd,struct sockaddr *name,int namelen); -extern int connect(int sockfd,struct sockaddr *name,socklen_t namelen); -extern struct hostent * gethostbyaddr(const char *addr, socklen_t len, int type); -extern struct hostent * gethostbyname(const char *name); -extern int gethostname(const char *name, int namelen); -extern struct netent * getnetbyname(const char *name); -extern int getpeername(int sockfd,struct sockaddr *name,socklen_t *namelen); -extern int getsockname(int sockfd,struct sockaddr *name,socklen_t *namelen); -extern int getsockopt(int sockfd,int level,int optname,void *optval,socklen_t *optlen); -extern unsigned long inet_addr(const char *addr); -extern char * inet_ntoa(struct in_addr in); -extern int ioctl(int fd,unsigned long request, ... /* char *arg */); -extern int listen(int sockfd,int backlog); -extern int recv(int fd,void *buff,size_t nbytes,int flags); -extern int recvfrom(int sockfd,void *buff,int len,int flags,struct sockaddr *from,socklen_t *fromlen); -extern int recvmsg(int socket,struct msghdr *msg,int flags); -extern int select(int num_fds,fd_set *read_fds,fd_set *write_fds,fd_set *except_fds,struct timeval *timeout); -extern int send(int fd,const void *buff,size_t nbytes,int flags); -extern int sendmsg(int socket,struct msghdr *msg,int flags); -extern int sendto(int sockfd,const void *buff,int len,int flags,struct sockaddr *to,socklen_t tolen); -extern int setsockopt(int sockfd,int level,int optname,const void *optval,socklen_t optlen); -extern int shutdown(int socket, int how); -extern int socket(int domain,int type,int protocol); -extern long gethostid(void); -extern struct netent * getnetbyaddr(long net,int type); -extern struct servent * getservbyname(const char *name, const char *proto); -extern struct servent * getservbyport(int port, const char *proto); -extern struct protoent * getprotobyname(const char *name); -extern struct protoent * getprotobynumber(int proto); -extern int inet_aton(const char *cp, struct in_addr *addr); -extern unsigned long inet_lnaof(struct in_addr in); -extern struct in_addr inet_makeaddr(int net,int host); -extern unsigned long inet_netof(struct in_addr in); -extern unsigned long inet_network(const char *cp); -extern const char * hstrerror(int error_number); - -/****************************************************************************/ - -extern char *crypt(const char *key, const char *salt); -extern gid_t getegid(void); -extern uid_t geteuid(void); -extern gid_t getgid(void); -extern struct group *getgrgid(gid_t gid); -extern struct group *getgrnam(const char *name); -extern int getgroups(int ngroups, gid_t *groups); -extern char *getpass(const char *prompt); -extern struct passwd *getpwnam(const char *name); -extern struct passwd *getpwuid(uid_t uid); -extern uid_t getuid(void); -extern int initgroups(const char *name, gid_t basegroup); -extern int setegid(gid_t g); -extern int seteuid(uid_t u); -extern int setgid(gid_t id); -extern int setgroups(int ngroups, const gid_t *groups); -extern int setregid(gid_t real, gid_t eff); -extern int setreuid(uid_t real, uid_t eff); -extern long setsid(void); -extern int setuid(uid_t id); -extern void endgrent(void); -extern void endpwent(void); -extern struct group *getgrent(void); -extern struct passwd *getpwent(void); -extern void setgrent(void); -extern void setpwent(void); - -/****************************************************************************/ - -#endif /* !FD_SET && !__NO_NET_API */ - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _UNISTD_H */ diff --git a/library/include/utime.h b/library/include/utime.h deleted file mode 100644 index 974f530..0000000 --- a/library/include/utime.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * $Id: utime.h,v 1.3 2005-01-02 09:07:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UTIME_H -#define _UTIME_H - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _TIME_H -#include -#endif /* _TIME_H */ - -/****************************************************************************/ - -struct utimbuf -{ - time_t actime; /* Access time */ - time_t modtime; /* Modification time */ -}; - -/****************************************************************************/ - -extern int utime(const char * path_name,const struct utimbuf * times); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _UTIME_H */ diff --git a/library/include/wchar.h b/library/include/wchar.h deleted file mode 100644 index e83516d..0000000 --- a/library/include/wchar.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * $Id: wchar.h,v 1.3 2005-05-12 13:21:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_H -#define _WCHAR_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _STDDEF_H -#include -#endif /* _STDDEF_H */ - -#ifndef _STDIO_H -#include -#endif /* _STDIO_H */ - -#ifndef _STDARG_H -#include -#endif /* _STDARG_H */ - -#ifndef _TIME_H -#include -#endif /* _TIME_H */ - -/****************************************************************************/ - -#define WEOF (-1) -#define WCHAR_MAX 65535 -#define WCHAR_MIN 0 - -/****************************************************************************/ - -typedef long int wint_t; -typedef long mbstate_t; - -/****************************************************************************/ - -extern wint_t btowc(int c); -extern int wctob(wint_t c); -extern int mbsinit(const mbstate_t *ps); -extern size_t mbrlen(wchar_t *pwc, const char * s, size_t n, mbstate_t *ps); -extern size_t wcrtomb(char *s, wchar_t wc, mbstate_t *ps); -extern size_t mbsrtowcs(wchar_t *pwcs, const char **src, size_t n, mbstate_t *ps); -extern size_t wcsrtombs(char *s, const wchar_t **src, size_t n, mbstate_t *ps); - -/****************************************************************************/ - -extern wchar_t *wcscat(wchar_t *dest, const wchar_t *src); -extern wchar_t *wcsncat(wchar_t *dest, const wchar_t *src, size_t n); -extern int wcscmp(const wchar_t *s1, const wchar_t * s2); -extern int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n); -extern wchar_t * wcscpy(wchar_t *dest, const wchar_t *src); -extern wchar_t * wcsncpy(wchar_t *dest, const wchar_t *src, size_t n); -extern size_t wcslen(const wchar_t *s); -extern wchar_t * wcschr(const wchar_t *s, wchar_t c); -extern size_t wcsspn(const wchar_t *s, const wchar_t *set); -extern wchar_t wcspbrk(const wchar_t *s, const wchar_t *set); -extern wchar_t *wcstok(wchar_t *str, const wchar_t *set); -extern wchar_t *wcsstr(const wchar_t *src, const wchar_t *sub); - -/****************************************************************************/ - -extern double wcstod(const wchar_t *str, wchar_t **ptr); -extern long wcstol(const wchar_t *str, wchar_t **ptr, int base); -extern unsigned long wcstoul(const wchar_t *str, wchar_t **ptr, int base); - -/****************************************************************************/ - -extern int wscoll(const wchar_t *s1, const wchar_t *s2); -extern size_t wcsxfrm(wchar_t *dest, const wchar_t *src, size_t len); - -/****************************************************************************/ - -extern wchar_t *wmemchr(const wchar_t *ptr, wchar_t val, size_t len); -extern int wmemcmp(const wchar_t *ptr1, const wchar_t *ptr2, size_t len); -extern wchar_t *wmemcpy(wchar_t *dest, const wchar_t *src, size_t len); -extern wchar_t *wmemmove(wchar_t *dest, const wchar_t * src, size_t len); -extern wchar_t *wmemset(wchar_t *ptr, int val, size_t len); - -/****************************************************************************/ - -extern int fwide(FILE *stream, int orient); - -/****************************************************************************/ - -extern wint_t fgetwc(FILE *stream); -extern wint_t getwc(FILE *stream); -extern wint_t getwchar(void); -extern wint_t ungetwc(wint_t c,FILE *stream); - -/****************************************************************************/ - -extern wchar_t *fgetws(wchar_t *s, int n, FILE *stream); - -/****************************************************************************/ - -extern int fwscanf(FILE *stream, const wchar_t *format, ...); -extern int wscanf(const wchar_t *format, ...); -extern int swscanf(wchar_t *s,const wchar_t *format, ...); - -/****************************************************************************/ - -extern wint_t fputwc(wchar_t c,FILE *stream); -extern wint_t putwc(wchar_t c,FILE *stream); -extern wint_t putwchar(wchar_t c); - -/****************************************************************************/ - -extern wint_t fputws(const wchar_t *s, FILE *stream); - -/****************************************************************************/ - -extern int fwprintf(FILE *stream,const wchar_t *format,...); -extern int wprintf(const wchar_t *format, ...); -extern int swprintf(wchar_t *s, const wchar_t *format, ...); - -/****************************************************************************/ - -extern int vfwprintf(FILE *stream,const wchar_t *format,va_list arg); -extern int vwprintf(const wchar_t *format,va_list arg); -extern int vswprintf(char *s, const wchar_t *format,va_list arg); - -/****************************************************************************/ - -extern size_t wcsftime(wchar_t *s, size_t maxsize, const wchar_t *format, const struct tm *timeptr); - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) - -extern long long wcstoll(const wchar_t *str, wchar_t **ptr, int base); -extern unsigned long long wcstoull(const wchar_t *str, wchar_t **ptr, int base); - -#endif /* __STDC_VERSION__ && __STDC_VERSION__ >= 199901L */ - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _WCHAR_H */ diff --git a/library/include/wctype.h b/library/include/wctype.h deleted file mode 100644 index 789a63a..0000000 --- a/library/include/wctype.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * $Id: wctype.h,v 1.3 2005-05-12 13:21:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCYTPE_H -#define _WCYTPE_H - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/****************************************************************************/ - -#ifndef _WCHAR_H -#include -#endif /* _WCHAR_H */ - -/****************************************************************************/ - -typedef long wctype_t; /* ZZZ */ -typedef long wctrans_t; /* ZZZ */ - -/****************************************************************************/ - -extern int iswalnum(wint_t c); -extern int iswalpha(wint_t c); -extern int iswcntrl(wint_t c); - -extern int iswdigit(wint_t c); -extern int iswxdigit(wint_t c); - -extern int iswgraph(wint_t c); -extern int iswpunc(wint_t c); -extern int iswprint(wint_t c); - -extern int iswlower(wint_t c); -extern int iswupper(wint_t c); - -extern int iswspace(wint_t c); -extern int iswblank(wint_t c); - -extern wint_t towlower(wint_t c); -extern wint_t towupper(wint_t c); - -/****************************************************************************/ - -extern wctype_t wctype(const char *property); -extern int iswctype(wint_t c, wctype_t desc); - -/****************************************************************************/ - -extern wctrans_t wctrans(const char *property); -extern wint_t towctrans(wint_t c, wctrans_t desc); - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/****************************************************************************/ - -#endif /* _WCYTPE_H */ diff --git a/library/inttypes_headers.h b/library/inttypes_headers.h deleted file mode 100644 index 9fd1511..0000000 --- a/library/inttypes_headers.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * $Id: inttypes_headers.h,v 1.1 2005-05-12 13:21:43 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _INTTYPES_HEADERS_H -#define _INTTYPES_HEADERS_H - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -#endif /* _INTTYPES_HEADERS_H */ diff --git a/library/inttypes_imaxabs.c b/library/inttypes_imaxabs.c deleted file mode 100644 index aa7ec76..0000000 --- a/library/inttypes_imaxabs.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id: inttypes_imaxabs.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _INTTYPES_HEADERS_H -#include "inttypes_headers.h" -#endif /* _INTTYPES_HEADERS_H */ - -/****************************************************************************/ - -intmax_t -imaxabs(intmax_t x) -{ - intmax_t result; - - if(x < 0) - result = (-x); - else - result = x; - - return(result); -} diff --git a/library/inttypes_imaxdiv.c b/library/inttypes_imaxdiv.c deleted file mode 100644 index 0cbe798..0000000 --- a/library/inttypes_imaxdiv.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id: inttypes_imaxdiv.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _INTTYPES_HEADERS_H -#include "inttypes_headers.h" -#endif /* _INTTYPES_HEADERS_H */ - -/****************************************************************************/ - -imaxdiv_t -imaxdiv(intmax_t n,intmax_t d) -{ - imaxdiv_t result; - - assert( d != 0 ); - - result.quot = n / d; - result.rem = n % d; - - return(result); -} diff --git a/library/inttypes_strtoimax.c b/library/inttypes_strtoimax.c deleted file mode 100644 index 90a43e7..0000000 --- a/library/inttypes_strtoimax.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * $Id: inttypes_strtoimax.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _INTTYPES_HEADERS_H -#include "inttypes_headers.h" -#endif /* _INTTYPES_HEADERS_H */ - -/****************************************************************************/ - -intmax_t -strtoimax(const char *str, char **ptr, int base) -{ - BOOL is_negative; - intmax_t result = 0; - intmax_t new_sum; - intmax_t sum; - char c; - - ENTER(); - - SHOWSTRING(str); - SHOWPOINTER(ptr); - SHOWVALUE(base); - - assert(str != NULL && base >= 0); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(str == NULL) - { - SHOWMSG("invalid str parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(base < 0) - { - SHOWMSG("invalid base parameter"); - - __set_errno(ERANGE); - goto out; - } - - /* Skip all leading blanks. */ - while((c = (*str)) != '\0') - { - if(NOT isspace(c)) - break; - - str++; - } - - /* The first character may be a sign. */ - if(c == '-') - { - /* It's a negative number. */ - is_negative = TRUE; - - str++; - } - else - { - /* It's not going to be negative. */ - is_negative = FALSE; - - /* But there may be a sign we will choose to - ignore. */ - if(c == '+') - str++; - } - - c = (*str); - - /* There may be a leading '0x' to indicate that what - follows is a hexadecimal number. */ - if(base == 0 || base == 16) - { - if((c == '0') && (str[1] == 'x' || str[1] == 'X')) - { - base = 16; - - str += 2; - - c = (*str); - } - } - - /* If we still don't know what base to use and the - next letter to follow is a zero then this is - probably a number in octal notation. */ - if(base == 0) - { - if(c == '0') - base = 8; - else - base = 10; - } - - sum = 0; - - if(1 <= base && base <= 36) - { - while(c != '\0') - { - if('0' <= c && c <= '9') - c -= '0'; - else if ('a' <= c) - c -= 'a' - 10; - else if ('A' <= c) - c -= 'A' - 10; - else - break; - - /* Ignore invalid numbers. */ - if(c >= base) - break; - - new_sum = base * sum + c; - if(new_sum < sum) /* overflow? */ - { - __set_errno(ERANGE); - - if(is_negative) - result = INTMAX_MIN; - else - result = INTMAX_MAX; - - goto out; - } - - sum = new_sum; - - str++; - - c = (*str); - } - } - - if(is_negative) - result = (-sum); - else - result = sum; - - out: - - /* If desired, remember where we stopped reading the - number from the buffer. */ - if(ptr != NULL) - (*ptr) = (char *)str; - - RETURN(result); - return(result); -} diff --git a/library/inttypes_strtoumax.c b/library/inttypes_strtoumax.c deleted file mode 100644 index 77e9dd0..0000000 --- a/library/inttypes_strtoumax.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * $Id: inttypes_strtoumax.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _INTTYPES_HEADERS_H -#include "inttypes_headers.h" -#endif /* _INTTYPES_HEADERS_H */ - -/****************************************************************************/ - -uintmax_t -strtoumax(const char *str, char **ptr, int base) -{ - BOOL is_negative; - uintmax_t result = 0; - uintmax_t new_sum; - uintmax_t sum; - char c; - - ENTER(); - - SHOWSTRING(str); - SHOWPOINTER(ptr); - SHOWVALUE(base); - - assert(str != NULL && base >= 0); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(str == NULL) - { - SHOWMSG("invalid str parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(base < 0) - { - SHOWMSG("invalid base parameter"); - - __set_errno(ERANGE); - goto out; - } - - /* Skip all leading blanks. */ - while((c = (*str)) != '\0') - { - if(NOT isspace(c)) - break; - - str++; - } - - /* The first character may be a sign. */ - if(c == '-') - { - /* It's a negative number. */ - is_negative = TRUE; - - str++; - } - else - { - /* It's not going to be negative. */ - is_negative = FALSE; - - /* But there may be a sign we will choose to - ignore. */ - if(c == '+') - str++; - } - - c = (*str); - - /* There may be a leading '0x' to indicate that what - follows is a hexadecimal number. */ - if(base == 0 || base == 16) - { - if((c == '0') && (str[1] == 'x' || str[1] == 'X')) - { - base = 16; - - str += 2; - - c = (*str); - } - } - - /* If we still don't know what base to use and the - next letter to follow is a zero then this is - probably a number in octal notation. */ - if(base == 0) - { - if(c == '0') - base = 8; - else - base = 10; - } - - sum = 0; - - if(1 <= base && base <= 36) - { - while(c != '\0') - { - if('0' <= c && c <= '9') - c -= '0'; - else if ('a' <= c) - c -= 'a' - 10; - else if ('A' <= c) - c -= 'A' - 10; - else - break; - - /* Ignore invalid numbers. */ - if(c >= base) - break; - - new_sum = base * sum + c; - if(new_sum < sum) /* overflow? */ - { - __set_errno(ERANGE); - - result = UINTMAX_MAX; - - goto out; - } - - sum = new_sum; - - str++; - - c = (*str); - } - } - - if(is_negative) - result = (-sum); - else - result = sum; - - out: - - /* If desired, remember where we stopped reading the - number from the buffer. */ - if(ptr != NULL) - (*ptr) = (char *)str; - - RETURN(result); - return(result); -} diff --git a/library/inttypes_wcstoimax.c b/library/inttypes_wcstoimax.c deleted file mode 100644 index e995cb2..0000000 --- a/library/inttypes_wcstoimax.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id: inttypes_wcstoimax.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _INTTYPES_HEADERS_H -#include "inttypes_headers.h" -#endif /* _INTTYPES_HEADERS_H */ - -/****************************************************************************/ - -intmax_t -wcstoimax(const wchar_t *str, char **ptr, int base) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/inttypes_wcstoumax.c b/library/inttypes_wcstoumax.c deleted file mode 100644 index 326cc06..0000000 --- a/library/inttypes_wcstoumax.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id: inttypes_wcstoumax.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _INTTYPES_HEADERS_H -#include "inttypes_headers.h" -#endif /* _INTTYPES_HEADERS_H */ - -/****************************************************************************/ - -uintmax_t -wcstoumax(const wchar_t *str, char **ptr, int base) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/libgen_basename.c b/library/libgen_basename.c deleted file mode 100644 index 6c2ca04..0000000 --- a/library/libgen_basename.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * $Id: libgen_basename.c,v 1.3 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#include "debug.h" - -/****************************************************************************/ - -char * -basename(char *path) -{ - char * result; - - ENTER(); - - if(path == NULL) - SHOWPOINTER(path); - else - SHOWSTRING(path); - - if(path == NULL || path[0] == '\0') - { - result = "."; - } - else - { - int len,i; - - len = strlen(path); - - while(len > 0 && path[len-1] == '/') - len--; - - if(len > 0) - { - result = path; - - path[len] = '\0'; - - for(i = len-1 ; i >= 0 ; i--) - { - if(path[i] == '/') - { - result = &path[i+1]; - break; - } - } - } - else - { - result = "/"; - } - } - - SHOWSTRING(result); - - RETURN(result); - return(result); -} diff --git a/library/libgen_dirname.c b/library/libgen_dirname.c deleted file mode 100644 index 1cdd3b5..0000000 --- a/library/libgen_dirname.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * $Id: libgen_dirname.c,v 1.3 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include - -/****************************************************************************/ - -#include "debug.h" - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -char * -dirname(char *path) -{ - char * result; - - ENTER(); - - if(path == NULL) - SHOWPOINTER(path); - else - SHOWSTRING(path); - - if(path == NULL || path[0] == '\0') - { - result = "."; - } - else - { - int len,i; - - len = strlen(path); - - while(len > 0 && path[len-1] == '/') - len--; - - if(len > 0) - { - result = "."; - - for(i = len-1 ; i >= 0 ; i--) - { - if(path[i] == '/') - { - path[i] = '\0'; - - result = path; - - break; - } - } - } - else - { - result = "/"; - } - } - - SHOWSTRING(result); - - RETURN(result); - return(result); -} diff --git a/library/locale_headers.h b/library/locale_headers.h deleted file mode 100644 index 424c80b..0000000 --- a/library/locale_headers.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * $Id: locale_headers.h,v 1.7 2005-03-18 12:38:22 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _LOCALE_HEADERS_H -#define _LOCALE_HEADERS_H - -/****************************************************************************/ - -#ifndef EXEC_LIBRARIES_H -#include -#endif /* EXEC_LIBRARIES_H */ - -#ifndef LIBRARIES_LOCALE_H -#include -#endif /* LIBRARIES_LOCALE_H */ - -/****************************************************************************/ - -#ifndef PROTO_EXEC_H -#include -#endif /* PROTO_EXEC_H */ - -/****************************************************************************/ - -#include -#include -#include -#include - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_H */ - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_H */ - -#ifndef _DEBUG_H -#include "debug.h" -#endif /* _DEBUG_H */ - -/****************************************************************************/ - -#define NUM_LOCALES (LC_TIME - LC_ALL + 1) -#define MAX_LOCALE_NAME_LEN 256 - -/****************************************************************************/ - -extern struct Locale * NOCOMMON __default_locale; -extern struct Locale * NOCOMMON __locale_table[NUM_LOCALES]; - -/****************************************************************************/ - -extern char NOCOMMON __locale_name_table[NUM_LOCALES][MAX_LOCALE_NAME_LEN]; - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -/****************************************************************************/ - -extern void __locale_lock(void); -extern void __locale_unlock(void); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#define __locale_lock() ((void)0) -#define __locale_unlock() ((void)0) - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ - -/****************************************************************************/ - -extern void __close_all_locales(void); - -/****************************************************************************/ - -#endif /* _LOCALE_HEADERS_H */ diff --git a/library/locale_init_exit.c b/library/locale_init_exit.c deleted file mode 100644 index c7b830e..0000000 --- a/library/locale_init_exit.c +++ /dev/null @@ -1,269 +0,0 @@ -/* - * $Id: locale_init_exit.c,v 1.14 2005-07-03 10:36:46 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -struct Library * NOCOMMON __LocaleBase; - -/****************************************************************************/ - -#if defined(__amigaos4__) -struct LocaleIFace * NOCOMMON __ILocale; -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -struct Locale * NOCOMMON __default_locale; -struct Locale * NOCOMMON __locale_table[NUM_LOCALES]; - -/****************************************************************************/ - -char NOCOMMON __locale_name_table[NUM_LOCALES][MAX_LOCALE_NAME_LEN]; - -/****************************************************************************/ - -void -__close_all_locales(void) -{ - __locale_lock(); - - if(__LocaleBase != NULL) - { - DECLARE_LOCALEBASE(); - - int i; - - for(i = 0 ; i < NUM_LOCALES ; i++) - { - if(i == LC_ALL) - continue; - - if(__locale_table[i] != NULL) - { - if(__locale_table[i] != __locale_table[LC_ALL]) - CloseLocale(__locale_table[i]); - - __locale_table[i] = NULL; - } - } - - CloseLocale(__locale_table[LC_ALL]); - __locale_table[LC_ALL] = NULL; - } - - __locale_unlock(); -} - -/****************************************************************************/ - -void -__locale_exit(void) -{ - ENTER(); - - __locale_lock(); - - if(__LocaleBase != NULL) - { - DECLARE_LOCALEBASE(); - - __close_all_locales(); - - if(__default_locale != NULL) - { - CloseLocale(__default_locale); - __default_locale = NULL; - } - - #if defined(__amigaos4__) - { - if(__ILocale != NULL) - { - DropInterface((struct Interface *)__ILocale); - __ILocale = NULL; - } - } - #endif /* __amigaos4__ */ - - CloseLibrary(__LocaleBase); - __LocaleBase = NULL; - } - - __locale_unlock(); - - LEAVE(); -} - -/****************************************************************************/ - -int -__locale_init(void) -{ - int result = ERROR; - - ENTER(); - - PROFILE_OFF(); - - __locale_lock(); - - if(__LocaleBase == NULL) - { - __LocaleBase = OpenLibrary("locale.library",38); - - #if defined(__amigaos4__) - { - if (__LocaleBase != NULL) - { - __ILocale = (struct LocaleIFace *)GetInterface(__LocaleBase, "main", 1, 0); - if(__ILocale == NULL) - { - CloseLibrary(__LocaleBase); - __LocaleBase = NULL; - } - } - } - #endif /* __amigaos4__ */ - } - - if(__LocaleBase != NULL && __default_locale == NULL) - { - DECLARE_LOCALEBASE(); - - __default_locale = OpenLocale(NULL); - } - - if(__default_locale != NULL) - result = OK; - - __locale_unlock(); - - PROFILE_ON(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -/****************************************************************************/ - -static struct SignalSemaphore * locale_lock; - -/****************************************************************************/ - -void -__locale_lock(void) -{ - if(locale_lock != NULL) - ObtainSemaphore(locale_lock); -} - -/****************************************************************************/ - -void -__locale_unlock(void) -{ - if(locale_lock != NULL) - ReleaseSemaphore(locale_lock); -} - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ - -/****************************************************************************/ - -CLIB_DESTRUCTOR(locale_exit) -{ - ENTER(); - - __locale_exit(); - - #if defined(__THREAD_SAFE) - { - __delete_semaphore(locale_lock); - locale_lock = NULL; - } - #endif /* __THREAD_SAFE */ - - LEAVE(); -} - -/****************************************************************************/ - -CLIB_CONSTRUCTOR(locale_init) -{ - BOOL success = FALSE; - int i; - - ENTER(); - - #if defined(__THREAD_SAFE) - { - locale_lock = __create_semaphore(); - if(locale_lock == NULL) - goto out; - } - #endif /* __THREAD_SAFE */ - - for(i = 0 ; i < NUM_LOCALES ; i++) - strcpy(__locale_name_table[i],"C"); - - if(__open_locale) - __locale_init(); - - success = TRUE; - - out: - - SHOWVALUE(success); - LEAVE(); - - if(success) - CONSTRUCTOR_SUCCEED(); - else - CONSTRUCTOR_FAIL(); -} diff --git a/library/locale_localeconv.c b/library/locale_localeconv.c deleted file mode 100644 index a11ef52..0000000 --- a/library/locale_localeconv.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * $Id: locale_localeconv.c,v 1.4 2005-02-27 21:58:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -struct lconv * -localeconv(void) -{ - static struct lconv loc; - - struct Locale * numeric_locale; - struct Locale * monetary_locale; - struct lconv * result; - - ENTER(); - - __locale_lock(); - - numeric_locale = __locale_table[LC_NUMERIC]; - monetary_locale = __locale_table[LC_MONETARY]; - - /* This makes up the current locale settings from the various - * components in use. - */ - loc.decimal_point = (numeric_locale != NULL) ? ((char *)numeric_locale->loc_DecimalPoint) : "."; - loc.thousands_sep = (numeric_locale != NULL) ? ((char *)numeric_locale->loc_GroupSeparator) : ""; - loc.grouping = (numeric_locale != NULL) ? ((char *)numeric_locale->loc_Grouping) : ""; - loc.int_curr_symbol = (monetary_locale != NULL) ? ((char *)monetary_locale->loc_MonIntCS) : ""; - loc.currency_symbol = (monetary_locale != NULL) ? ((char *)monetary_locale->loc_MonCS) : ""; - loc.mon_decimal_point = (monetary_locale != NULL) ? ((char *)monetary_locale->loc_MonDecimalPoint) : ""; - loc.mon_thousands_sep = (monetary_locale != NULL) ? ((char *)monetary_locale->loc_MonGroupSeparator) : ""; - loc.mon_grouping = (monetary_locale != NULL) ? ((char *)monetary_locale->loc_MonGrouping) : ""; - loc.positive_sign = (monetary_locale != NULL) ? ((char *)monetary_locale->loc_MonPositiveSign) : ""; - loc.negative_sign = (monetary_locale != NULL) ? ((char *)monetary_locale->loc_MonNegativeSign) : ""; - loc.int_frac_digits = (monetary_locale != NULL) ? monetary_locale->loc_MonIntFracDigits : CHAR_MAX; - loc.frac_digits = (monetary_locale != NULL) ? monetary_locale->loc_MonFracDigits : CHAR_MAX; - loc.p_cs_precedes = (monetary_locale != NULL) ? monetary_locale->loc_MonPositiveCSPos : CHAR_MAX; - loc.p_sep_by_space = (monetary_locale != NULL) ? monetary_locale->loc_MonPositiveSpaceSep : CHAR_MAX; - loc.n_cs_precedes = (monetary_locale != NULL) ? monetary_locale->loc_MonNegativeCSPos : CHAR_MAX; - loc.n_sep_by_space = (monetary_locale != NULL) ? monetary_locale->loc_MonNegativeSpaceSep : CHAR_MAX; - loc.p_sign_posn = (monetary_locale != NULL) ? monetary_locale->loc_MonPositiveSignPos : CHAR_MAX; - loc.n_sign_posn = (monetary_locale != NULL) ? monetary_locale->loc_MonNegativeSignPos : CHAR_MAX; - - result = &loc; - - __locale_unlock(); - - RETURN(result); - return(result); -} diff --git a/library/locale_open_locale.c b/library/locale_open_locale.c deleted file mode 100644 index 03ec818..0000000 --- a/library/locale_open_locale.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: locale_open_locale.c,v 1.1 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -BOOL __open_locale = TRUE; diff --git a/library/locale_setlocale.c b/library/locale_setlocale.c deleted file mode 100644 index 70afc97..0000000 --- a/library/locale_setlocale.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * $Id: locale_setlocale.c,v 1.4 2005-02-27 21:58:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -char * -setlocale(int category, const char *locale) -{ - DECLARE_LOCALEBASE(); - char * result = NULL; - - ENTER(); - - SHOWVALUE(category); - - if(locale == NULL) - SHOWPOINTER(locale); - else - SHOWSTRING(locale); - - __locale_lock(); - - if(category < LC_ALL || category > LC_TIME) - { - SHOWMSG("invalid category"); - - __set_errno(EINVAL); - goto out; - } - - if(locale != NULL) - { - struct Locale * loc = NULL; - - /* We have to keep the locale name for later reference. - * On the Amiga this will be a path and file name so it - * can become rather long. But we can't store an arbitrarily - * long name either. - * - * ZZZ change this to dynamic allocation of the locale name. - */ - if(strlen(locale) >= MAX_LOCALE_NAME_LEN) - { - SHOWMSG("locale name is too long"); - - __set_errno(ENAMETOOLONG); - goto out; - } - - /* Unless we are switching to the "C" locale, - * try to open a locale if we managed to open - * locale.library before. - */ - if(LocaleBase != NULL) - { - if(strcmp(locale,"C") != SAME) - { - SHOWMSG("this is not the 'C' locale"); - - PROFILE_OFF(); - - /* The empty string stands for the default locale. */ - if(locale[0] == '\0') - loc = OpenLocale(NULL); - else - loc = OpenLocale((STRPTR)locale); - - PROFILE_ON(); - - if(loc == NULL) - { - SHOWMSG("couldn't open the locale"); - - __set_errno(ENOENT); - goto out; - } - } - } - - if(category == LC_ALL) - { - int i; - - SHOWMSG("closing all locales"); - - /* We have to replace all locales. We - * start by closing them all. - */ - __close_all_locales(); - - SHOWMSG("reinitializing all locales"); - - /* And this puts the new locale into all table entries. */ - for(i = 0 ; i < NUM_LOCALES ; i++) - { - __locale_table[i] = loc; - strcpy(__locale_name_table[i],locale); - } - } - else - { - SHOWMSG("closing the locale"); - - /* Close this single locale unless it's actually just a - * copy of the 'all' locale entry. - */ - if(__locale_table[category] != NULL && __locale_table[category] != __locale_table[LC_ALL]) - { - assert( LocaleBase != NULL ); - CloseLocale(__locale_table[category]); - } - - SHOWMSG("reinitializing the locale"); - - __locale_table[category] = loc; - strcpy(__locale_name_table[category],locale); - } - } - - result = __locale_name_table[category]; - - SHOWSTRING(result); - - out: - - __locale_unlock(); - - RETURN(result); - return(result); -} diff --git a/library/m.lib_rev.c b/library/m.lib_rev.c deleted file mode 100644 index ad6d90d..0000000 --- a/library/m.lib_rev.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * $Id: m.lib_rev.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 "m.lib_rev.h" - -/****************************************************************************/ - -char __m_lib_version[] = VERSTAG; diff --git a/library/m.lib_rev.h b/library/m.lib_rev.h deleted file mode 100644 index eb43f8e..0000000 --- a/library/m.lib_rev.h +++ /dev/null @@ -1,6 +0,0 @@ -#define VERSION 1 -#define REVISION 193 -#define DATE "4.6.2005" -#define VERS "m.lib 1.193" -#define VSTRING "m.lib 1.193 (4.6.2005)\r\n" -#define VERSTAG "\0$VER: m.lib 1.193 (4.6.2005)" diff --git a/library/m.lib_rev.rev b/library/m.lib_rev.rev deleted file mode 100644 index 2455a46..0000000 --- a/library/m.lib_rev.rev +++ /dev/null @@ -1 +0,0 @@ -193 diff --git a/library/m881.lib_rev.c b/library/m881.lib_rev.c deleted file mode 100644 index ed03590..0000000 --- a/library/m881.lib_rev.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * $Id: m881.lib_rev.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 "m881.lib_rev.h" - -/****************************************************************************/ - -char __m881_lib_version[] = VERSTAG; diff --git a/library/m881.lib_rev.h b/library/m881.lib_rev.h deleted file mode 100644 index d9edcb6..0000000 --- a/library/m881.lib_rev.h +++ /dev/null @@ -1,6 +0,0 @@ -#define VERSION 1 -#define REVISION 193 -#define DATE "4.6.2005" -#define VERS "m881.lib 1.193" -#define VSTRING "m881.lib 1.193 (4.6.2005)\r\n" -#define VERSTAG "\0$VER: m881.lib 1.193 (4.6.2005)" diff --git a/library/m881.lib_rev.rev b/library/m881.lib_rev.rev deleted file mode 100644 index 2455a46..0000000 --- a/library/m881.lib_rev.rev +++ /dev/null @@ -1 +0,0 @@ -193 diff --git a/library/macros.h b/library/macros.h deleted file mode 100644 index 5d7207c..0000000 --- a/library/macros.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * $Id: macros.h,v 1.20 2005-05-27 13:19:30 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MACROS_H -#define _MACROS_H - -/****************************************************************************/ - -#ifndef DOS_DOS_H -#include -#endif /* DOS_DOS_H */ - -/****************************************************************************/ - -#define CANNOT ! -#define DO_NOTHING ((void)0) -#define NO ! -#define NOT ! -#define DO_NOT ! -#define OK (0) -#define SAME (0) -#define SEEK_ERROR (-1) -#define ERROR (-1) - -/****************************************************************************/ - -#define NUM_ENTRIES(t) (sizeof(t) / sizeof(t[0])) - -/****************************************************************************/ - -#define FLAG_IS_SET(v,f) (((v) & (f)) == (f)) -#define FLAG_IS_CLEAR(v,f) (((v) & (f)) == 0 ) - -/****************************************************************************/ - -#define SET_FLAG(v,f) ((void)((v) |= (f))) -#define CLEAR_FLAG(v,f) ((void)((v) &= ~(f))) - -/****************************************************************************/ - -/* Macro to get longword-aligned stack space for a structure - Uses ANSI token catenation to form a name for the char array - based on the variable name, then creates an appropriately - typed pointer to point to the first longword boundary in the - char array allocated. */ -#define D_S(type, name) \ - char a_##name[sizeof(type)+3]; \ - type *name = (type *)((ULONG)(a_##name+3) & ~3) - -/****************************************************************************/ - -/* BCPL style "NULL"; this should be in . */ -#ifndef ZERO -#define ZERO ((BPTR)NULL) -#endif /* ZERO */ - -/****************************************************************************/ - -/* Special data and function attributes; for OS4 most, if not all of them - are in a file called which is pulled in by the - header file. */ - -/****************************************************************************/ - -#ifndef AMIGA_COMPILER_H - -#ifdef __SASC - -#ifndef ASM -#define ASM __asm -#endif /* ASM */ - -#ifndef REG -#define REG(r,p) register __##r p -#endif /* REG */ - -#ifndef INTERRUPT -#define INTERRUPT __interrupt -#endif /* INTERRUPT */ - -#ifndef INLINE -#define INLINE __inline -#endif /* INLINE */ -#endif /* __SASC */ - -#ifdef __GNUC__ - -#ifndef ASM -#define ASM -#endif /* ASM */ - -#ifndef REG -#define REG(r,p) p __asm(#r) -#endif /* REG */ - -#ifndef INTERRUPT -#define INTERRUPT __attribute__((__interrupt__)) -#endif /* INTERRUPT */ - -#ifndef INLINE -#define INLINE __inline__ -#endif /* INLINE */ - -#endif /* __GNUC__ */ - -#endif /* AMIGA_COMPILER_H */ - -/****************************************************************************/ - -#ifndef WEAK -#ifdef __GNUC__ -#define WEAK __attribute__((weak)) -#else -#define WEAK /* WEAK */ -#endif /* __GNUC__ */ -#endif /* WEAK */ - -/****************************************************************************/ - -#ifndef UNUSED -#ifdef __GNUC__ -#define UNUSED __attribute__((unused)) -#else -#define UNUSED /* UNUSED */ -#endif /* __GNUC__ */ -#endif /* UNUSED */ - -/****************************************************************************/ - -#ifndef NOCOMMON -#ifdef __GNUC__ -#define NOCOMMON __attribute__((nocommon)) -#else -#define NOCOMMON /* NOCOMMON */ -#endif /* __GNUC__ */ -#endif /* NOCOMMON */ - -/****************************************************************************/ - -#endif /* _MACROS_H */ diff --git a/library/make_ctype_table.c b/library/make_ctype_table.c deleted file mode 100644 index ef3d81c..0000000 --- a/library/make_ctype_table.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * $Id: make_ctype_table.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#include -#include -#include - -/****************************************************************************/ - -#define __CTYPE_CONTROL 0x01 -#define __CTYPE_DIGIT 0x02 -#define __CTYPE_HEX_DIGIT 0x04 -#define __CTYPE_PUNCTUATION 0x08 -#define __CTYPE_PRINTABLE 0x10 -#define __CTYPE_WHITE_SPACE 0x20 -#define __CTYPE_LOWER_CASE 0x40 -#define __CTYPE_UPPER_CASE 0x80 - -/****************************************************************************/ - -unsigned char __ctype_table[128]; - -/****************************************************************************/ - -struct { char * name; int flag; } tab[] = -{ - - { "__CTYPE_CONTROL", __CTYPE_CONTROL }, - { "__CTYPE_DIGIT", __CTYPE_DIGIT }, - { "__CTYPE_HEX_DIGIT", __CTYPE_HEX_DIGIT }, - { "__CTYPE_PUNCTUATION", __CTYPE_PUNCTUATION }, - { "__CTYPE_PRINTABLE", __CTYPE_PRINTABLE }, - { "__CTYPE_WHITE_SPACE", __CTYPE_WHITE_SPACE }, - { "__CTYPE_LOWER_CASE", __CTYPE_LOWER_CASE }, - { "__CTYPE_UPPER_CASE", __CTYPE_UPPER_CASE }, - { NULL, 0 } - -}; - -/****************************************************************************/ - -#define _isalnum(c) ((__ctype_table[c] & (__CTYPE_DIGIT|__CTYPE_LOWER_CASE|__CTYPE_UPPER_CASE)) != 0) -#define _isalpha(c) ((__ctype_table[c] & (__CTYPE_LOWER_CASE|__CTYPE_UPPER_CASE)) != 0) -#define _iscntrl(c) ((__ctype_table[c] & __CTYPE_CONTROL) != 0) -#define _isdigit(c) ((__ctype_table[c] & __CTYPE_DIGIT) != 0) -#define _isxdigit(c) ((__ctype_table[c] & __CTYPE_HEX_DIGIT) != 0) -#define _isgraph(c) ((__ctype_table[c] & (__CTYPE_DIGIT|__CTYPE_PUNCTUATION|__CTYPE_LOWER_CASE|__CTYPE_UPPER_CASE)) != 0) -#define _ispunct(c) ((__ctype_table[c] & __CTYPE_PUNCTUATION) != 0) -#define _isprint(c) ((__ctype_table[c] & __CTYPE_PRINTABLE) != 0) -#define _islower(c) ((__ctype_table[c] & __CTYPE_LOWER_CASE) != 0) -#define _isupper(c) ((__ctype_table[c] & __CTYPE_UPPER_CASE) != 0) -#define _isspace(c) ((__ctype_table[c] & __CTYPE_WHITE_SPACE) != 0) - -/****************************************************************************/ - -void -dump_table(void) -{ - int i; - - printf("const unsigned char __ctype_table[128] =\n{\n"); - - for(i = 0 ; i < 128 ; i++) - { - printf("\t/* %3d",i); - - if(' ' <= i && i <= '~') - printf(", '%c'",i); - else - printf(" "); - - printf(" */ "); - - if(__ctype_table[i] != 0) - { - int j,k; - - for(j = k = 0 ; tab[j].name != NULL ; j++) - { - if(__ctype_table[i] & tab[j].flag) - { - if(k++ > 0) - printf("|"); - - printf("%s",tab[j].name); - } - } - } - else - { - printf("0"); - } - - if(i < 127) - printf(","); - - printf("\n"); - } - - printf("};\n"); -} - -/****************************************************************************/ - -int -main(void) -{ - int i,a,b; - - /* Rebuild the contents of the character type table. */ - memset(__ctype_table,0,sizeof(__ctype_table)); - - for(i = 0 ; i < 128 ; i++) - { - if(iscntrl(i)) - __ctype_table[i] |= __CTYPE_CONTROL; - - if(isdigit(i)) - __ctype_table[i] |= __CTYPE_DIGIT; - - if(isxdigit(i)) - __ctype_table[i] |= __CTYPE_HEX_DIGIT; - - if(ispunct(i)) - __ctype_table[i] |= __CTYPE_PUNCTUATION; - - if(isspace(i)) - __ctype_table[i] |= __CTYPE_WHITE_SPACE; - - if(islower(i)) - __ctype_table[i] |= __CTYPE_LOWER_CASE; - - if(isupper(i)) - __ctype_table[i] |= __CTYPE_UPPER_CASE; - - if(isprint(i)) - __ctype_table[i] |= __CTYPE_PRINTABLE; - } - - /* Verify that the table contents match the functional - definitions. */ - for(i = 0 ; i < 128 ; i++) - { - a = ( isalnum(i) != 0); - b = (_isalnum(i) != 0); - - if(a != b) - { - printf("isalnum(%d) %d != %d\n",i,a,b); - abort(); - } - } - - for(i = 0 ; i < 128 ; i++) - { - a = ( isalpha(i) != 0); - b = (_isalpha(i) != 0); - - if(a != b) - { - printf("isalpha(%d) %d != %d\n",i,a,b); - abort(); - } - } - - for(i = 0 ; i < 128 ; i++) - { - a = ( iscntrl(i) != 0); - b = (_iscntrl(i) != 0); - - if(a != b) - { - printf("iscntrl(%d) %d != %d\n",i,a,b); - abort(); - } - } - - for(i = 0 ; i < 128 ; i++) - { - a = ( isdigit(i) != 0); - b = (_isdigit(i) != 0); - - if(a != b) - { - printf("isdigit(%d) %d != %d\n",i,a,b); - abort(); - } - } - - for(i = 0 ; i < 128 ; i++) - { - a = ( isgraph(i) != 0); - b = (_isgraph(i) != 0); - - if(a != b) - { - printf("isgraph(%d) %d != %d\n",i,a,b); - abort(); - } - } - - for(i = 0 ; i < 128 ; i++) - { - a = ( ispunct(i) != 0); - b = (_ispunct(i) != 0); - - if(a != b) - { - printf("ispunct(%d) %d != %d\n",i,a,b); - abort(); - } - } - - for(i = 0 ; i < 128 ; i++) - { - a = ( isprint(i) != 0); - b = (_isprint(i) != 0); - - if(a != b) - { - printf("isprint(%d) %d != %d\n",i,a,b); - abort(); - } - } - - for(i = 0 ; i < 128 ; i++) - { - a = ( islower(i) != 0); - b = (_islower(i) != 0); - - if(a != b) - { - printf("islower(%d) %d != %d\n",i,a,b); - abort(); - } - } - - for(i = 0 ; i < 128 ; i++) - { - a = ( isupper(i) != 0); - b = (_isupper(i) != 0); - - if(a != b) - { - printf("isupper(%d) %d != %d\n",i,a,b); - abort(); - } - } - - for(i = 0 ; i < 128 ; i++) - { - a = ( isspace(i) != 0); - b = (_isspace(i) != 0); - - if(a != b) - { - printf("isspace(%d) %d != %d\n",i,a,b); - abort(); - } - } - - /* If that went well, dump the table as is. */ - dump_table(); - - return(0); -} diff --git a/library/math_acos.c b/library/math_acos.c deleted file mode 100644 index a8e37c9..0000000 --- a/library/math_acos.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * $Id: math_acos.c,v 1.5 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __acos(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___acos - -___acos: - - movel a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-120:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__acos(double x) -{ - double result; - - result = IEEEDPAcos(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__acos(double x) -{ - double result; - - __asm ("facos%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -static const double -one= 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ -pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ -pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ -pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */ -pS0 = 1.66666666666666657415e-01, /* 0x3FC55555, 0x55555555 */ -pS1 = -3.25565818622400915405e-01, /* 0xBFD4D612, 0x03EB6F7D */ -pS2 = 2.01212532134862925881e-01, /* 0x3FC9C155, 0x0E884455 */ -pS3 = -4.00555345006794114027e-02, /* 0xBFA48228, 0xB5688F3B */ -pS4 = 7.91534994289814532176e-04, /* 0x3F49EFE0, 0x7501B288 */ -pS5 = 3.47933107596021167570e-05, /* 0x3F023DE1, 0x0DFDF709 */ -qS1 = -2.40339491173441421878e+00, /* 0xC0033A27, 0x1C8A2D4B */ -qS2 = 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */ -qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ -qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ - -INLINE STATIC const double -__acos(double x) -{ - double z,p,q,r,w,s,c,df; - int hx,ix; - - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; - - if(ix>=0x3ff00000) /* |x| >= 1 */ - { - unsigned int lx; - GET_LOW_WORD(lx,x); - if(((ix-0x3ff00000)|lx)==0) /* |x|==1 */ - { - if(hx>0) - return 0.0; /* acos(1) = 0 */ - else - return pi+2.0*pio2_lo; /* acos(-1)= pi */ - } - return (x-x)/(x-x); /* acos(|x|>1) is NaN */ - } - if(ix<0x3fe00000) /* |x| < 0.5 */ - { - if(ix<=0x3c600000) - return pio2_hi+pio2_lo; /*if|x|<2**-57*/ - - z = x*x; - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - r = p/q; - return pio2_hi - (x - (pio2_lo-x*r)); - } - else if (hx<0) /* x < -0.5 */ - { - z = (one+x)*0.5; - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - s = sqrt(z); - r = p/q; - w = r*s-pio2_lo; - return pi - 2.0*(s+w); - } - else /* x > 0.5 */ - { - z = (one-x)*0.5; - s = sqrt(z); - df = s; - SET_LOW_WORD(df,0); - c = (z-df*df)/(s+df); - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - r = p/q; - w = r*s+c; - return 2.0*(df+w); - } -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -acos(double x) -{ - double result; - - if(-1.0 <= x && x <= 1.0) - { - result = __acos(x); - } - else - { - result = 0; - __set_errno(EDOM); - } - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_acosf.c b/library/math_acosf.c deleted file mode 100644 index ad5ce0c..0000000 --- a/library/math_acosf.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * $Id: math_acosf.c,v 1.2 2005-05-29 14:45:29 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -one = 1.0000000000e+00, /* 0x3F800000 */ -pi = 3.1415925026e+00, /* 0x40490fda */ -pio2_hi = 1.5707962513e+00, /* 0x3fc90fda */ -pio2_lo = 7.5497894159e-08, /* 0x33a22168 */ -pS0 = 1.6666667163e-01, /* 0x3e2aaaab */ -pS1 = -3.2556581497e-01, /* 0xbea6b090 */ -pS2 = 2.0121252537e-01, /* 0x3e4e0aa8 */ -pS3 = -4.0055535734e-02, /* 0xbd241146 */ -pS4 = 7.9153501429e-04, /* 0x3a4f7f04 */ -pS5 = 3.4793309169e-05, /* 0x3811ef08 */ -qS1 = -2.4033949375e+00, /* 0xc019d139 */ -qS2 = 2.0209457874e+00, /* 0x4001572d */ -qS3 = -6.8828397989e-01, /* 0xbf303361 */ -qS4 = 7.7038154006e-02; /* 0x3d9dc62e */ - -float -acosf(float x) -{ - float z,p,q,r,w,s,c,df; - LONG hx,ix; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix==0x3f800000) { /* |x|==1 */ - if(hx>0) return 0.0; /* acos(1) = 0 */ - else return pi+(float)2.0*pio2_lo; /* acos(-1)= pi */ - } else if(ix>0x3f800000) { /* |x| >= 1 */ - return (x-x)/(x-x); /* acos(|x|>1) is NaN */ - } - if(ix<0x3f000000) { /* |x| < 0.5 */ - if(ix<=0x23000000) return pio2_hi+pio2_lo;/*if|x|<2**-57*/ - z = x*x; - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - r = p/q; - return pio2_hi - (x - (pio2_lo-x*r)); - } else if (hx<0) { /* x < -0.5 */ - z = (one+x)*(float)0.5; - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - s = sqrtf(z); - r = p/q; - w = r*s-pio2_lo; - return pi - (float)2.0*(s+w); - } else { /* x > 0.5 */ - LONG idf; - z = (one-x)*(float)0.5; - s = sqrtf(z); - df = s; - GET_FLOAT_WORD(idf,df); - SET_FLOAT_WORD(df,idf&0xfffff000U); - c = (z-df*df)/(s+df); - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - r = p/q; - w = r*s+c; - return (float)2.0*(df+w); - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_acosh.c b/library/math_acosh.c deleted file mode 100644 index 4d5e883..0000000 --- a/library/math_acosh.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * $Id: math_acosh.c,v 1.2 2005-05-30 08:47:26 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double -one = 1.0, -ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ - -double -acosh(double x) -{ - double t; - LONG hx; - ULONG lx; - EXTRACT_WORDS(hx,lx,x); - if(hx<0x3ff00000) { /* x < 1 */ - return (x-x)/(x-x); - } else if(hx >=0x41b00000) { /* x > 2**28 */ - if(hx >=0x7ff00000) { /* x is inf of NaN */ - return x+x; - } else - return log(x)+ln2; /* acosh(huge)=log(2x) */ - } else if(((hx-0x3ff00000)|lx)==0) { - return 0.0; /* acosh(1) = 0 */ - } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ - t=x*x; - return log(2.0*x-one/(x+sqrt(t-one))); - } else { /* 1 - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -one = 1.0, -ln2 = 6.9314718246e-01; /* 0x3f317218 */ - -float -acoshf(float x) -{ - float t; - LONG hx; - GET_FLOAT_WORD(hx,x); - if(hx<0x3f800000) { /* x < 1 */ - return (x-x)/(x-x); - } else if(hx >=0x4d800000) { /* x > 2**28 */ - if(hx >=0x7f800000) { /* x is inf of NaN */ - return x+x; - } else - return logf(x)+ln2; /* acosh(huge)=log(2x) */ - } else if (hx==0x3f800000) { - return 0.0; /* acosh(1) = 0 */ - } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ - t=x*x; - return logf((float)2.0*x-one/(x+sqrtf(t-one))); - } else { /* 1 - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___adddf3 - -___adddf3: - - moveml d2/d3/a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(16),d0/d1/d2/d3 - jsr a6@(-66:W) - moveml sp@+,d2/d3/a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_addsf3.c b/library/math_addsf3.c deleted file mode 100644 index 9b05470..0000000 --- a/library/math_addsf3.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: math_addsf3.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -float -__addsf3(float x,float y) -{ - float result; - - result = IEEESPAdd(x,y); - - return(result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_asin.c b/library/math_asin.c deleted file mode 100644 index bae2a6e..0000000 --- a/library/math_asin.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * $Id: math_asin.c,v 1.5 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -double __asin(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___asin - -___asin: - - movel a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-114:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__asin(double x) -{ - double result; - - result = IEEEDPAsin(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__asin(double x) -{ - double result; - - __asm ("fasin%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -static const double -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ -huge = 1.000e+300, -pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ -pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */ -pio4_hi = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */ - /* coefficient for R(x^2) */ -pS0 = 1.66666666666666657415e-01, /* 0x3FC55555, 0x55555555 */ -pS1 = -3.25565818622400915405e-01, /* 0xBFD4D612, 0x03EB6F7D */ -pS2 = 2.01212532134862925881e-01, /* 0x3FC9C155, 0x0E884455 */ -pS3 = -4.00555345006794114027e-02, /* 0xBFA48228, 0xB5688F3B */ -pS4 = 7.91534994289814532176e-04, /* 0x3F49EFE0, 0x7501B288 */ -pS5 = 3.47933107596021167570e-05, /* 0x3F023DE1, 0x0DFDF709 */ -qS1 = -2.40339491173441421878e+00, /* 0xC0033A27, 0x1C8A2D4B */ -qS2 = 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */ -qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ -qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ - - -INLINE STATIC const double -__asin(double x) -{ - double t,w,p,q,c,r,s; - int hx,ix; - - GET_HIGH_WORD(hx,x); - - ix = hx&0x7fffffff; - - if(ix>= 0x3ff00000) /* |x|>= 1 */ - { - unsigned int lx; - GET_LOW_WORD(lx,x); - - if(((ix-0x3ff00000)|lx)==0) /* asin(1)=+-pi/2 with inexact */ - return x*pio2_hi+x*pio2_lo; - - return (x-x)/(x-x); /* asin(|x|>1) is NaN */ - } - else if (ix<0x3fe00000) /* |x|<0.5 */ - { - if(ix<0x3e400000) /* if |x| < 2**-27 */ - { - if(huge+x>one) - return x; /* return x with inexact if x!=0*/ - } - else - { - t = x*x; - p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); - q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); - w = p/q; - return x+x*w; - } - } - - /* 1> |x|>= 0.5 */ - w = one-fabs(x); - t = w*0.5; - p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); - q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); - s = sqrt(t); - - if(ix>=0x3FEF3333) /* if |x| > 0.975 */ - { - w = p/q; - t = pio2_hi-(2.0*(s+s*w)-pio2_lo); - } - else - { - w = s; - SET_LOW_WORD(w,0); - c = (t-w*w)/(s+w); - r = p/q; - p = 2.0*s*r-(pio2_lo-2.0*c); - q = pio4_hi-2.0*w; - t = pio4_hi-(p-q); - } - - if(hx>0) - return t; - else - return -t; -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -asin(double x) -{ - double result; - - if(-1.0 <= x && x <= 1.0) - { - result = __asin(x); - } - else - { - result = 0; - __set_errno(EDOM); - } - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_asinf.c b/library/math_asinf.c deleted file mode 100644 index 6f7dca4..0000000 --- a/library/math_asinf.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * $Id: math_asinf.c,v 1.2 2005-05-29 14:45:29 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -one = 1.0000000000e+00, /* 0x3F800000 */ -huge = 1.000e+30, -pio2_hi = 1.5707962513e+00, /* 0x3fc90fda */ -pio2_lo = 7.5497894159e-08, /* 0x33a22168 */ -pio4_hi = 7.8539818525e-01, /* 0x3f490fdb */ - /* coefficient for R(x^2) */ -pS0 = 1.6666667163e-01, /* 0x3e2aaaab */ -pS1 = -3.2556581497e-01, /* 0xbea6b090 */ -pS2 = 2.0121252537e-01, /* 0x3e4e0aa8 */ -pS3 = -4.0055535734e-02, /* 0xbd241146 */ -pS4 = 7.9153501429e-04, /* 0x3a4f7f04 */ -pS5 = 3.4793309169e-05, /* 0x3811ef08 */ -qS1 = -2.4033949375e+00, /* 0xc019d139 */ -qS2 = 2.0209457874e+00, /* 0x4001572d */ -qS3 = -6.8828397989e-01, /* 0xbf303361 */ -qS4 = 7.7038154006e-02; /* 0x3d9dc62e */ - -float -asinf(float x) -{ - float t=0.0,w,p,q,c,r,s; - LONG hx,ix; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix==0x3f800000) { - /* asin(1)=+-pi/2 with inexact */ - return x*pio2_hi+x*pio2_lo; - } else if(ix> 0x3f800000) { /* |x|>= 1 */ - return (x-x)/(x-x); /* asin(|x|>1) is NaN */ - } else if (ix<0x3f000000) { /* |x|<0.5 */ - if(ix<0x32000000) { /* if |x| < 2**-27 */ - if(huge+x>one) return x;/* return x with inexact if x!=0*/ - } else - t = x*x; - p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); - q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); - w = p/q; - return x+x*w; - } - /* 1> |x|>= 0.5 */ - w = one-fabsf(x); - t = w*(float)0.5; - p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); - q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); - s = sqrtf(t); - if(ix>=0x3F79999A) { /* if |x| > 0.975 */ - w = p/q; - t = pio2_hi-((float)2.0*(s+s*w)-pio2_lo); - } else { - LONG iw; - w = s; - GET_FLOAT_WORD(iw,w); - SET_FLOAT_WORD(w,iw&0xfffff000U); - c = (t-w*w)/(s+w); - r = p/q; - p = (float)2.0*s*r-(pio2_lo-(float)2.0*c); - q = pio4_hi-(float)2.0*w; - t = pio4_hi-(p-q); - } - if(hx>0) return t; else return -t; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_asinh.c b/library/math_asinh.c deleted file mode 100644 index 2a99f27..0000000 --- a/library/math_asinh.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * $Id: math_asinh.c,v 1.2 2005-05-30 08:47:26 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ -ln2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ -huge= 1.00000000000000000000e+300; - -double -asinh(double x) -{ - double t,w; - LONG hx,ix; - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */ - if(ix< 0x3e300000) { /* |x|<2**-28 */ - if(huge+x>one) return x; /* return x inexact except 0 */ - } - if(ix>0x41b00000) { /* |x| > 2**28 */ - w = log(fabs(x))+ln2; - } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ - t = fabs(x); - w = log(2.0*t+one/(sqrt(x*x+one)+t)); - } else { /* 2.0 > |x| > 2**-28 */ - t = x*x; - w =log1p(fabs(x)+t/(one+sqrt(one+t))); - } - if(hx>0) return w; else return -w; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_asinhf.c b/library/math_asinhf.c deleted file mode 100644 index 56152ec..0000000 --- a/library/math_asinhf.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * $Id: math_asinhf.c,v 1.2 2005-05-30 08:47:26 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -one = 1.0000000000e+00, /* 0x3F800000 */ -ln2 = 6.9314718246e-01, /* 0x3f317218 */ -huge= 1.0000000000e+30; - -float -asinhf(float x) -{ - float t,w; - LONG hx,ix; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x7f800000) return x+x; /* x is inf or NaN */ - if(ix< 0x31800000) { /* |x|<2**-28 */ - if(huge+x>one) return x; /* return x inexact except 0 */ - } - if(ix>0x4d800000) { /* |x| > 2**28 */ - w = logf(fabsf(x))+ln2; - } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ - t = fabsf(x); - w = logf((float)2.0*t+one/(sqrtf(x*x+one)+t)); - } else { /* 2.0 > |x| > 2**-28 */ - t = x*x; - w =log1pf(fabsf(x)+t/(one+sqrtf(one+t))); - } - if(hx>0) return w; else return -w; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_atan.c b/library/math_atan.c deleted file mode 100644 index 3992081..0000000 --- a/library/math_atan.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * $Id: math_atan.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __atan(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___atan - -___atan: - - movel a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-30:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__atan(double x) -{ - double result; - - result = IEEEDPAtan(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__atan(double x) -{ - double result; - - __asm ("fatan%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -static const double atanhi[] = { - 4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */ - 7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */ - 9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */ - 1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */ -}; - -static const double atanlo[] = { - 2.26987774529616870924e-17, /* atan(0.5)lo 0x3C7A2B7F, 0x222F65E2 */ - 3.06161699786838301793e-17, /* atan(1.0)lo 0x3C81A626, 0x33145C07 */ - 1.39033110312309984516e-17, /* atan(1.5)lo 0x3C700788, 0x7AF0CBBD */ - 6.12323399573676603587e-17, /* atan(inf)lo 0x3C91A626, 0x33145C07 */ -}; - -static const double aT[] = { - 3.33333333333329318027e-01, /* 0x3FD55555, 0x5555550D */ - -1.99999999998764832476e-01, /* 0xBFC99999, 0x9998EBC4 */ - 1.42857142725034663711e-01, /* 0x3FC24924, 0x920083FF */ - -1.11111104054623557880e-01, /* 0xBFBC71C6, 0xFE231671 */ - 9.09088713343650656196e-02, /* 0x3FB745CD, 0xC54C206E */ - -7.69187620504482999495e-02, /* 0xBFB3B0F2, 0xAF749A6D */ - 6.66107313738753120669e-02, /* 0x3FB10D66, 0xA0D03D51 */ - -5.83357013379057348645e-02, /* 0xBFADDE2D, 0x52DEFD9A */ - 4.97687799461593236017e-02, /* 0x3FA97B4B, 0x24760DEB */ - -3.65315727442169155270e-02, /* 0xBFA2B444, 0x2C6A6C2F */ - 1.62858201153657823623e-02, /* 0x3F90AD3A, 0xE322DA11 */ -}; - -static const double -one = 1.0, -huge = 1.0e300; - -INLINE STATIC const double -__atan(double x) -{ - double w,s1,s2,z; - int ix,hx,id; - - GET_HIGH_WORD(hx,x); - - ix = hx&0x7fffffff; - - if(ix>=0x44100000) /* if |x| >= 2^66 */ - { - unsigned int low; - - GET_LOW_WORD(low,x); - - if(ix>0x7ff00000|| (ix==0x7ff00000&&(low!=0))) - return x+x; /* NaN */ - - if(hx>0) - return atanhi[3]+atanlo[3]; - else - return -atanhi[3]-atanlo[3]; - } - - if (ix < 0x3fdc0000) /* |x| < 0.4375 */ - { - if (ix < 0x3e200000) /* |x| < 2^-29 */ - { - if(huge+x>one) - return x; /* raise inexact */ - } - id = -1; - } - else - { - x = fabs(x); - if (ix < 0x3ff30000) /* |x| < 1.1875 */ - { - if (ix < 0x3fe60000) /* 7/16 <=|x|<11/16 */ - { - id = 0; - x = (2.0*x-one)/(2.0+x); - } - else /* 11/16<=|x|< 19/16 */ - { - id = 1; - x = (x-one)/(x+one); - } - } - else - { - if (ix < 0x40038000) /* |x| < 2.4375 */ - { - id = 2; - x = (x-1.5)/(one+1.5*x); - } - else /* 2.4375 <= |x| < 2^66 */ - { - id = 3; - x = -1.0/x; - } - } - } - - /* end of argument reduction */ - z = x*x; - w = z*z; - - /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */ - s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10]))))); - s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9])))); - - if (id<0) - { - return x - x*(s1+s2); - } - else - { - z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x); - return (hx<0)? -z:z; - } -} - -#endif /* PPC_FLOATIN_POINT_SUPPORT */ - - -/****************************************************************************/ - -double -atan(double x) -{ - double result; - - result = __atan(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_atan2.c b/library/math_atan2.c deleted file mode 100644 index f4be17f..0000000 --- a/library/math_atan2.c +++ /dev/null @@ -1,333 +0,0 @@ -/* - * $Id: math_atan2.c,v 1.6 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) -extern double __atan(double x); -#else -#define __atan(x) IEEEDPAtan(x) -#endif /* __GNUC__ */ - -/****************************************************************************/ - -INLINE STATIC const double -__atan2(double y,double x) -{ - const double pi = 3.14159265358979323846; - const double pi_over_2 = pi / 2.0; - double result; - - if(x > 0.0) - { - if(y > 0.0) - { - if(x > y) - result = __atan(y / x); - else - result = pi_over_2 - __atan(x / y); - } - else - { - if(x > -y) - result = __atan(y / x); - else - result = -(pi_over_2 + __atan(x / y)); - } - } - else - { - if(y > 0.0) - { - if((-x) > y) - result = pi + __atan (y / x); - else - result = pi_over_2 - __atan(x / y); - } - else - { - if((-x) > (-y)) - { - result = -(pi - __atan(y / x)); - } - else if (y < 0.0) - { - result = -(pi_over_2 + __atan(x / y)); - } - else - { - result = 0; - __set_errno(EDOM); - } - } - } - - return(result); -} - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__atan(double x) -{ - double result; - - __asm ("fatan%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -INLINE STATIC const double -__atan2(double y,double x) -{ - double pi,pi_over_2; - double result; - - __asm ("fmovecr%.x %#0,%0" /* extended precision pi */ - : "=f" (pi) - : /* no inputs */ ); - - __asm ("fscale%.b %#-1,%0" /* no loss of accuracy */ - : "=f" (pi_over_2) - : "0" (pi)); - - if(x > 0.0) - { - if(y > 0.0) - { - if(x > y) - result = __atan(y / x); - else - result = pi_over_2 - __atan(x / y); - } - else - { - if(x > -y) - result = __atan(y / x); - else - result = -(pi_over_2 + __atan(x / y)); - } - } - else - { - if(y > 0.0) - { - if((-x) > y) - result = pi + __atan (y / x); - else - result = pi_over_2 - __atan(x / y); - } - else - { - if((-x) > (-y)) - { - result = -(pi - __atan(y / x)); - } - else if (y < 0.0) - { - result = -(pi_over_2 + __atan(x / y)); - } - else - { - result = 0; - __set_errno(EDOM); - } - } - } - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -static const double -tiny = 1.0e-300, -zero = 0.0, -pi_o_4 = 7.8539816339744827900E-01, /* 0x3FE921FB, 0x54442D18 */ -pi_o_2 = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */ -pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */ -pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ - -INLINE STATIC const double -__atan2(double y,double x) -{ - double z; - int k,m,hx,hy,ix,iy; - unsigned int lx,ly; - - EXTRACT_WORDS(hx,lx,x); - ix = hx&0x7fffffff; - - EXTRACT_WORDS(hy,ly,y); - iy = hy&0x7fffffff; - - if( ((ix|((lx|-lx)>>31))>0x7ff00000) || ((iy|((ly|-ly)>>31))>0x7ff00000) ) /* x or y is NaN */ - return x+y; - - if((hx-0x3ff00000|lx)==0) - return atan(y); /* x=1.0 */ - - m = ((hy>>31)&1)|((hx>>30)&2); /* 2*sign(x)+sign(y) */ - - /* when y = 0 */ - if((iy|ly)==0) - { - switch(m) - { - case 0: - case 1: - return y; /* atan(+-0,+anything)=+-0 */ - case 2: - return pi+tiny; /* atan(+0,-anything) = pi */ - case 3: - return -pi-tiny; /* atan(-0,-anything) =-pi */ - } - } - - /* when x = 0 */ - if((ix|lx)==0) - return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; - - /* when x is INF */ - if(ix==0x7ff00000) - { - if(iy==0x7ff00000) - { - switch(m) - { - case 0: - return pi_o_4+tiny; /* atan(+INF,+INF) */ - case 1: - return -pi_o_4-tiny; /* atan(-INF,+INF) */ - case 2: - return 3.0*pi_o_4+tiny; /*atan(+INF,-INF)*/ - case 3: - return -3.0*pi_o_4-tiny; /*atan(-INF,-INF)*/ - } - } - else - { - switch(m) - { - case 0: - return zero ; /* atan(+...,+INF) */ - case 1: - return -zero ; /* atan(-...,+INF) */ - case 2: - return pi+tiny ; /* atan(+...,-INF) */ - case 3: - return -pi-tiny ; /* atan(-...,-INF) */ - } - } - } - - /* when y is INF */ - if(iy==0x7ff00000) - return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; - - /* compute y/x */ - k = (iy-ix)>>20; - if(k > 60) - z=pi_o_2+0.5*pi_lo; /* |y/x| > 2**60 */ - else - if(hx<0&&k<-60) - z=0.0; /* |y|/x < -2**60 */ - else - z=atan(fabs(y/x)); /* safe to do y/x */ - - switch (m) - { - case 0: - return z; /* atan(+,+) */ - case 1: - { - unsigned int zh; - GET_HIGH_WORD(zh,z); - SET_HIGH_WORD(z,zh ^ 0x80000000); - } - return z; /* atan(-,+) */ - case 2: - return pi-(z-pi_lo); /* atan(+,-) */ - default: - return (z-pi_lo)-pi; /* atan(-,-) */ - } -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -atan2(double y,double x) -{ - double result; - - result = __atan2(y,x); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_atan2f.c b/library/math_atan2f.c deleted file mode 100644 index 2401529..0000000 --- a/library/math_atan2f.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * $Id: math_atan2f.c,v 1.3 2005-05-30 08:10:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -tiny = 1.0e-30, -zero = 0.0, -pi_o_4 = 7.8539818525e-01, /* 0x3f490fdb */ -pi_o_2 = 1.5707963705e+00, /* 0x3fc90fdb */ -pi = 3.1415925026e+00, /* 0x40490fda */ -pi_lo = 1.5099578832e-07; /* 0x34222168 */ - -float -atan2f(float y, float x) -{ - float z; - LONG k,m,hx,hy,ix,iy; - - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - GET_FLOAT_WORD(hy,y); - iy = hy&0x7fffffff; - if((ix>0x7f800000)|| - (iy>0x7f800000)) /* x or y is NaN */ - return x+y; - if(hx==0x3f800000) return atanf(y); /* x=1.0 */ - m = ((hy>>31)&1)|((hx>>30)&2); /* 2*sign(x)+sign(y) */ - - /* when y = 0 */ - if(iy==0) { - switch(m) { - case 0: - case 1: return y; /* atan(+-0,+anything)=+-0 */ - case 2: return pi+tiny;/* atan(+0,-anything) = pi */ - case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */ - } - } - /* when x = 0 */ - if(ix==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; - - /* when x is INF */ - if(ix==0x7f800000) { - if(iy==0x7f800000) { - switch(m) { - case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */ - case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */ - case 2: return (float)3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/ - case 3: return (float)-3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/ - } - } else { - switch(m) { - case 0: return zero ; /* atan(+...,+INF) */ - case 1: /* atan(-...,+INF) */ - { - /* Make sure we return -0, not +0. If we - say "return -zero;", GCC might optimize - that with FLDZ, which we don't want. */ - return copysignf(zero, -1); - } - - case 2: return pi+tiny ; /* atan(+...,-INF) */ - case 3: return -pi-tiny ; /* atan(-...,-INF) */ - } - } - } - /* when y is INF */ - if(iy==0x7f800000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; - - /* compute y/x */ - k = (iy-ix)>>23; - if(k > 60) z=pi_o_2+(float)0.5*pi_lo; /* |y/x| > 2**60 */ - else if(hx<0&&k<-60) z=0.0; /* |y|/x < -2**60 */ - else z=atanf(fabsf(y/x)); /* safe to do y/x */ - switch (m) { - case 0: return z ; /* atan(+,+) */ - case 1: { - ULONG zh; - GET_FLOAT_WORD(zh,z); - SET_FLOAT_WORD(z,zh ^ 0x80000000U); - } - return z ; /* atan(-,+) */ - case 2: return pi-(z-pi_lo);/* atan(+,-) */ - default: /* case 3 */ - return (z-pi_lo)-pi;/* atan(-,-) */ - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_atanf.c b/library/math_atanf.c deleted file mode 100644 index f91cfbb..0000000 --- a/library/math_atanf.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * $Id: math_atanf.c,v 1.2 2005-05-29 14:45:29 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float atanhi[] = { - 4.6364760399e-01, /* atan(0.5)hi 0x3eed6338 */ - 7.8539812565e-01, /* atan(1.0)hi 0x3f490fda */ - 9.8279368877e-01, /* atan(1.5)hi 0x3f7b985e */ - 1.5707962513e+00, /* atan(inf)hi 0x3fc90fda */ -}; - -static const float atanlo[] = { - 5.0121582440e-09, /* atan(0.5)lo 0x31ac3769 */ - 3.7748947079e-08, /* atan(1.0)lo 0x33222168 */ - 3.4473217170e-08, /* atan(1.5)lo 0x33140fb4 */ - 7.5497894159e-08, /* atan(inf)lo 0x33a22168 */ -}; - -static const float aT[] = { - 3.3333334327e-01, /* 0x3eaaaaaa */ - -2.0000000298e-01, /* 0xbe4ccccd */ - 1.4285714924e-01, /* 0x3e124925 */ - -1.1111110449e-01, /* 0xbde38e38 */ - 9.0908870101e-02, /* 0x3dba2e6e */ - -7.6918758452e-02, /* 0xbd9d8795 */ - 6.6610731184e-02, /* 0x3d886b35 */ - -5.8335702866e-02, /* 0xbd6ef16b */ - 4.9768779427e-02, /* 0x3d4bda59 */ - -3.6531571299e-02, /* 0xbd15a221 */ - 1.6285819933e-02, /* 0x3c8569d7 */ -}; - -static const float -one = 1.0, -huge = 1.0e30; - -float -atanf(float x) -{ - float w,s1,s2,z; - LONG ix,hx,id; - - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x50800000) { /* if |x| >= 2^34 */ - if(ix>0x7f800000) - return x+x; /* NaN */ - if(hx>0) return atanhi[3]+atanlo[3]; - else return -atanhi[3]-atanlo[3]; - } if (ix < 0x3ee00000) { /* |x| < 0.4375 */ - if (ix < 0x31000000) { /* |x| < 2^-29 */ - if(huge+x>one) return x; /* raise inexact */ - } - id = -1; - } else { - x = fabsf(x); - if (ix < 0x3f980000) { /* |x| < 1.1875 */ - if (ix < 0x3f300000) { /* 7/16 <=|x|<11/16 */ - id = 0; x = ((float)2.0*x-one)/((float)2.0+x); - } else { /* 11/16<=|x|< 19/16 */ - id = 1; x = (x-one)/(x+one); - } - } else { - if (ix < 0x401c0000) { /* |x| < 2.4375 */ - id = 2; x = (x-(float)1.5)/(one+(float)1.5*x); - } else { /* 2.4375 <= |x| < 2^66 */ - id = 3; x = -(float)1.0/x; - } - }} - /* end of argument reduction */ - z = x*x; - w = z*z; - /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */ - s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10]))))); - s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9])))); - if (id<0) return x - x*(s1+s2); - else { - z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x); - return (hx<0)? -z:z; - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_atanh.c b/library/math_atanh.c deleted file mode 100644 index ed16784..0000000 --- a/library/math_atanh.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_atanh.c,v 1.1 2005-05-29 11:19:00 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -atanh(double x) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_atanhf.c b/library/math_atanhf.c deleted file mode 100644 index 0eb97aa..0000000 --- a/library/math_atanhf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_atanhf.c,v 1.1 2005-05-29 11:19:00 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -atanhf(float x) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_cbrt.c b/library/math_cbrt.c deleted file mode 100644 index a625dcc..0000000 --- a/library/math_cbrt.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * $Id: math_cbrt.c,v 1.2 2005-05-29 14:45:29 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const ULONG - B1 = 715094163, /* B1 = (682-0.03306235651)*2**20 */ - B2 = 696219795; /* B2 = (664-0.03306235651)*2**20 */ - -static const double -C = 5.42857142857142815906e-01, /* 19/35 = 0x3FE15F15, 0xF15F15F1 */ -D = -7.05306122448979611050e-01, /* -864/1225 = 0xBFE691DE, 0x2532C834 */ -E = 1.41428571428571436819e+00, /* 99/70 = 0x3FF6A0EA, 0x0EA0EA0F */ -F = 1.60714285714285720630e+00, /* 45/28 = 0x3FF9B6DB, 0x6DB6DB6E */ -G = 3.57142857142857150787e-01; /* 5/14 = 0x3FD6DB6D, 0xB6DB6DB7 */ - -double -cbrt(double x) -{ - LONG hx; - double r,s,t=0.0,w; - ULONG sign; - ULONG high,low; - - GET_HIGH_WORD(hx,x); - sign=hx&0x80000000U; /* sign= sign(x) */ - hx ^=sign; - if(hx>=0x7ff00000) return(x+x); /* cbrt(NaN,INF) is itself */ - GET_LOW_WORD(low,x); - if((hx|low)==0) - return(x); /* cbrt(0) is itself */ - - SET_HIGH_WORD(x,hx); /* x <- |x| */ - /* rough cbrt to 5 bits */ - if(hx<0x00100000) /* subnormal number */ - {SET_HIGH_WORD(t,0x43500000); /* set t= 2**54 */ - t*=x; GET_HIGH_WORD(high,t); SET_HIGH_WORD(t,high/3+B2); - } - else - SET_HIGH_WORD(t,hx/3+B1); - - - /* new cbrt to 23 bits, may be implemented in single precision */ - r=t*t/x; - s=C+r*t; - t*=G+F/(s+E+D/s); - - /* chopped to 20 bits and make it larger than cbrt(x) */ - GET_HIGH_WORD(high,t); - INSERT_WORDS(t,high+0x00000001,0); - - - /* one step newton iteration to 53 bits with error less than 0.667 ulps */ - s=t*t; /* t*t is exact */ - r=x/s; - w=t+t; - r=(r-t)/(w+r); /* r-s is exact */ - t=t+t*r; - - /* retore the sign bit */ - GET_HIGH_WORD(high,t); - SET_HIGH_WORD(t,high|sign); - return(t); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_cbrtf.c b/library/math_cbrtf.c deleted file mode 100644 index 6ef99e1..0000000 --- a/library/math_cbrtf.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * $Id: math_cbrtf.c,v 1.2 2005-05-29 14:45:29 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const ULONG - B1 = 709958130, /* B1 = (84+2/3-0.03306235651)*2**23 */ - B2 = 642849266; /* B2 = (76+2/3-0.03306235651)*2**23 */ - -static const float -C = 5.4285717010e-01, /* 19/35 = 0x3f0af8b0 */ -D = -7.0530611277e-01, /* -864/1225 = 0xbf348ef1 */ -E = 1.4142856598e+00, /* 99/70 = 0x3fb50750 */ -F = 1.6071428061e+00, /* 45/28 = 0x3fcdb6db */ -G = 3.5714286566e-01; /* 5/14 = 0x3eb6db6e */ - -float -cbrtf(float x) -{ - LONG hx; - float r,s,t; - ULONG sign; - ULONG high; - - GET_FLOAT_WORD(hx,x); - sign=hx&0x80000000U; /* sign= sign(x) */ - hx ^=sign; - if(hx>=0x7f800000) return(x+x); /* cbrt(NaN,INF) is itself */ - if(hx==0) - return(x); /* cbrt(0) is itself */ - - SET_FLOAT_WORD(x,hx); /* x <- |x| */ - /* rough cbrt to 5 bits */ - if(hx<0x00800000) /* subnormal number */ - {SET_FLOAT_WORD(t,0x4b800000); /* set t= 2**24 */ - t*=x; GET_FLOAT_WORD(high,t); SET_FLOAT_WORD(t,high/3+B2); - } - else - SET_FLOAT_WORD(t,hx/3+B1); - - /* new cbrt to 23 bits */ - r=t*t/x; - s=C+r*t; - t*=G+F/(s+E+D/s); - - /* retore the sign bit */ - GET_FLOAT_WORD(high,t); - SET_FLOAT_WORD(t,high|sign); - return(t); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_ceil.c b/library/math_ceil.c deleted file mode 100644 index fb94390..0000000 --- a/library/math_ceil.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * $Id: math_ceil.c,v 1.4 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __ceil(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___ceil - -___ceil: - - movel a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-96:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__ceil(double x) -{ - double result; - - result = IEEEDPCeil(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__ceil(double x) -{ - int rounding_mode, round_up; - double result; - - __asm __volatile ("fmove%.l fpcr,%0" - : "=dm" (rounding_mode) - : /* no inputs */ ); - - round_up = rounding_mode | 0x30; - - __asm __volatile ("fmove%.l %0,fpcr" - : /* no outputs */ - : "dmi" (round_up)); - __asm __volatile ("fint%.x %1,%0" - : "=f" (result) - : "f" (x)); - __asm __volatile ("fmove%.l %0,fpcr" - : /* no outputs */ - : "dmi" (rounding_mode)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -static const double huge = 1.0e300; - -INLINE STATIC const double -__ceil(double x) -{ - int i0,i1,j0; - unsigned int i,j; - - EXTRACT_WORDS(i0,i1,x); - - j0 = ((i0>>20)&0x7ff)-0x3ff; - - if(j0<20) - { - if(j0<0) - { - if(huge+x>0.0) - { - if(i0<0) - { - i0=0x80000000; - i1=0; - } - else if((i0|i1)!=0) - { - i0=0x3ff00000; - i1=0; - } - } - } - else - { - i = (0x000fffff)>>j0; - if(((i0&i)|i1)==0) - return x; - if(huge+x>0.0) - { - if(i0>0) - i0 += (0x00100000)>>j0; - i0 &= (~i); i1=0; - } - } - } - else if (j0>51) - { - if(j0==0x400) - return x+x; - else - return x; - } - else - { - i = ((unsigned int)(0xffffffff))>>(j0-20); - - if((i1&i)==0) - return x; - - if(huge+x>0.0) - { - - if(i0>0) - { - if(j0==20) - i0+=1; - else - { - j = i1 + (1<<(52-j0)); - if(j - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float huge = 1.0e30; - -float -ceilf(float x) -{ - LONG i0,j_0; - ULONG i; - GET_FLOAT_WORD(i0,x); - j_0 = ((i0>>23)&0xff)-0x7f; - if(j_0<23) { - if(j_0<0) { /* raise inexact if x != 0 */ - if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0<0) {i0=0x80000000U;} - else if(i0!=0) { i0=0x3f800000;} - } - } else { - i = (0x007fffff)>>j_0; - if((i0&i)==0) return x; /* x is integral */ - if(huge+x>(float)0.0) { /* raise inexact flag */ - if(i0>0) i0 += (0x00800000)>>j_0; - i0 &= (~i); - } - } - } else { - if(j_0==0x80) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } - SET_FLOAT_WORD(x,i0); - return x; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_copysign.c b/library/math_copysign.c deleted file mode 100644 index 8389f6a..0000000 --- a/library/math_copysign.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * $Id: math_copysign.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -copysign(double x, double y) -{ - unsigned long hx,hy; - - GET_HIGH_WORD(hx,x); - GET_HIGH_WORD(hy,y); - SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000U)); - - return x; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_copysignf.c b/library/math_copysignf.c deleted file mode 100644 index 5f55459..0000000 --- a/library/math_copysignf.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * $Id: math_copysignf.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -copysignf(float x, float y) -{ - unsigned long ix,iy; - GET_FLOAT_WORD(ix,x); - GET_FLOAT_WORD(iy,y); - SET_FLOAT_WORD(x,(ix&0x7fffffff)|(iy&0x80000000U)); - return x; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_cos.c b/library/math_cos.c deleted file mode 100644 index 8abb4bd..0000000 --- a/library/math_cos.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * $Id: math_cos.c,v 1.4 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __cos(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___cos - -___cos: - - movel a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-42:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__cos(double x) -{ - double result; - - result = IEEEDPCos(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__cos(double x) -{ - double result; - - __asm ("fcos%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__cos(double x) -{ - double y[2],z=0.0; - int n,ix; - - /* High word of x. */ - GET_HIGH_WORD(ix,x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if(ix <= 0x3fe921fb) - return __kernel_cos(x,z); - - /* cos(Inf or NaN) is NaN */ - else if (ix>=0x7ff00000) - return x-x; - - /* argument reduction needed */ - else - { - n = __rem_pio2(x,y); - switch(n&3) - { - case 0: - return __kernel_cos(y[0],y[1]); - case 1: - return -__kernel_sin(y[0],y[1],1); - case 2: - return -__kernel_cos(y[0],y[1]); - default: - return __kernel_sin(y[0],y[1],1); - } - } -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -cos(double x) -{ - double result; - - result = __cos(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_cosf.c b/library/math_cosf.c deleted file mode 100644 index 6b14a81..0000000 --- a/library/math_cosf.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * $Id: math_cosf.c,v 1.2 2005-05-30 08:10:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float one=1.0; - -float -cosf(float x) -{ - float y[2],z=0.0; - LONG n,ix; - - GET_FLOAT_WORD(ix,x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if(ix <= 0x3f490fd8) return __kernel_cosf(x,z); - - /* cos(Inf or NaN) is NaN */ - else if (ix>=0x7f800000) return x-x; - - /* argument reduction needed */ - else { - n = __rem_pio2f(x,y); - switch(n&3) { - case 0: return __kernel_cosf(y[0],y[1]); - case 1: return -__kernel_sinf(y[0],y[1],1); - case 2: return -__kernel_cosf(y[0],y[1]); - default: - return __kernel_sinf(y[0],y[1],1); - } - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_cosh.c b/library/math_cosh.c deleted file mode 100644 index daa9a4e..0000000 --- a/library/math_cosh.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * $Id: math_cosh.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __cosh(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___cosh - -___cosh: - - movel a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-66:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__cosh(double x) -{ - double result; - - result = IEEEDPCosh(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__cosh(double x) -{ - double result; - - __asm ("fcosh%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -static const double one = 1.0, half=0.5, huge = 1.0e300; - -INLINE STATIC const double -__cosh(double x) -{ - double t,w; - int ix; - unsigned int lx; - - /* High word of |x|. */ - GET_HIGH_WORD(ix,x); - ix &= 0x7fffffff; - - /* x is INF or NaN */ - if(ix>=0x7ff00000) - return x*x; - - /* |x| in [0,0.5*ln2], return 1+__expm1(|x|)^2/(2*exp(|x|)) */ - if(ix<0x3fd62e43) - { - t = __expm1(fabs(x)); - w = one+t; - if (ix<0x3c800000) - return w; /* cosh(tiny) = 1 */ - return one+(t*t)/(w+w); - } - - /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */ - if (ix < 0x40360000) - { - t = exp(fabs(x)); - return half*t+half/t; - } - - /* |x| in [22, log(maxdouble)] return half*exp(|x|) */ - if (ix < 0x40862E42) - return half*exp(fabs(x)); - - /* |x| in [log(maxdouble), overflowthresold] */ - GET_LOW_WORD(lx,x); - if (ix<0x408633CE || (ix==0x408633ce && lx<=(unsigned int)0x8fb9f87d)) - { - w = exp(half*fabs(x)); - t = half*w; - return t*w; - } - - /* |x| > overflowthresold, cosh(x) overflow */ - return huge*huge; -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -cosh(double x) -{ - double result; - - result = __cosh(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_coshf.c b/library/math_coshf.c deleted file mode 100644 index 8c8bc62..0000000 --- a/library/math_coshf.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * $Id: math_coshf.c,v 1.2 2005-05-30 08:10:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float one = 1.0, half=0.5, huge = 1.0e30; - -float -coshf(float x) -{ - float t,w; - LONG ix; - - GET_FLOAT_WORD(ix,x); - ix &= 0x7fffffff; - - /* x is INF or NaN */ - if(ix>=0x7f800000) return x*x; - - /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */ - if(ix<0x3eb17218) { - t = expm1f(fabsf(x)); - w = one+t; - if (ix<0x24000000) return w; /* cosh(tiny) = 1 */ - return one+(t*t)/(w+w); - } - - /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */ - if (ix < 0x41b00000) { - t = expf(fabsf(x)); - return half*t+half/t; - } - - /* |x| in [22, log(maxdouble)] return half*exp(|x|) */ - if (ix < 0x42b17180) return half*expf(fabsf(x)); - - /* |x| in [log(maxdouble), overflowthresold] */ - if (ix<=0x42b2d4fc) { - w = expf(half*fabsf(x)); - t = half*w; - return t*w; - } - - /* |x| > overflowthresold, cosh(x) overflow */ - return huge*huge; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_divdf3.c b/library/math_divdf3.c deleted file mode 100644 index 6ac6d8d..0000000 --- a/library/math_divdf3.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: math_divdf3.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___divdf3 - -___divdf3: - - moveml d2/d3/a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(16),d0/d1/d2/d3 - jsr a6@(-84:W) - moveml sp@+,d2/d3/a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_divsf3.c b/library/math_divsf3.c deleted file mode 100644 index 6d22b63..0000000 --- a/library/math_divsf3.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: math_divsf3.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -float -__divsf3(float x,float y) -{ - float result; - - result = IEEESPDiv(x,y); - - return(result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_eqdf2.c b/library/math_eqdf2.c deleted file mode 100644 index 90cf06d..0000000 --- a/library/math_eqdf2.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: math_eqdf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___eqdf2 - -___eqdf2: - - moveml d2/d3/a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(16),d0/d1/d2/d3 - jsr a6@(-42:W) - moveml sp@+,d2/d3/a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_eqsf2.c b/library/math_eqsf2.c deleted file mode 100644 index 6034847..0000000 --- a/library/math_eqsf2.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: math_eqsf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -float -__eqsf2(float x,float y) -{ - float result; - - result = IEEESPCmp(x,y); - - return(result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_erf.c b/library/math_erf.c deleted file mode 100644 index 99115d8..0000000 --- a/library/math_erf.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * $Id: math_erf.c,v 1.3 2005-05-30 08:10:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double -tiny = 1e-300, -half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ -two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */ - /* c = (float)0.84506291151 */ -erx = 8.45062911510467529297e-01, /* 0x3FEB0AC1, 0x60000000 */ -/* - * Coefficients for approximation to erf on [0,0.84375] - */ -efx = 1.28379167095512586316e-01, /* 0x3FC06EBA, 0x8214DB69 */ -efx8= 1.02703333676410069053e+00, /* 0x3FF06EBA, 0x8214DB69 */ -pp0 = 1.28379167095512558561e-01, /* 0x3FC06EBA, 0x8214DB68 */ -pp1 = -3.25042107247001499370e-01, /* 0xBFD4CD7D, 0x691CB913 */ -pp2 = -2.84817495755985104766e-02, /* 0xBF9D2A51, 0xDBD7194F */ -pp3 = -5.77027029648944159157e-03, /* 0xBF77A291, 0x236668E4 */ -pp4 = -2.37630166566501626084e-05, /* 0xBEF8EAD6, 0x120016AC */ -qq1 = 3.97917223959155352819e-01, /* 0x3FD97779, 0xCDDADC09 */ -qq2 = 6.50222499887672944485e-02, /* 0x3FB0A54C, 0x5536CEBA */ -qq3 = 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */ -qq4 = 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */ -qq5 = -3.96022827877536812320e-06, /* 0xBED09C43, 0x42A26120 */ -/* - * Coefficients for approximation to erf in [0.84375,1.25] - */ -pa0 = -2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */ -pa1 = 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */ -pa2 = -3.72207876035701323847e-01, /* 0xBFD7D240, 0xFBB8C3F1 */ -pa3 = 3.18346619901161753674e-01, /* 0x3FD45FCA, 0x805120E4 */ -pa4 = -1.10894694282396677476e-01, /* 0xBFBC6398, 0x3D3E28EC */ -pa5 = 3.54783043256182359371e-02, /* 0x3FA22A36, 0x599795EB */ -pa6 = -2.16637559486879084300e-03, /* 0xBF61BF38, 0x0A96073F */ -qa1 = 1.06420880400844228286e-01, /* 0x3FBB3E66, 0x18EEE323 */ -qa2 = 5.40397917702171048937e-01, /* 0x3FE14AF0, 0x92EB6F33 */ -qa3 = 7.18286544141962662868e-02, /* 0x3FB2635C, 0xD99FE9A7 */ -qa4 = 1.26171219808761642112e-01, /* 0x3FC02660, 0xE763351F */ -qa5 = 1.36370839120290507362e-02, /* 0x3F8BEDC2, 0x6B51DD1C */ -qa6 = 1.19844998467991074170e-02, /* 0x3F888B54, 0x5735151D */ -/* - * Coefficients for approximation to erfc in [1.25,1/0.35] - */ -ra0 = -9.86494403484714822705e-03, /* 0xBF843412, 0x600D6435 */ -ra1 = -6.93858572707181764372e-01, /* 0xBFE63416, 0xE4BA7360 */ -ra2 = -1.05586262253232909814e+01, /* 0xC0251E04, 0x41B0E726 */ -ra3 = -6.23753324503260060396e+01, /* 0xC04F300A, 0xE4CBA38D */ -ra4 = -1.62396669462573470355e+02, /* 0xC0644CB1, 0x84282266 */ -ra5 = -1.84605092906711035994e+02, /* 0xC067135C, 0xEBCCABB2 */ -ra6 = -8.12874355063065934246e+01, /* 0xC0545265, 0x57E4D2F2 */ -ra7 = -9.81432934416914548592e+00, /* 0xC023A0EF, 0xC69AC25C */ -sa1 = 1.96512716674392571292e+01, /* 0x4033A6B9, 0xBD707687 */ -sa2 = 1.37657754143519042600e+02, /* 0x4061350C, 0x526AE721 */ -sa3 = 4.34565877475229228821e+02, /* 0x407B290D, 0xD58A1A71 */ -sa4 = 6.45387271733267880336e+02, /* 0x40842B19, 0x21EC2868 */ -sa5 = 4.29008140027567833386e+02, /* 0x407AD021, 0x57700314 */ -sa6 = 1.08635005541779435134e+02, /* 0x405B28A3, 0xEE48AE2C */ -sa7 = 6.57024977031928170135e+00, /* 0x401A47EF, 0x8E484A93 */ -sa8 = -6.04244152148580987438e-02, /* 0xBFAEEFF2, 0xEE749A62 */ -/* - * Coefficients for approximation to erfc in [1/.35,28] - */ -rb0 = -9.86494292470009928597e-03, /* 0xBF843412, 0x39E86F4A */ -rb1 = -7.99283237680523006574e-01, /* 0xBFE993BA, 0x70C285DE */ -rb2 = -1.77579549177547519889e+01, /* 0xC031C209, 0x555F995A */ -rb3 = -1.60636384855821916062e+02, /* 0xC064145D, 0x43C5ED98 */ -rb4 = -6.37566443368389627722e+02, /* 0xC083EC88, 0x1375F228 */ -rb5 = -1.02509513161107724954e+03, /* 0xC0900461, 0x6A2E5992 */ -rb6 = -4.83519191608651397019e+02, /* 0xC07E384E, 0x9BDC383F */ -sb1 = 3.03380607434824582924e+01, /* 0x403E568B, 0x261D5190 */ -sb2 = 3.25792512996573918826e+02, /* 0x40745CAE, 0x221B9F0A */ -sb3 = 1.53672958608443695994e+03, /* 0x409802EB, 0x189D5118 */ -sb4 = 3.19985821950859553908e+03, /* 0x40A8FFB7, 0x688C246A */ -sb5 = 2.55305040643316442583e+03, /* 0x40A3F219, 0xCEDF3BE6 */ -sb6 = 4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */ -sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */ - -double -erf(double x) -{ - LONG hx,ix,i; - double R,S,P,Q,s,y,z,r; - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x7ff00000) { /* erf(nan)=nan */ - i = ((ULONG)hx>>31)<<1; - return (double)(1-i)+one/x; /* erf(+-inf)=+-1 */ - } - - if(ix < 0x3feb0000) { /* |x|<0.84375 */ - if(ix < 0x3e300000) { /* |x|<2**-28 */ - if (ix < 0x00800000) - return 0.125*(8.0*x+efx8*x); /*avoid underflow */ - return x + efx*x; - } - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - return x + x*y; - } - if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */ - s = fabs(x)-one; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); - if(hx>=0) return erx + P/Q; else return -erx - P/Q; - } - if (ix >= 0x40180000) { /* inf>|x|>=6 */ - if(hx>=0) return one-tiny; else return tiny-one; - } - x = fabs(x); - s = one/(x*x); - if(ix< 0x4006DB6E) { /* |x| < 1/0.35 */ - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); - } else { /* |x| >= 1/0.35 */ - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); - } - z = x; - SET_LOW_WORD(z,0); - r = exp(-z*z-0.5625)*exp((z-x)*(z+x)+R/S); - if(hx>=0) return one-r/x; else return r/x-one; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_erfc.c b/library/math_erfc.c deleted file mode 100644 index f5b180c..0000000 --- a/library/math_erfc.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * $Id: math_erfc.c,v 1.2 2005-05-29 14:45:29 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double -tiny = 1e-300, -half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ -two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */ - /* c = (float)0.84506291151 */ -erx = 8.45062911510467529297e-01, /* 0x3FEB0AC1, 0x60000000 */ -/* - * Coefficients for approximation to erf on [0,0.84375] - */ -efx = 1.28379167095512586316e-01, /* 0x3FC06EBA, 0x8214DB69 */ -efx8= 1.02703333676410069053e+00, /* 0x3FF06EBA, 0x8214DB69 */ -pp0 = 1.28379167095512558561e-01, /* 0x3FC06EBA, 0x8214DB68 */ -pp1 = -3.25042107247001499370e-01, /* 0xBFD4CD7D, 0x691CB913 */ -pp2 = -2.84817495755985104766e-02, /* 0xBF9D2A51, 0xDBD7194F */ -pp3 = -5.77027029648944159157e-03, /* 0xBF77A291, 0x236668E4 */ -pp4 = -2.37630166566501626084e-05, /* 0xBEF8EAD6, 0x120016AC */ -qq1 = 3.97917223959155352819e-01, /* 0x3FD97779, 0xCDDADC09 */ -qq2 = 6.50222499887672944485e-02, /* 0x3FB0A54C, 0x5536CEBA */ -qq3 = 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */ -qq4 = 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */ -qq5 = -3.96022827877536812320e-06, /* 0xBED09C43, 0x42A26120 */ -/* - * Coefficients for approximation to erf in [0.84375,1.25] - */ -pa0 = -2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */ -pa1 = 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */ -pa2 = -3.72207876035701323847e-01, /* 0xBFD7D240, 0xFBB8C3F1 */ -pa3 = 3.18346619901161753674e-01, /* 0x3FD45FCA, 0x805120E4 */ -pa4 = -1.10894694282396677476e-01, /* 0xBFBC6398, 0x3D3E28EC */ -pa5 = 3.54783043256182359371e-02, /* 0x3FA22A36, 0x599795EB */ -pa6 = -2.16637559486879084300e-03, /* 0xBF61BF38, 0x0A96073F */ -qa1 = 1.06420880400844228286e-01, /* 0x3FBB3E66, 0x18EEE323 */ -qa2 = 5.40397917702171048937e-01, /* 0x3FE14AF0, 0x92EB6F33 */ -qa3 = 7.18286544141962662868e-02, /* 0x3FB2635C, 0xD99FE9A7 */ -qa4 = 1.26171219808761642112e-01, /* 0x3FC02660, 0xE763351F */ -qa5 = 1.36370839120290507362e-02, /* 0x3F8BEDC2, 0x6B51DD1C */ -qa6 = 1.19844998467991074170e-02, /* 0x3F888B54, 0x5735151D */ -/* - * Coefficients for approximation to erfc in [1.25,1/0.35] - */ -ra0 = -9.86494403484714822705e-03, /* 0xBF843412, 0x600D6435 */ -ra1 = -6.93858572707181764372e-01, /* 0xBFE63416, 0xE4BA7360 */ -ra2 = -1.05586262253232909814e+01, /* 0xC0251E04, 0x41B0E726 */ -ra3 = -6.23753324503260060396e+01, /* 0xC04F300A, 0xE4CBA38D */ -ra4 = -1.62396669462573470355e+02, /* 0xC0644CB1, 0x84282266 */ -ra5 = -1.84605092906711035994e+02, /* 0xC067135C, 0xEBCCABB2 */ -ra6 = -8.12874355063065934246e+01, /* 0xC0545265, 0x57E4D2F2 */ -ra7 = -9.81432934416914548592e+00, /* 0xC023A0EF, 0xC69AC25C */ -sa1 = 1.96512716674392571292e+01, /* 0x4033A6B9, 0xBD707687 */ -sa2 = 1.37657754143519042600e+02, /* 0x4061350C, 0x526AE721 */ -sa3 = 4.34565877475229228821e+02, /* 0x407B290D, 0xD58A1A71 */ -sa4 = 6.45387271733267880336e+02, /* 0x40842B19, 0x21EC2868 */ -sa5 = 4.29008140027567833386e+02, /* 0x407AD021, 0x57700314 */ -sa6 = 1.08635005541779435134e+02, /* 0x405B28A3, 0xEE48AE2C */ -sa7 = 6.57024977031928170135e+00, /* 0x401A47EF, 0x8E484A93 */ -sa8 = -6.04244152148580987438e-02, /* 0xBFAEEFF2, 0xEE749A62 */ -/* - * Coefficients for approximation to erfc in [1/.35,28] - */ -rb0 = -9.86494292470009928597e-03, /* 0xBF843412, 0x39E86F4A */ -rb1 = -7.99283237680523006574e-01, /* 0xBFE993BA, 0x70C285DE */ -rb2 = -1.77579549177547519889e+01, /* 0xC031C209, 0x555F995A */ -rb3 = -1.60636384855821916062e+02, /* 0xC064145D, 0x43C5ED98 */ -rb4 = -6.37566443368389627722e+02, /* 0xC083EC88, 0x1375F228 */ -rb5 = -1.02509513161107724954e+03, /* 0xC0900461, 0x6A2E5992 */ -rb6 = -4.83519191608651397019e+02, /* 0xC07E384E, 0x9BDC383F */ -sb1 = 3.03380607434824582924e+01, /* 0x403E568B, 0x261D5190 */ -sb2 = 3.25792512996573918826e+02, /* 0x40745CAE, 0x221B9F0A */ -sb3 = 1.53672958608443695994e+03, /* 0x409802EB, 0x189D5118 */ -sb4 = 3.19985821950859553908e+03, /* 0x40A8FFB7, 0x688C246A */ -sb5 = 2.55305040643316442583e+03, /* 0x40A3F219, 0xCEDF3BE6 */ -sb6 = 4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */ -sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */ - -double -erfc(double x) -{ - LONG hx,ix; - double R,S,P,Q,s,y,z,r; - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x7ff00000) { /* erfc(nan)=nan */ - /* erfc(+-inf)=0,2 */ - return (double)(((ULONG)hx>>31)<<1)+one/x; - } - - if(ix < 0x3feb0000) { /* |x|<0.84375 */ - if(ix < 0x3c700000) /* |x|<2**-56 */ - return one-x; - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - if(hx < 0x3fd00000) { /* x<1/4 */ - return one-(x+x*y); - } else { - r = x*y; - r += (x-half); - return half - r ; - } - } - if(ix < 0x3ff40000) { /* 0.84375 <= |x| < 1.25 */ - s = fabs(x)-one; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); - if(hx>=0) { - z = one-erx; return z - P/Q; - } else { - z = erx+P/Q; return one+z; - } - } - if (ix < 0x403c0000) { /* |x|<28 */ - x = fabs(x); - s = one/(x*x); - if(ix< 0x4006DB6D) { /* |x| < 1/.35 ~ 2.857143*/ - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); - } else { /* |x| >= 1/.35 ~ 2.857143 */ - if(hx<0&&ix>=0x40180000) return two-tiny;/* x < -6 */ - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); - } - z = x; - SET_LOW_WORD(z,0); - r = exp(-z*z-0.5625)* - exp((z-x)*(z+x)+R/S); - if(hx>0) return r/x; else return two-r/x; - } else { - if(hx>0) return tiny*tiny; else return two-tiny; - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_erfcf.c b/library/math_erfcf.c deleted file mode 100644 index e9e099a..0000000 --- a/library/math_erfcf.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - * $Id: math_erfcf.c,v 1.2 2005-05-29 14:45:29 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -tiny = 1e-30, -half= 5.0000000000e-01, /* 0x3F000000 */ -one = 1.0000000000e+00, /* 0x3F800000 */ -two = 2.0000000000e+00, /* 0x40000000 */ - /* c = (subfloat)0.84506291151 */ -erx = 8.4506291151e-01, /* 0x3f58560b */ -/* - * Coefficients for approximation to erf on [0,0.84375] - */ -efx = 1.2837916613e-01, /* 0x3e0375d4 */ -efx8= 1.0270333290e+00, /* 0x3f8375d4 */ -pp0 = 1.2837916613e-01, /* 0x3e0375d4 */ -pp1 = -3.2504209876e-01, /* 0xbea66beb */ -pp2 = -2.8481749818e-02, /* 0xbce9528f */ -pp3 = -5.7702702470e-03, /* 0xbbbd1489 */ -pp4 = -2.3763017452e-05, /* 0xb7c756b1 */ -qq1 = 3.9791721106e-01, /* 0x3ecbbbce */ -qq2 = 6.5022252500e-02, /* 0x3d852a63 */ -qq3 = 5.0813062117e-03, /* 0x3ba68116 */ -qq4 = 1.3249473704e-04, /* 0x390aee49 */ -qq5 = -3.9602282413e-06, /* 0xb684e21a */ -/* - * Coefficients for approximation to erf in [0.84375,1.25] - */ -pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */ -pa1 = 4.1485610604e-01, /* 0x3ed46805 */ -pa2 = -3.7220788002e-01, /* 0xbebe9208 */ -pa3 = 3.1834661961e-01, /* 0x3ea2fe54 */ -pa4 = -1.1089469492e-01, /* 0xbde31cc2 */ -pa5 = 3.5478305072e-02, /* 0x3d1151b3 */ -pa6 = -2.1663755178e-03, /* 0xbb0df9c0 */ -qa1 = 1.0642088205e-01, /* 0x3dd9f331 */ -qa2 = 5.4039794207e-01, /* 0x3f0a5785 */ -qa3 = 7.1828655899e-02, /* 0x3d931ae7 */ -qa4 = 1.2617121637e-01, /* 0x3e013307 */ -qa5 = 1.3637083583e-02, /* 0x3c5f6e13 */ -qa6 = 1.1984500103e-02, /* 0x3c445aa3 */ -/* - * Coefficients for approximation to erfc in [1.25,1/0.35] - */ -ra0 = -9.8649440333e-03, /* 0xbc21a093 */ -ra1 = -6.9385856390e-01, /* 0xbf31a0b7 */ -ra2 = -1.0558626175e+01, /* 0xc128f022 */ -ra3 = -6.2375331879e+01, /* 0xc2798057 */ -ra4 = -1.6239666748e+02, /* 0xc322658c */ -ra5 = -1.8460508728e+02, /* 0xc3389ae7 */ -ra6 = -8.1287437439e+01, /* 0xc2a2932b */ -ra7 = -9.8143291473e+00, /* 0xc11d077e */ -sa1 = 1.9651271820e+01, /* 0x419d35ce */ -sa2 = 1.3765776062e+02, /* 0x4309a863 */ -sa3 = 4.3456588745e+02, /* 0x43d9486f */ -sa4 = 6.4538726807e+02, /* 0x442158c9 */ -sa5 = 4.2900814819e+02, /* 0x43d6810b */ -sa6 = 1.0863500214e+02, /* 0x42d9451f */ -sa7 = 6.5702495575e+00, /* 0x40d23f7c */ -sa8 = -6.0424413532e-02, /* 0xbd777f97 */ -/* - * Coefficients for approximation to erfc in [1/.35,28] - */ -rb0 = -9.8649431020e-03, /* 0xbc21a092 */ -rb1 = -7.9928326607e-01, /* 0xbf4c9dd4 */ -rb2 = -1.7757955551e+01, /* 0xc18e104b */ -rb3 = -1.6063638306e+02, /* 0xc320a2ea */ -rb4 = -6.3756646729e+02, /* 0xc41f6441 */ -rb5 = -1.0250950928e+03, /* 0xc480230b */ -rb6 = -4.8351919556e+02, /* 0xc3f1c275 */ -sb1 = 3.0338060379e+01, /* 0x41f2b459 */ -sb2 = 3.2579251099e+02, /* 0x43a2e571 */ -sb3 = 1.5367296143e+03, /* 0x44c01759 */ -sb4 = 3.1998581543e+03, /* 0x4547fdbb */ -sb5 = 2.5530502930e+03, /* 0x451f90ce */ -sb6 = 4.7452853394e+02, /* 0x43ed43a7 */ -sb7 = -2.2440952301e+01; /* 0xc1b38712 */ - -float -erfcf(float x) -{ - LONG hx,ix; - float R,S,P,Q,s,y,z,r; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x7f800000) { /* erfc(nan)=nan */ - /* erfc(+-inf)=0,2 */ - return (float)(((ULONG)hx>>31)<<1)+one/x; - } - - if(ix < 0x3f580000) { /* |x|<0.84375 */ - if(ix < 0x23800000) /* |x|<2**-56 */ - return one-x; - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - if(hx < 0x3e800000) { /* x<1/4 */ - return one-(x+x*y); - } else { - r = x*y; - r += (x-half); - return half - r ; - } - } - if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */ - s = fabsf(x)-one; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); - if(hx>=0) { - z = one-erx; return z - P/Q; - } else { - z = erx+P/Q; return one+z; - } - } - if (ix < 0x41e00000) { /* |x|<28 */ - x = fabsf(x); - s = one/(x*x); - if(ix< 0x4036DB6D) { /* |x| < 1/.35 ~ 2.857143*/ - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); - } else { /* |x| >= 1/.35 ~ 2.857143 */ - if(hx<0&&ix>=0x40c00000) return two-tiny;/* x < -6 */ - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); - } - GET_FLOAT_WORD(ix,x); - SET_FLOAT_WORD(z,ix&0xfffff000U); - r = expf(-z*z-(float)0.5625)* - expf((z-x)*(z+x)+R/S); - if(hx>0) return r/x; else return two-r/x; - } else { - if(hx>0) return tiny*tiny; else return two-tiny; - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_erff.c b/library/math_erff.c deleted file mode 100644 index 4710e09..0000000 --- a/library/math_erff.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * $Id: math_erff.c,v 1.2 2005-05-29 14:45:29 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -tiny = 1e-30, -half= 5.0000000000e-01, /* 0x3F000000 */ -one = 1.0000000000e+00, /* 0x3F800000 */ -two = 2.0000000000e+00, /* 0x40000000 */ - /* c = (subfloat)0.84506291151 */ -erx = 8.4506291151e-01, /* 0x3f58560b */ -/* - * Coefficients for approximation to erf on [0,0.84375] - */ -efx = 1.2837916613e-01, /* 0x3e0375d4 */ -efx8= 1.0270333290e+00, /* 0x3f8375d4 */ -pp0 = 1.2837916613e-01, /* 0x3e0375d4 */ -pp1 = -3.2504209876e-01, /* 0xbea66beb */ -pp2 = -2.8481749818e-02, /* 0xbce9528f */ -pp3 = -5.7702702470e-03, /* 0xbbbd1489 */ -pp4 = -2.3763017452e-05, /* 0xb7c756b1 */ -qq1 = 3.9791721106e-01, /* 0x3ecbbbce */ -qq2 = 6.5022252500e-02, /* 0x3d852a63 */ -qq3 = 5.0813062117e-03, /* 0x3ba68116 */ -qq4 = 1.3249473704e-04, /* 0x390aee49 */ -qq5 = -3.9602282413e-06, /* 0xb684e21a */ -/* - * Coefficients for approximation to erf in [0.84375,1.25] - */ -pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */ -pa1 = 4.1485610604e-01, /* 0x3ed46805 */ -pa2 = -3.7220788002e-01, /* 0xbebe9208 */ -pa3 = 3.1834661961e-01, /* 0x3ea2fe54 */ -pa4 = -1.1089469492e-01, /* 0xbde31cc2 */ -pa5 = 3.5478305072e-02, /* 0x3d1151b3 */ -pa6 = -2.1663755178e-03, /* 0xbb0df9c0 */ -qa1 = 1.0642088205e-01, /* 0x3dd9f331 */ -qa2 = 5.4039794207e-01, /* 0x3f0a5785 */ -qa3 = 7.1828655899e-02, /* 0x3d931ae7 */ -qa4 = 1.2617121637e-01, /* 0x3e013307 */ -qa5 = 1.3637083583e-02, /* 0x3c5f6e13 */ -qa6 = 1.1984500103e-02, /* 0x3c445aa3 */ -/* - * Coefficients for approximation to erfc in [1.25,1/0.35] - */ -ra0 = -9.8649440333e-03, /* 0xbc21a093 */ -ra1 = -6.9385856390e-01, /* 0xbf31a0b7 */ -ra2 = -1.0558626175e+01, /* 0xc128f022 */ -ra3 = -6.2375331879e+01, /* 0xc2798057 */ -ra4 = -1.6239666748e+02, /* 0xc322658c */ -ra5 = -1.8460508728e+02, /* 0xc3389ae7 */ -ra6 = -8.1287437439e+01, /* 0xc2a2932b */ -ra7 = -9.8143291473e+00, /* 0xc11d077e */ -sa1 = 1.9651271820e+01, /* 0x419d35ce */ -sa2 = 1.3765776062e+02, /* 0x4309a863 */ -sa3 = 4.3456588745e+02, /* 0x43d9486f */ -sa4 = 6.4538726807e+02, /* 0x442158c9 */ -sa5 = 4.2900814819e+02, /* 0x43d6810b */ -sa6 = 1.0863500214e+02, /* 0x42d9451f */ -sa7 = 6.5702495575e+00, /* 0x40d23f7c */ -sa8 = -6.0424413532e-02, /* 0xbd777f97 */ -/* - * Coefficients for approximation to erfc in [1/.35,28] - */ -rb0 = -9.8649431020e-03, /* 0xbc21a092 */ -rb1 = -7.9928326607e-01, /* 0xbf4c9dd4 */ -rb2 = -1.7757955551e+01, /* 0xc18e104b */ -rb3 = -1.6063638306e+02, /* 0xc320a2ea */ -rb4 = -6.3756646729e+02, /* 0xc41f6441 */ -rb5 = -1.0250950928e+03, /* 0xc480230b */ -rb6 = -4.8351919556e+02, /* 0xc3f1c275 */ -sb1 = 3.0338060379e+01, /* 0x41f2b459 */ -sb2 = 3.2579251099e+02, /* 0x43a2e571 */ -sb3 = 1.5367296143e+03, /* 0x44c01759 */ -sb4 = 3.1998581543e+03, /* 0x4547fdbb */ -sb5 = 2.5530502930e+03, /* 0x451f90ce */ -sb6 = 4.7452853394e+02, /* 0x43ed43a7 */ -sb7 = -2.2440952301e+01; /* 0xc1b38712 */ - -float -erff(float x) -{ - LONG hx,ix,i; - float R,S,P,Q,s,y,z,r; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix>=0x7f800000) { /* erf(nan)=nan */ - i = ((ULONG)hx>>31)<<1; - return (float)(1-i)+one/x; /* erf(+-inf)=+-1 */ - } - - if(ix < 0x3f580000) { /* |x|<0.84375 */ - if(ix < 0x31800000) { /* |x|<2**-28 */ - if (ix < 0x04000000) - /*avoid underflow */ - return (float)0.125*((float)8.0*x+efx8*x); - return x + efx*x; - } - z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); - y = r/s; - return x + x*y; - } - if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */ - s = fabsf(x)-one; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); - if(hx>=0) return erx + P/Q; else return -erx - P/Q; - } - if (ix >= 0x40c00000) { /* inf>|x|>=6 */ - if(hx>=0) return one-tiny; else return tiny-one; - } - x = fabsf(x); - s = one/(x*x); - if(ix< 0x4036DB6E) { /* |x| < 1/0.35 */ - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); - } else { /* |x| >= 1/0.35 */ - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); - } - GET_FLOAT_WORD(ix,x); - SET_FLOAT_WORD(z,ix&0xfffff000U); - r = expf(-z*z-(float)0.5625)*expf((z-x)*(z+x)+R/S); - if(hx>=0) return one-r/x; else return r/x-one; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_exp.c b/library/math_exp.c deleted file mode 100644 index 2cb74ed..0000000 --- a/library/math_exp.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * $Id: math_exp.c,v 1.4 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __exp(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___exp - -___exp: - - movel a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-78:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__exp(double x) -{ - double result; - - result = IEEEDPExp(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__exp(double x) -{ - double result; - - __asm ("fetox%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -static const double -one = 1.0, -halF[2] = {0.5,-0.5,}, -huge = 1.0e+300, -twom1000= 9.33263618503218878990e-302, /* 2**-1000=0x01700000,0*/ -o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */ -u_threshold= -7.45133219101941108420e+02, /* 0xc0874910, 0xD52D3051 */ -ln2HI[2] ={ 6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */ - -6.93147180369123816490e-01,}, /* 0xbfe62e42, 0xfee00000 */ -ln2LO[2] ={ 1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */ - -1.90821492927058770002e-10,}, /* 0xbdea39ef, 0x35793c76 */ -invln2 = 1.44269504088896338700e+00, /* 0x3ff71547, 0x652b82fe */ -P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */ -P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */ -P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */ -P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */ -P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ - -INLINE STATIC const double -__exp(double x) -{ - double y,hi,lo,c,t; - int k,xsb; - unsigned int hx; - - GET_HIGH_WORD(hx,x); - xsb = (hx>>31)&1; /* sign bit of x */ - hx &= 0x7fffffff; /* high word of |x| */ - - /* filter out non-finite argument */ - if(hx >= 0x40862E42) - { /* if |x|>=709.78... */ - if(hx>=0x7ff00000) - { - unsigned int lx; - - GET_LOW_WORD(lx,x); - if(((hx&0xfffff)|lx)!=0) - return x+x; /* NaN */ - else - return (xsb==0)? x:0.0; /* exp(+-inf)={inf,0} */ - } - if(x > o_threshold) - return huge*huge; /* overflow */ - if(x < u_threshold) - return twom1000*twom1000; /* underflow */ - } - - /* argument reduction */ - if(hx > 0x3fd62e42) - { /* if |x| > 0.5 ln2 */ - if(hx < 0x3FF0A2B2) - { /* and |x| < 1.5 ln2 */ - hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb; - } - else - { - k = (int)(invln2*x+halF[xsb]); - t = k; - hi = x - t*ln2HI[0]; /* t*ln2HI is exact here */ - lo = t*ln2LO[0]; - } - x = hi - lo; - } - else if(hx < 0x3e300000) - { /* when |x|<2**-28 */ - if(huge+x>one) - return one+x; /* trigger inexact */ - } - else - k = 0; - - /* x is now in primary range */ - t = x*x; - c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); - if(k==0) - return one-((x*c)/(c-2.0)-x); - else - y = one-((lo-(x*c)/(2.0-c))-hi); - - if(k >= -1021) - { - unsigned int hy; - GET_HIGH_WORD(hy,y); - SET_HIGH_WORD(y,hy+(k<<20)); /* add k to y's exponent */ - return y; - } - else - { - unsigned int hy; - GET_HIGH_WORD(hy,y); - SET_HIGH_WORD(y,hy+((k+1000)<<20)); /* add k to y's exponent */ - return y*twom1000; - } -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -exp(double x) -{ - double result; - - result = __exp(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_exp2.c b/library/math_exp2.c deleted file mode 100644 index f3f4bd1..0000000 --- a/library/math_exp2.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: math_exp2.c,v 1.2 2005-06-26 09:06:11 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -exp2(double x) -{ - return(pow(2.0, x)); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_exp2f.c b/library/math_exp2f.c deleted file mode 100644 index b7965ed..0000000 --- a/library/math_exp2f.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: math_exp2f.c,v 1.2 2005-06-26 09:06:11 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -exp2f(float x) -{ - return(powf(2.0, x)); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_expf.c b/library/math_expf.c deleted file mode 100644 index e688375..0000000 --- a/library/math_expf.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * $Id: math_expf.c,v 1.2 2005-05-29 14:45:29 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -one = 1.0, -halF[2] = {0.5,-0.5,}, -huge = 1.0e+30, -twom100 = 7.8886090522e-31, /* 2**-100=0x0d800000 */ -o_threshold= 8.872283911e+01, /* 0x42b17218 */ -u_threshold= -1.0397208405e+02, /* 0xc2cff1b5 */ -ln2HI[2] ={ 6.9313812256e-01, /* 0x3f317180 */ - -6.9313812256e-01,}, /* 0xbf317180 */ -ln2LO[2] ={ 9.0580006145e-06, /* 0x3717f7d1 */ - -9.0580006145e-06,}, /* 0xb717f7d1 */ -invln2 = 1.4426950216e+00, /* 0x3fb8aa3b */ -P1 = 1.6666667163e-01, /* 0x3e2aaaab */ -P2 = -2.7777778450e-03, /* 0xbb360b61 */ -P3 = 6.6137559770e-05, /* 0x388ab355 */ -P4 = -1.6533901999e-06, /* 0xb5ddea0e */ -P5 = 4.1381369442e-08; /* 0x3331bb4c */ - -float -expf(float x) -{ - float y,hi=0.0,lo=0.0,c,t; - LONG k=0,xsb; - ULONG hx; - - GET_FLOAT_WORD(hx,x); - xsb = (hx>>31)&1; /* sign bit of x */ - hx &= 0x7fffffff; /* high word of |x| */ - - /* filter out non-finite argument */ - if(hx >= 0x42b17218) { /* if |x|>=88.721... */ - if(hx == 0x42b17218) { /* if |x| == 88.7228... */ - if (xsb == 0) - return FLT_MAX; - } - if(hx>0x7f800000) - return x+x; /* NaN */ - if(hx==0x7f800000) - return (xsb==0)? x:0.0; /* exp(+-inf)={inf,0} */ - if(x > o_threshold) return huge*huge; /* overflow */ - if(x < u_threshold) return twom100*twom100; /* underflow */ - } - - /* argument reduction */ - if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ - if(hx < 0x3F851592) { /* and |x| < 1.5 ln2 */ - hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb; - } else { - k = invln2*x+halF[xsb]; - t = k; - hi = x - t*ln2HI[0]; /* t*ln2HI is exact here */ - lo = t*ln2LO[0]; - } - x = hi - lo; - } - else if(hx < 0x31800000) { /* when |x|<2**-28 */ - if(huge+x>one) return one+x;/* trigger inexact */ - } - else k = 0; - - /* x is now in primary range */ - t = x*x; - c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); - if(k==0) return one-((x*c)/(c-(float)2.0)-x); - else y = one-((lo-(x*c)/((float)2.0-c))-hi); - if(k >= -125) { - ULONG hy; - GET_FLOAT_WORD(hy,y); - SET_FLOAT_WORD(y,hy+(k<<23)); /* add k to y's exponent */ - return y; - } else { - ULONG hy; - GET_FLOAT_WORD(hy,y); - SET_FLOAT_WORD(y,hy+((k+100)<<23)); /* add k to y's exponent */ - return y*twom100; - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_expm1.c b/library/math_expm1.c deleted file mode 100644 index 55e3973..0000000 --- a/library/math_expm1.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * $Id: math_expm1.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double -one = 1.0, -huge = 1.0e+300, -tiny = 1.0e-300, -o_threshold = 7.09782712893383973096e+02,/* 0x40862E42, 0xFEFA39EF */ -ln2_hi = 6.93147180369123816490e-01,/* 0x3fe62e42, 0xfee00000 */ -ln2_lo = 1.90821492927058770002e-10,/* 0x3dea39ef, 0x35793c76 */ -invln2 = 1.44269504088896338700e+00,/* 0x3ff71547, 0x652b82fe */ - /* scaled coefficients related to expm1 */ -Q1 = -3.33333333333331316428e-02, /* BFA11111 111110F4 */ -Q2 = 1.58730158725481460165e-03, /* 3F5A01A0 19FE5585 */ -Q3 = -7.93650757867487942473e-05, /* BF14CE19 9EAADBB7 */ -Q4 = 4.00821782732936239552e-06, /* 3ED0CFCA 86E65239 */ -Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ - -double -expm1(double x) -{ - double y,hi,lo,c=0.0,t,e,hxs,hfx,r1; - LONG k,xsb; - ULONG hx; - - GET_HIGH_WORD(hx,x); - xsb = hx&0x80000000U; /* sign bit of x */ - if(xsb==0) y=x; else y= -x; /* y = |x| */ - hx &= 0x7fffffff; /* high word of |x| */ - - /* filter out huge and non-finite argument */ - if(hx >= 0x4043687A) { /* if |x|>=56*ln2 */ - if(hx >= 0x40862E42) { /* if |x|>=709.78... */ - if(hx>=0x7ff00000) { - ULONG low; - GET_LOW_WORD(low,x); - if(((hx&0xfffff)|low)!=0) - return x+x; /* NaN */ - else return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */ - } - if(x > o_threshold) return huge*huge; /* overflow */ - } - if(xsb!=0) { /* x < -56*ln2, return -1.0 with inexact */ - if(x+tiny<0.0) /* raise inexact */ - return tiny-one; /* return -1 */ - } - } - - /* argument reduction */ - if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ - if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */ - if(xsb==0) - {hi = x - ln2_hi; lo = ln2_lo; k = 1;} - else - {hi = x + ln2_hi; lo = -ln2_lo; k = -1;} - } else { - k = invln2*x+((xsb==0)?0.5:-0.5); - t = k; - hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ - lo = t*ln2_lo; - } - x = hi - lo; - c = (hi-x)-lo; - } - else if(hx < 0x3c900000) { /* when |x|<2**-54, return x */ - t = huge+x; /* return x with inexact flags when x!=0 */ - return x - (t-(huge+x)); - } - else k = 0; - - /* x is now in primary range */ - hfx = 0.5*x; - hxs = x*hfx; - r1 = one+hxs*(Q1+hxs*(Q2+hxs*(Q3+hxs*(Q4+hxs*Q5)))); - t = 3.0-r1*hfx; - e = hxs*((r1-t)/(6.0 - x*t)); - if(k==0) return x - (x*e-hxs); /* c is 0 */ - else { - e = (x*(e-c)-c); - e -= hxs; - if(k== -1) return 0.5*(x-e)-0.5; - if(k==1) { - if(x < -0.25) return -2.0*(e-(x+0.5)); - else return one+2.0*(x-e); - } - if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ - ULONG high; - y = one-(e-x); - GET_HIGH_WORD(high,y); - SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ - return y-one; - } - t = one; - if(k<20) { - ULONG high; - SET_HIGH_WORD(t,0x3ff00000 - (0x200000>>k)); /* t=1-2^-k */ - y = t-(e-x); - GET_HIGH_WORD(high,y); - SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ - } else { - ULONG high; - SET_HIGH_WORD(t,((0x3ff-k)<<20)); /* 2^-k */ - y = x-(e+t); - y += one; - GET_HIGH_WORD(high,y); - SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ - } - } - return y; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_expm1f.c b/library/math_expm1f.c deleted file mode 100644 index 9b6d7ad..0000000 --- a/library/math_expm1f.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * $Id: math_expm1f.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -one = 1.0, -huge = 1.0e+30, -tiny = 1.0e-30, -o_threshold = 8.8721679688e+01,/* 0x42b17180 */ -ln2_hi = 6.9313812256e-01,/* 0x3f317180 */ -ln2_lo = 9.0580006145e-06,/* 0x3717f7d1 */ -invln2 = 1.4426950216e+00,/* 0x3fb8aa3b */ - /* scaled coefficients related to expm1 */ -Q1 = -3.3333335072e-02, /* 0xbd088889 */ -Q2 = 1.5873016091e-03, /* 0x3ad00d01 */ -Q3 = -7.9365076090e-05, /* 0xb8a670cd */ -Q4 = 4.0082177293e-06, /* 0x36867e54 */ -Q5 = -2.0109921195e-07; /* 0xb457edbb */ - -float -expm1f(float x) -{ - float y,hi,lo,c=0.0,t,e,hxs,hfx,r1; - LONG k,xsb; - ULONG hx; - - GET_FLOAT_WORD(hx,x); - xsb = hx&0x80000000U; /* sign bit of x */ - if(xsb==0) y=x; else y= -x; /* y = |x| */ - hx &= 0x7fffffff; /* high word of |x| */ - - /* filter out huge and non-finite argument */ - if(hx >= 0x4195b844) { /* if |x|>=27*ln2 */ - if(hx >= 0x42b17218) { /* if |x|>=88.721... */ - if(hx>0x7f800000) - return x+x; /* NaN */ - if(hx==0x7f800000) - return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */ - if(x > o_threshold) return huge*huge; /* overflow */ - } - if(xsb!=0) { /* x < -27*ln2, return -1.0 with inexact */ - if(x+tiny<(float)0.0) /* raise inexact */ - return tiny-one; /* return -1 */ - } - } - - /* argument reduction */ - if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ - if(hx < 0x3F851592) { /* and |x| < 1.5 ln2 */ - if(xsb==0) - {hi = x - ln2_hi; lo = ln2_lo; k = 1;} - else - {hi = x + ln2_hi; lo = -ln2_lo; k = -1;} - } else { - k = invln2*x+((xsb==0)?(float)0.5:(float)-0.5); - t = k; - hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ - lo = t*ln2_lo; - } - x = hi - lo; - c = (hi-x)-lo; - } - else if(hx < 0x33000000) { /* when |x|<2**-25, return x */ - t = huge+x; /* return x with inexact flags when x!=0 */ - return x - (t-(huge+x)); - } - else k = 0; - - /* x is now in primary range */ - hfx = (float)0.5*x; - hxs = x*hfx; - r1 = one+hxs*(Q1+hxs*(Q2+hxs*(Q3+hxs*(Q4+hxs*Q5)))); - t = (float)3.0-r1*hfx; - e = hxs*((r1-t)/((float)6.0 - x*t)); - if(k==0) return x - (x*e-hxs); /* c is 0 */ - else { - e = (x*(e-c)-c); - e -= hxs; - if(k== -1) return (float)0.5*(x-e)-(float)0.5; - if(k==1) { - if(x < (float)-0.25) return -(float)2.0*(e-(x+(float)0.5)); - else return one+(float)2.0*(x-e); - } - if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ - LONG i; - y = one-(e-x); - GET_FLOAT_WORD(i,y); - SET_FLOAT_WORD(y,i+(k<<23)); /* add k to y's exponent */ - return y-one; - } - t = one; - if(k<23) { - LONG i; - SET_FLOAT_WORD(t,0x3f800000 - (0x1000000>>k)); /* t=1-2^-k */ - y = t-(e-x); - GET_FLOAT_WORD(i,y); - SET_FLOAT_WORD(y,i+(k<<23)); /* add k to y's exponent */ - } else { - LONG i; - SET_FLOAT_WORD(t,((0x7f-k)<<23)); /* 2^-k */ - y = x-(e+t); - y += one; - GET_FLOAT_WORD(i,y); - SET_FLOAT_WORD(y,i+(k<<23)); /* add k to y's exponent */ - } - } - return y; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_extendsfdf2.c b/library/math_extendsfdf2.c deleted file mode 100644 index 9e4266f..0000000 --- a/library/math_extendsfdf2.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: math_extendsfdf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___extendsfdf2 - -___extendsfdf2: - - movel a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - movel sp@(8),d0 - jsr a6@(-108:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_fabs.c b/library/math_fabs.c deleted file mode 100644 index 64a2fd9..0000000 --- a/library/math_fabs.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * $Id: math_fabs.c,v 1.6 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __fabs(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___fabs - -___fabs: - - movel a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-54:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__fabs(double x) -{ - double result; - - result = IEEEDPAbs(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__fabs(double x) -{ - double result; - - __asm ("fabs%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(__PPC__) - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -INLINE STATIC const double -__fabs(double x) -{ - double res; - - __asm volatile ("fabs %0, %1" - : "=f" (res) - : "f" (x)); - - return res; - -} - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__fabs(double x) -{ - double res; - - if(x < 0) - res = (-x); - else - res = x; - - return res; -} - -/****************************************************************************/ - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#endif /* __PPC__ */ - -/****************************************************************************/ - -double -fabs(double x) -{ - double result; - - result = __fabs(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_fabsf.c b/library/math_fabsf.c deleted file mode 100644 index 5268313..0000000 --- a/library/math_fabsf.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * $Id: math_fabsf.c,v 1.1 2005-05-08 08:51:29 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern float __fabsf(float x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeSingBasBase - .globl ___fabsf - -___fabsf: - - movel a6,sp@- - movel "A4(_MathIeeeSingBasBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-54:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const float -__fabsf(float x) -{ - float result; - - result = IEEESPAbs(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const float -__fabsf(float number) -{ - union ieee_single x; - - x.value = number; - - /* Knock off the sign bit. */ - x.raw[0] &= 0x7fffffff; - - return(x.value); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -float -fabsf(float x) -{ - float result; - - result = __fabsf(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_fdim.c b/library/math_fdim.c deleted file mode 100644 index 9c76d5d..0000000 --- a/library/math_fdim.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * $Id: math_fdim.c,v 1.2 2005-05-29 12:41:03 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -fdim(double x,double y) -{ - double result; - - if(x > y) - result = x - y; - else - result = 0; - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_fdimf.c b/library/math_fdimf.c deleted file mode 100644 index 89591d2..0000000 --- a/library/math_fdimf.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * $Id: math_fdimf.c,v 1.2 2005-05-29 12:41:03 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -fdimf(float x,float y) -{ - float result; - - if(x > y) - result = x - y; - else - result = 0; - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_fixdfsi.c b/library/math_fixdfsi.c deleted file mode 100644 index ffdab03..0000000 --- a/library/math_fixdfsi.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: math_fixdfsi.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___fixdfsi - -___fixdfsi: - - movel a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-30:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_fixsfsi.c b/library/math_fixsfsi.c deleted file mode 100644 index 8d21fc5..0000000 --- a/library/math_fixsfsi.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: math_fixsfsi.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -signed long -__fixsfsi(float x) -{ - signed long result; - - result = IEEESPFix(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_fixunsdfsi.c b/library/math_fixunsdfsi.c deleted file mode 100644 index 6d7f13a..0000000 --- a/library/math_fixunsdfsi.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * $Id: math_fixunsdfsi.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -unsigned long -__fixunsdfsi(double x) -{ - signed long result; - - if(x < 0.0) - result = 0; - else if (x >= 0x80000000UL) - result = (signed long)(x - 0x80000000UL) + 0x80000000UL; - else - result = (signed long)x; - - return((unsigned long)result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_fixunssfsi.c b/library/math_fixunssfsi.c deleted file mode 100644 index 3243648..0000000 --- a/library/math_fixunssfsi.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * $Id: math_fixunssfsi.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -unsigned long -__fixunssfsi(float x) -{ - signed long result; - - if(x < 0.0) - result = 0; - else if (x >= 0x80000000UL) - result = (signed long)(x - 0x80000000UL) + 0x80000000UL; - else - result = (signed long)x; - - return((unsigned long)result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_floatsidf.c b/library/math_floatsidf.c deleted file mode 100644 index c7b0f6a..0000000 --- a/library/math_floatsidf.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: math_floatsidf.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___floatsidf - -___floatsidf: - - movel a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - movel sp@(8),d0 - jsr a6@(-36:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_floatsisf.c b/library/math_floatsisf.c deleted file mode 100644 index 1189f44..0000000 --- a/library/math_floatsisf.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: math_floatsisf.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -float -__floatsisf(signed long x) -{ - float result; - - result = IEEESPFlt(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_floor.c b/library/math_floor.c deleted file mode 100644 index 8bf9104..0000000 --- a/library/math_floor.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * $Id: math_floor.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __floor(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___floor - -___floor: - - movel a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-90:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__floor(double x) -{ - double result; - - result = IEEEDPFloor(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__floor(double x) -{ - int rounding_mode, round_down; - double result; - - __asm __volatile ("fmove%.l fpcr,%0" - : "=dm" (rounding_mode) - : /* no inputs */ ); - - round_down = (rounding_mode & ~0x10) | 0x20; - - __asm __volatile ("fmove%.l %0,fpcr" - : /* no outputs */ - : "dmi" (round_down)); - - __asm __volatile ("fint%.x %1,%0" - : "=f" (result) - : "f" (x)); - - __asm __volatile ("fmove%.l %0,fpcr" - : /* no outputs */ - : "dmi" (rounding_mode)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -static const double huge = 1.0e300; -INLINE STATIC const double -__floor(double x) -{ - int i0,i1,j0; - unsigned int i,j; - - EXTRACT_WORDS(i0,i1,x); - - j0 = ((i0>>20)&0x7ff)-0x3ff; - - if(j0<20) - { - if(j0<0) - { - if(huge+x>0.0) - { - if(i0>=0) - { - i0=i1=0; - } - else if(((i0&0x7fffffff)|i1)!=0) - { - i0=0xbff00000; - i1=0; - } - } - } - else - { - i = (0x000fffff)>>j0; - - if(((i0&i)|i1)==0) - return x; - - if(huge+x>0.0) - { - if(i0<0) - i0 += (0x00100000)>>j0; - i0 &= (~i); i1=0; - } - } - } - else if (j0>51) - { - if(j0==0x400) - return x+x; - else - return x; - } - else - { - i = ((unsigned int)(0xffffffff))>>(j0-20); - - if((i1&i)==0) - return x; - - if(huge+x>0.0) - { - if(i0<0) - { - if(j0==20) - i0+=1; - else - { - j = i1+(1<<(52-j0)); - if(j - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float huge = 1.0e30; - -float -floorf(float x) -{ - LONG i0,j_0; - ULONG i; - GET_FLOAT_WORD(i0,x); - j_0 = ((i0>>23)&0xff)-0x7f; - if(j_0<23) { - if(j_0<0) { /* raise inexact if x != 0 */ - if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0>=0) {i0=0;} - else if((i0&0x7fffffff)!=0) - { i0=0xbf800000U;} - } - } else { - i = (0x007fffff)>>j_0; - if((i0&i)==0) return x; /* x is integral */ - if(huge+x>(float)0.0) { /* raise inexact flag */ - if(i0<0) i0 += (0x00800000)>>j_0; - i0 &= (~i); - } - } - } else { - if(j_0==0x80) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } - SET_FLOAT_WORD(x,i0); - return x; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_fma.c b/library/math_fma.c deleted file mode 100644 index 14a4ab0..0000000 --- a/library/math_fma.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_fma.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -fma(double x,double y,double z) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_fmaf.c b/library/math_fmaf.c deleted file mode 100644 index ce9660a..0000000 --- a/library/math_fmaf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_fmaf.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -fmaf(float x,float y,float z) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_fmax.c b/library/math_fmax.c deleted file mode 100644 index 3f15a48..0000000 --- a/library/math_fmax.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * $Id: math_fmax.c,v 1.2 2005-05-29 12:41:03 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -fmax(double x,double y) -{ - double result; - - if(isnan(x)) - { - if(isnan(y)) - result = nan(NULL); - else - result = y; - } - else if (isnan(y)) - { - result = x; - } - else - { - if(x > y) - result = x; - else - result = y; - } - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_fmaxf.c b/library/math_fmaxf.c deleted file mode 100644 index 6a3053b..0000000 --- a/library/math_fmaxf.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * $Id: math_fmaxf.c,v 1.2 2005-05-29 12:41:03 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -fmaxf(float x,float y) -{ - float result; - - if(isnan(x)) - { - if(isnan(y)) - result = nanf(NULL); - else - result = y; - } - else if (isnan(y)) - { - result = x; - } - else - { - if(x > y) - result = x; - else - result = y; - } - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_fmin.c b/library/math_fmin.c deleted file mode 100644 index 76a4118..0000000 --- a/library/math_fmin.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * $Id: math_fmin.c,v 1.2 2005-05-29 12:41:03 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -fmin(double x,double y) -{ - double result; - - if(isnan(x)) - { - if(isnan(y)) - result = nan(NULL); - else - result = y; - } - else if (isnan(y)) - { - result = x; - } - else - { - if(x < y) - result = x; - else - result = y; - } - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_fminf.c b/library/math_fminf.c deleted file mode 100644 index 6010f69..0000000 --- a/library/math_fminf.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * $Id: math_fminf.c,v 1.2 2005-05-29 12:41:03 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -fminf(float x,float y) -{ - float result; - - if(isnan(x)) - { - if(isnan(y)) - result = nanf(NULL); - else - result = y; - } - else if (isnan(y)) - { - result = x; - } - else - { - if(x < y) - result = x; - else - result = y; - } - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_fmod.c b/library/math_fmod.c deleted file mode 100644 index cff3787..0000000 --- a/library/math_fmod.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * $Id: math_fmod.c,v 1.5 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -INLINE STATIC const double -__fmod(double x,double y) -{ - double q,p,result; - - q = x / y; - - if(q < 0.0) - p = ceil(q) - q; - else - p = q - floor(q); - - result = p * y; - - return(result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__fmod(double x,double y) -{ - double result; - - __asm ("fmod%.x %2,%0" - : "=f" (result) - : "0" (x), - "f" (y)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -static const double -one = 1.0, -Zero[] = {0.0, -0.0,}; - -INLINE STATIC const double -__fmod(double x,double y) -{ - int n,hx,hy,hz,ix,iy,sx,i; - unsigned int lx,ly,lz; - - EXTRACT_WORDS(hx,lx,x); - EXTRACT_WORDS(hy,ly,y); - - sx = hx&0x80000000; /* sign of x */ - hx ^=sx; /* |x| */ - hy &= 0x7fffffff; /* |y| */ - - /* purge off exception values */ - if((hy|ly)==0||(hx>=0x7ff00000)|| /* y=0,or x not finite */ - ((hy|((ly|-ly)>>31))>0x7ff00000)) /* or y is NaN */ - return (x*y)/(x*y); - if(hx<=hy) - { - if((hx>31]; /* |x|=|y| return x*0*/ - } - - /* determine ix = ilogb(x) */ - if(hx<0x00100000) /* subnormal x */ - { - if(hx==0) - { - for (ix = -1043, i=lx; i>0; i<<=1) - ix -=1; - } - else - { - for (ix = -1022,i=(hx<<11); i>0; i<<=1) - ix -=1; - } - } - else - ix = (hx>>20)-1023; - - /* determine iy = ilogb(y) */ - if(hy<0x00100000) /* subnormal y */ - { - if(hy==0) - { - for (iy = -1043, i=ly; i>0; i<<=1) - iy -=1; - } - else - { - for (iy = -1022,i=(hy<<11); i>0; i<<=1) - iy -=1; - } - } - else - iy = (hy>>20)-1023; - - /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -1022) - hx = 0x00100000|(0x000fffff&hx); - else /* subnormal x, shift x to normal */ - { - n = -1022-ix; - if(n<=31) - { - hx = (hx<>(32-n)); - lx <<= n; - } - else - { - hx = lx<<(n-32); - lx = 0; - } - } - - if(iy >= -1022) - hy = 0x00100000|(0x000fffff&hy); - else /* subnormal y, shift y to normal */ - { - n = -1022-iy; - if(n<=31) - { - hy = (hy<>(32-n)); - ly <<= n; - } - else - { - hy = ly<<(n-32); - ly = 0; - } - } - - /* fix point fmod */ - n = ix - iy; - while(n--) - { - hz=hx-hy;lz=lx-ly; - if(lx>31); - lx = lx+lx; - } - else - { - if((hz|lz)==0) /* return sign(x)*0 */ - return Zero[(unsigned int)sx>>31]; - hx = hz+hz+(lz>>31); - lx = lz+lz; - } - } - - hz=hx-hy; - lz=lx-ly; - - if(lx=0) - { - hx=hz; - lx=lz; - } - - /* convert back to floating value and restore the sign */ - if((hx|lx)==0) /* return sign(x)*0 */ - return Zero[(unsigned int)sx>>31]; - while(hx<0x00100000) /* normalize x */ - { - hx = hx+hx+(lx>>31); - lx = lx+lx; - iy -= 1; - } - - if(iy>= -1022) /* normalize output */ - { - hx = ((hx-0x00100000)|((iy+1023)<<20)); - INSERT_WORDS(x,hx|sx,lx); - } - else - { /* subnormal output */ - n = -1022 - iy; - if(n<=20) - { - lx = (lx>>n)|((unsigned int)hx<<(32-n)); - hx >>= n; - } - else - if (n<=31) - { - lx = (hx<<(32-n))|(lx>>n); - hx = sx; - } - else - { - lx = hx>>(n-32); hx = sx; - } - - INSERT_WORDS(x,hx|sx,lx); - x *= one; /* create necessary signal */ - } - return x; /* exact output */ -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -fmod(double x,double y) -{ - double result; - - if(y != 0.0) - { - result = __fmod(x,y); - } - else - { - result = x; - __set_errno(EDOM); - } - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_fmodf.c b/library/math_fmodf.c deleted file mode 100644 index 9b045f6..0000000 --- a/library/math_fmodf.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * $Id: math_fmodf.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float one = 1.0; - -float -modff(float x, float *iptr) -{ - LONG i0,j_0; - ULONG i; - GET_FLOAT_WORD(i0,x); - j_0 = ((i0>>23)&0xff)-0x7f; /* exponent of x */ - if(j_0<23) { /* integer part in x */ - if(j_0<0) { /* |x|<1 */ - SET_FLOAT_WORD(*iptr,i0&0x80000000U); /* *iptr = +-0 */ - return x; - } else { - i = (0x007fffff)>>j_0; - if((i0&i)==0) { /* x is integral */ - ULONG ix; - *iptr = x; - GET_FLOAT_WORD(ix,x); - SET_FLOAT_WORD(x,ix&0x80000000U); /* return +-0 */ - return x; - } else { - SET_FLOAT_WORD(*iptr,i0&(~i)); - return x - *iptr; - } - } - } else { /* no fraction part */ - ULONG ix; - *iptr = x*one; - GET_FLOAT_WORD(ix,x); - SET_FLOAT_WORD(x,ix&0x80000000U); /* return +-0 */ - return x; - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_fp_support.h b/library/math_fp_support.h deleted file mode 100644 index bcc9a08..0000000 --- a/library/math_fp_support.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * $Id: math_fp_support.h,v 1.4 2005-05-14 10:52:31 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_FP_SUPPORT_H -#define _MATH_FP_SUPPORT_H - -/****************************************************************************/ - -/* If any of the three supported floating point support flavours is - enabled, make sure that the generic 'FLOATING_POINT_SUPPORT' symbol - is defined, too.*/ -#if (defined(IEEE_FLOATING_POINT_SUPPORT) || defined(M68881_FLOATING_POINT_SUPPORT) || defined(PPC_FLOATING_POINT_SUPPORT)) -#define FLOATING_POINT_SUPPORT -#endif /* IEEE_FLOATING_POINT_SUPPORT || M68881_FLOATING_POINT_SUPPORT || PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -/* This selects whether or not the 'long double' type should be used. So far, - only 'double' can be supported, and 'long double' defaults to 'double'. */ -/*#define USE_LONG_DOUBLE*/ - -/****************************************************************************/ - -#if defined(USE_LONG_DOUBLE) - typedef long double __long_double_t; -#else - typedef double __long_double_t; -#endif /* USE_LONG_DOUBLE */ - -/****************************************************************************/ - -/* 'Portable' raw representations of three IEEE floating point formats. */ -union ieee_long_double -{ - long double value; - unsigned long raw[3]; -}; - -union ieee_double -{ - double value; - unsigned long raw[2]; -}; - -union ieee_single -{ - float value; - unsigned long raw[1]; -}; - -/****************************************************************************/ - -extern float __inff(void); -extern double __inf(void); - -/****************************************************************************/ - -#endif /* _MATH_FP_SUPPORT_H */ diff --git a/library/math_fpclassify.c b/library/math_fpclassify.c deleted file mode 100644 index e36132f..0000000 --- a/library/math_fpclassify.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * $Id: math_fpclassify.c,v 1.3 2005-05-14 10:52:31 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#if defined (FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -int -__fpclassify_float(float number) -{ - union ieee_single x; - int result; - - x.value = number; - - D(("number = 0x%08lx",x.raw[0])); - - if((x.raw[0] & 0x7f800000) == 0x7f800000 && (x.raw[0] & 0x007fffff) != 0) - { - SHOWMSG("not a number"); - - /* Exponent = 255 and fraction != 0.0 -> not a number */ - result = FP_NAN; - } - else if ((x.raw[0] & 0x7fffffff) == 0x7f800000) - { - SHOWMSG("infinity"); - - /* Exponent = 255 and fraction = 0.0 -> infinity */ - result = FP_INFINITE; - } - else if ((x.raw[0] & 0x7fffffff) == 0) - { - SHOWMSG("zero"); - - /* Both exponent and fraction are zero -> zero */ - result = FP_ZERO; - } - else if ((x.raw[0] & 0x7f800000) == 0) - { - SHOWMSG("subnormal"); - - /* Exponent = 0 -> subnormal (IEEE 754) */ - result = FP_SUBNORMAL; - } - else - { - SHOWMSG("normal"); - - result = FP_NORMAL; - } - - SHOWVALUE(result); - - return(result); -} - -/****************************************************************************/ - -int -__fpclassify_double(double number) -{ - union ieee_double x; - int result; - - x.value = number; - - D(("number = 0x%08lx%08lx",x.raw[0],x.raw[1])); - - if(((x.raw[0] & 0x7ff00000) == 0x7ff00000) && ((x.raw[0] & 0x000fffff) != 0 || (x.raw[1] != 0))) - { - SHOWMSG("not a number"); - - /* Exponent = 2047 and fraction != 0.0 -> not a number */ - result = FP_NAN; - } - else if (((x.raw[0] & 0x7fffffff) == 0x7ff00000) && (x.raw[1] == 0)) - { - SHOWMSG("infinity"); - - /* Exponent = 2047 and fraction = 0.0 -> infinity */ - result = FP_INFINITE; - } - else if ((((x.raw[0] & 0x7fffffff) == 0) && (x.raw[1] == 0))) - { - SHOWMSG("zero"); - - /* Both exponent and fraction are zero -> zero */ - result = FP_ZERO; - } - else if ((x.raw[0] & 0x7fff0000) == 0) - { - SHOWMSG("subnormal"); - - /* Exponent = 0 -> subnormal (IEEE 754) */ - result = FP_SUBNORMAL; - } - else - { - SHOWMSG("normal"); - - result = FP_NORMAL; - } - - SHOWVALUE(result); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_frexp.c b/library/math_frexp.c deleted file mode 100644 index 8510039..0000000 --- a/library/math_frexp.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * $Id: math_frexp.c,v 1.4 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _STDLIB_NULL_POINTER_CHECK_H -#include "stdlib_null_pointer_check.h" -#endif /* _STDLIB_NULL_POINTER_CHECK_H */ - -/****************************************************************************/ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__frexp(double x,int * nptr) -{ - int int_exponent = 0; - BOOL is_negative; - - if(x < 0) - { - is_negative = TRUE; - - x = (-x); - } - else - { - is_negative = FALSE; - } - - if(x >= 1) - { - while(x >= 1) - { - int_exponent++; - x /= 2; - } - } - else if (0 < x && x < 0.5) - { - while(x < 0.5) - { - int_exponent--; - x *= 2; - } - } - - (*nptr) = int_exponent; - - if(is_negative) - x = (-x); - - return(x); -} - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__frexp(double x,int * nptr) -{ - double float_exponent; - int int_exponent; - double mantissa; - - __asm ("fgetexp%.x %1,%0" - : "=f" (float_exponent) /* integer-valued float */ - : "f" (x)); - - int_exponent = (int)float_exponent; - - __asm ("fgetman%.x %1,%0" - : "=f" (mantissa) /* 1.0 <= mantissa < 2.0 */ - : "f" (x)); - - if (mantissa != 0) - { - __asm ("fscale%.b %#-1,%0" - : "=f" (mantissa) /* mantissa /= 2.0 */ - : "0" (mantissa)); - - int_exponent += 1; - } - - (*nptr) = int_exponent; - - return(mantissa); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -static const double -two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */ - -INLINE STATIC const double -__frexp(double x,int * eptr) -{ - int hx, ix, lx; - - EXTRACT_WORDS(hx,lx,x); - - ix = 0x7fffffff&hx; - *eptr = 0; - - if(ix>=0x7ff00000||((ix|lx)==0)) - return x; /* 0,inf,nan */ - if (ix<0x00100000) /* subnormal */ - { - x *= two54; - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; - *eptr = -54; - } - - *eptr += (ix>>20)-1022; - - hx = (hx&0x800fffff)|0x3fe00000; - SET_HIGH_WORD(x,hx); - - return x; -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -frexp(double x,int *nptr) -{ - double result; - - assert( nptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(nptr == NULL) - { - __set_errno(EFAULT); - - result = __get_huge_val(); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(x != 0.0) - { - result = __frexp(x,nptr); - } - else - { - result = 0.0; - - (*nptr) = 0; - } - - out: - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_frexpf.c b/library/math_frexpf.c deleted file mode 100644 index e51b97f..0000000 --- a/library/math_frexpf.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * $Id: math_frexpf.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float two25 = 3.3554432000e+07; /* 0x4c000000 */ - -float -frexpf(float x, int *eptr) -{ - LONG hx, ix; - GET_FLOAT_WORD(hx,x); - ix = 0x7fffffff&hx; - *eptr = 0; - if(ix>=0x7f800000||(ix==0)) return x; /* 0,inf,nan */ - if (ix<0x00800000) { /* subnormal */ - x *= two25; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - *eptr = -25; - } - *eptr += (ix>>23)-126; - hx = (hx&0x807fffffU)|0x3f000000; - SET_FLOAT_WORD(x,hx); - return x; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_gedf2.c b/library/math_gedf2.c deleted file mode 100644 index 67c1fc2..0000000 --- a/library/math_gedf2.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: math_gedf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___gedf2 - -___gedf2: - - moveml d2/d3/a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(16),d0/d1/d2/d3 - jsr a6@(-42:W) - moveml sp@+,d2/d3/a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_gesf2.c b/library/math_gesf2.c deleted file mode 100644 index c46589f..0000000 --- a/library/math_gesf2.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: math_gesf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -float -__gesf2(float x,float y) -{ - float result; - - result = IEEESPCmp(x,y); - - return(result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_gtdf2.c b/library/math_gtdf2.c deleted file mode 100644 index 672aa25..0000000 --- a/library/math_gtdf2.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: math_gtdf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___gtdf2 - -___gtdf2: - - moveml d2/d3/a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(16),d0/d1/d2/d3 - jsr a6@(-42:W) - moveml sp@+,d2/d3/a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_gtsf2.c b/library/math_gtsf2.c deleted file mode 100644 index ac66b36..0000000 --- a/library/math_gtsf2.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: math_gtsf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -float -__gtsf2(float x,float y) -{ - float result; - - result = IEEESPCmp(x,y); - - return(result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_headers.h b/library/math_headers.h deleted file mode 100644 index a81ca7f..0000000 --- a/library/math_headers.h +++ /dev/null @@ -1,236 +0,0 @@ -/* - * $Id: math_headers.h,v 1.11 2005-05-30 08:10:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#define _MATH_HEADERS_H - -/****************************************************************************/ - -#include -#include -#include -#include - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_H */ - -#ifndef _DEBUG_H -#include "debug.h" -#endif /* _DEBUG_H */ - -/****************************************************************************/ - -#ifndef _MATH_FP_SUPPORT_H -#include "math_fp_support.h" -#endif /* _MATH_FP_SUPPORT_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#ifndef PROTO_MATHIEEESINGBAS_H -#include -#endif /* PROTO_MATHIEEESINGBAS_H */ - -#ifndef PROTO_MATHIEEEDOUBBAS_H -#include -#endif /* PROTO_MATHIEEEDOUBBAS_H */ - -#ifndef PROTO_MATHIEEEDOUBTRANS_H -#include -#endif /* PROTO_MATHIEEEDOUBTRANS_H */ - -/****************************************************************************/ - -extern struct Library * NOCOMMON MathIeeeSingBasBase; -extern struct Library * NOCOMMON MathIeeeDoubBasBase; -extern struct Library * NOCOMMON MathIeeeDoubTransBase; - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#define FLT_UWORD_IS_ZERO(x) ((x)==0) -#define FLT_UWORD_IS_SUBNORMAL(x) ((x)<0x00800000L) -#define FLT_UWORD_MIN 0x00000001 -#define FLT_UWORD_EXP_MIN 0x43160000 -#define FLT_UWORD_LOG_MIN 0x42cff1b5 -#define FLT_SMALLEST_EXP -22 - -typedef union -{ - double value; - struct - { - unsigned int msw; - unsigned int lsw; - } parts; -} ieee_double_shape_type; - -#define EXTRACT_WORDS(ix0,ix1,d) \ -do { \ - ieee_double_shape_type ew_u; \ - ew_u.value = (d); \ - (ix0) = ew_u.parts.msw; \ - (ix1) = ew_u.parts.lsw; \ -} while (0) - -/* Get the more significant 32 bit int from a double. */ - -#define GET_HIGH_WORD(i,d) \ -do { \ - ieee_double_shape_type gh_u; \ - gh_u.value = (d); \ - (i) = gh_u.parts.msw; \ -} while (0) - -/* Get the less significant 32 bit int from a double. */ - -#define GET_LOW_WORD(i,d) \ -do { \ - ieee_double_shape_type gl_u; \ - gl_u.value = (d); \ - (i) = gl_u.parts.lsw; \ -} while (0) - -/* Set a double from two 32 bit ints. */ - -#define INSERT_WORDS(d,ix0,ix1) \ -do { \ - ieee_double_shape_type iw_u; \ - iw_u.parts.msw = (ix0); \ - iw_u.parts.lsw = (ix1); \ - (d) = iw_u.value; \ -} while (0) - -/* Set the more significant 32 bits of a double from an int. */ - -#define SET_HIGH_WORD(d,v) \ -do { \ - ieee_double_shape_type sh_u; \ - sh_u.value = (d); \ - sh_u.parts.msw = (v); \ - (d) = sh_u.value; \ -} while (0) - -/* Set the less significant 32 bits of a double from an int. */ - -#define SET_LOW_WORD(d,v) \ -do { \ - ieee_double_shape_type sl_u; \ - sl_u.value = (d); \ - sl_u.parts.lsw = (v); \ - (d) = sl_u.value; \ -} while (0) - -/* A union which permits us to convert between a float and a 32 bit - int. */ - -typedef union -{ - float value; - unsigned int word; -} ieee_float_shape_type; - -/* Get a 32 bit int from a float. */ - -#define GET_FLOAT_WORD(i,d) \ -do { \ - ieee_float_shape_type gf_u; \ - gf_u.value = (d); \ - (i) = gf_u.word; \ -} while (0) - -/* Set a float from a 32 bit int. */ - -#define SET_FLOAT_WORD(d,i) \ -do { \ - ieee_float_shape_type sf_u; \ - sf_u.word = (i); \ - (d) = sf_u.value; \ -} while (0) - -extern double __kernel_cos(double x, double y); -extern double __kernel_sin(double x, double y, int iy); -extern int __rem_pio2(double x, double *y); -extern double __kernel_tan(double x, double y, int iy); -extern double __expm1(double x); -extern double __scalbn(double x, int n); -extern float __kernel_cosf(float x, float y); -extern float __kernel_sinf(float x, float y, int iy); -extern LONG __rem_pio2f(float x, float *y); -extern float __kernel_tanf(float x, float y, int iy); - -/****************************************************************************/ - -/* math_huge_val.c */ -extern double __get_huge_val(void); - -/****************************************************************************/ - -/* math_huge_valf.c */ -extern float __get_huge_valf(void); - -/****************************************************************************/ - -#endif /* _MATH_HEADERS_H */ diff --git a/library/math_huge_val.c b/library/math_huge_val.c deleted file mode 100644 index a1dde11..0000000 --- a/library/math_huge_val.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: math_huge_val.c,v 1.1 2005-02-03 16:56:15 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -double -__get_huge_val(void) -{ - return(__huge_val); -} diff --git a/library/math_huge_valf.c b/library/math_huge_valf.c deleted file mode 100644 index dad4910..0000000 --- a/library/math_huge_valf.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: math_huge_valf.c,v 1.1 2005-05-07 17:03:55 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -float -__get_huge_valf(void) -{ - return(__huge_val_float); -} diff --git a/library/math_hypot.c b/library/math_hypot.c deleted file mode 100644 index f67692e..0000000 --- a/library/math_hypot.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * $Id: math_hypot.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) || defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__hypot(double x,double y) -{ - double yx; - - x = fabs(x); - y = fabs(y); - if ( x < y ) - { - double temp = x; - x = y; - y = temp; - } - - if (x == 0.) - { - return 0.; - } - else - { - yx = y/x; - return x*sqrt(1. + yx*yx); - } -} - -#endif /* IEEE_FLOATING_POINT_SUPPORT || M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -static const double one = 1.0; - -INLINE STATIC const double -__hypot(double x,double y) -{ - int n0; - double a=x,b=y,t1,t2,y1,y2,w; - int j,k,ha,hb; - - n0 = ((*(int*)&one)>>29)^1; /* high word index */ - ha = *(n0+(int*)&x)&0x7fffffff; /* high word of x */ - hb = *(n0+(int*)&y)&0x7fffffff; /* high word of y */ - if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;} - *(n0+(int*)&a) = ha; /* a <- |a| */ - *(n0+(int*)&b) = hb; /* b <- |b| */ - if((ha-hb)>0x3c00000) {return a+b;} /* x/y > 2**60 */ - k=0; - if(ha > 0x5f300000) { /* a>2**500 */ - if(ha >= 0x7ff00000) { /* Inf or NaN */ - w = a+b; /* for sNaN */ - if(((ha&0xfffff)|*(1-n0+(int*)&a))==0) w = a; - if(((hb^0x7ff00000)|*(1-n0+(int*)&b))==0) w = b; - return w; - } - /* scale a and b by 2**-600 */ - ha -= 0x25800000; hb -= 0x25800000; k += 600; - *(n0+(int*)&a) = ha; - *(n0+(int*)&b) = hb; - } - if(hb < 0x20b00000) { /* b < 2**-500 */ - if(hb <= 0x000fffff) { /* subnormal b or 0 */ - if((hb|(*(1-n0+(int*)&b)))==0) return a; - t1=0; - *(n0+(int*)&t1) = 0x7fd00000; /* t1=2^1022 */ - b *= t1; - a *= t1; - k -= 1022; - } else { /* scale a and b by 2^600 */ - ha += 0x25800000; /* a *= 2^600 */ - hb += 0x25800000; /* b *= 2^600 */ - k -= 600; - *(n0+(int*)&a) = ha; - *(n0+(int*)&b) = hb; - } - } - /* medium size a and b */ - w = a-b; - if (w>b) { - t1 = 0; - *(n0+(int*)&t1) = ha; - t2 = a-t1; - w = sqrt(t1*t1-(b*(-b)-t2*(a+t1))); - } else { - a = a+a; - y1 = 0; - *(n0+(int*)&y1) = hb; - y2 = b - y1; - t1 = 0; - *(n0+(int*)&t1) = ha+0x00100000; - t2 = a - t1; - w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); - } - if(k!=0) { - t1 = 1.0; - *(n0+(int*)&t1) += (k<<20); - return t1*w; - } else return w; -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -hypot(double x,double y) -{ - double result; - - result = __hypot(x,y); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_hypotf.c b/library/math_hypotf.c deleted file mode 100644 index a2120b2..0000000 --- a/library/math_hypotf.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * $Id: math_hypotf.c,v 1.2 2005-05-30 08:10:38 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#define SQRT_FLT_MAX 1.84467429742e+19 /* 0x5f7fffff */ - -float -hypotf(float x, float y) -{ - float a=x,b=y,t1,t2,w; - LONG j,ha,hb; - - if (isunordered(x,y)) - return (x-x)/(y-y); - if (!isfinite(x) || !isfinite(y)) { - __set_errno(ERANGE); - return __get_huge_valf(); - } - - GET_FLOAT_WORD(ha,x); - ha &= 0x7fffffff; - GET_FLOAT_WORD(hb,y); - hb &= 0x7fffffff; - if(hb < ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;} - SET_FLOAT_WORD(a,ha); /* a <- |a| */ - SET_FLOAT_WORD(b,hb); /* b <- |b| */ - t1 = (a > 0) ? (a/b) : 0; - if ((t1 >= SQRT_FLT_MAX) && isfinite(x) && isfinite(y)) { - __set_errno(ERANGE); - return __get_huge_valf(); - } - t1 *= t1; - t2 = sqrtf(++t1); - if ((t2 > 1) && (b >= FLT_MAX)) { - __set_errno(ERANGE); - return __get_huge_valf(); - } - w = t2 * b; - - return w; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_ilogb.c b/library/math_ilogb.c deleted file mode 100644 index 4b293b7..0000000 --- a/library/math_ilogb.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $Id: math_ilogb.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -int -ilogb(double x) -{ - LONG hx,lx,ix; - - EXTRACT_WORDS(hx,lx,x); - hx &= 0x7fffffff; - if(hx<0x00100000) { - if((hx|lx)==0) - return - INT_MAX; /* ilogb(0) = 0x80000001 */ - else /* subnormal x */ - if(hx==0) { - for (ix = -1043; lx>0; lx<<=1) ix -=1; - } else { - for (ix = -1022,hx<<=11; hx>0; hx<<=1) ix -=1; - } - return ix; - } - else if (hx<0x7ff00000) return (hx>>20)-1023; - else return INT_MAX; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_ilogbf.c b/library/math_ilogbf.c deleted file mode 100644 index 7520166..0000000 --- a/library/math_ilogbf.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * $Id: math_ilogbf.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -int -ilogbf(float x) -{ - LONG hx,ix; - - GET_FLOAT_WORD(hx,x); - hx &= 0x7fffffff; - if(hx<0x00800000) { - if(hx==0) - return - INT_MAX; /* ilogb(0) = 0x80000001 */ - else /* subnormal x */ - for (ix = -126,hx<<=8; hx>0; hx<<=1) ix -=1; - return ix; - } - else if (hx<0x7f800000) return (hx>>23)-127; - else return INT_MAX; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_inf.c b/library/math_inf.c deleted file mode 100644 index 8267d17..0000000 --- a/library/math_inf.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * $Id: math_inf.c,v 1.1 2005-05-14 10:52:31 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#if defined (FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -double -__inf(void) -{ - union ieee_double x; - - /* Exponent = 2047 and fraction = 0.0 -> infinity */ - x.raw[0] = 0x7ff00000; - x.raw[1] = 0x00000000; - - return(x.value); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_inff.c b/library/math_inff.c deleted file mode 100644 index 867a8cb..0000000 --- a/library/math_inff.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * $Id: math_inff.c,v 1.1 2005-05-14 10:52:31 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#if defined (FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -float -__inff(void) -{ - union ieee_single x; - - /* Exponent = 255 and fraction = 0.0 -> infinity */ - x.raw[0] = 0x7f800000; - - return(x.value); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_init_exit.c b/library/math_init_exit.c deleted file mode 100644 index 2d8b8ec..0000000 --- a/library/math_init_exit.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * $Id: math_init_exit.c,v 1.18 2005-07-03 10:36:46 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -#ifndef EXEC_EXECBASE_H -#include -#endif /* EXEC_EXECBASE_H */ - -/****************************************************************************/ - -#ifndef PROTO_EXEC_H -#include -#endif /* PROTO_EXEC_H */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -struct Library * NOCOMMON MathIeeeSingBasBase; -struct Library * NOCOMMON MathIeeeDoubBasBase; -struct Library * NOCOMMON MathIeeeDoubTransBase; - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -float NOCOMMON __infinity; -float NOCOMMON __nan; - -/****************************************************************************/ - -float NOCOMMON __huge_val_float; -double NOCOMMON __huge_val; - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -MATH_DESTRUCTOR(math_exit) -{ - ENTER(); - - if(MathIeeeSingBasBase != NULL) - { - CloseLibrary(MathIeeeSingBasBase); - MathIeeeSingBasBase = NULL; - } - - if(MathIeeeDoubBasBase != NULL) - { - CloseLibrary(MathIeeeDoubBasBase); - MathIeeeDoubBasBase = NULL; - } - - if(MathIeeeDoubTransBase != NULL) - { - CloseLibrary(MathIeeeDoubTransBase); - MathIeeeDoubTransBase = NULL; - } - - LEAVE(); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -MATH_CONSTRUCTOR(math_init) -{ - union ieee_double * double_x; - union ieee_single * single_x; - BOOL success = FALSE; - - ENTER(); - - #if defined(M68881_FLOATING_POINT_SUPPORT) - { - if(FLAG_IS_CLEAR(((struct ExecBase *)SysBase)->AttnFlags,AFF_68881)) - { - __show_error("This program requires a floating point processor."); - - goto out; - } - } - #endif /* M68881_FLOATING_POINT_SUPPORT */ - - #if defined(IEEE_FLOATING_POINT_SUPPORT) - { - char * failed_library = NULL; - - PROFILE_OFF(); - - /* Try to get the soft floating point libraries open. */ - MathIeeeSingBasBase = OpenLibrary("mathieeesingbas.library",33); - MathIeeeDoubBasBase = OpenLibrary("mathieeedoubbas.library",33); - MathIeeeDoubTransBase = OpenLibrary("mathieeedoubtrans.library",33); - - PROFILE_ON(); - - if(MathIeeeSingBasBase == NULL) - failed_library = "mathieeesingbas.library"; - else if (MathIeeeDoubBasBase == NULL) - failed_library = "mathieeedoubbas.library"; - else if (MathIeeeDoubTransBase == NULL) - failed_library = "mathieeedoubtrans.library"; - - if(failed_library != NULL) - { - char message[60]; - - strlcpy(message,failed_library,sizeof(message)); - strlcat(message," could not be opened.",sizeof(message)); - - __show_error(message); - - goto out; - } - } - #endif /* IEEE_FLOATING_POINT_SUPPORT */ - - /* Now fill in HUGE_VAL and HUGE_VALF, respectively. TODO: - also take care of HUGE_VALL. */ - - /* Exponent = +126, Mantissa = 8,388,607 */ - single_x = (union ieee_single *)&__huge_val_float; - single_x->raw[0] = 0x7f7fffff; - - /* Exponent = +1022, Mantissa = 4,503,599,627,370,495 */ - double_x = (union ieee_double *)&__huge_val; - double_x->raw[0] = 0x7fefffff; - double_x->raw[1] = 0xffffffff; - - #if defined(USE_LONG_DOUBLE) - { - union ieee_long_double * x = (union ieee_long_double *)&__huge_val_long_double; - - /* Exponent = +32766, Mantissa = 18,446,744,073,709,551,615 */ - x->raw[0] = 0x7ffe0000; - x->raw[1] = 0xffffffff; - x->raw[2] = 0xffffffff; - } - #endif /* USE_LONG_DOUBLE */ - - /* Finally, fill in the constants behind INFINITY and NAN. */ - single_x = (union ieee_single *)&__infinity; - single_x->raw[0] = 0x7f800000; - - single_x = (union ieee_single *)&__nan; - single_x->raw[0] = 0x7fc00001; - - success = TRUE; - - out: - - SHOWVALUE(success); - LEAVE(); - - if(success) - CONSTRUCTOR_SUCCEED(); - else - CONSTRUCTOR_FAIL(); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_isfinite.c b/library/math_isfinite.c deleted file mode 100644 index 2ace98f..0000000 --- a/library/math_isfinite.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * $Id: math_isfinite.c,v 1.1 2005-05-08 08:51:29 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#if defined (FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -int -__isfinite_float(float number) -{ - union ieee_single x; - int result; - - x.value = number; - - if((x.raw[0] & 0x7f800000) == 0x7f800000 && (x.raw[0] & 0x007fffff) != 0) - result = 0; /* Exponent = 255 and fraction != 0.0 -> not a number */ - else if ((x.raw[0] & 0x7fffffff) == 0x7f800000) - result = 0; /* Exponent = 255 and fraction = 0.0 -> infinity */ - else - result = 1; - - return(result); -} - -/****************************************************************************/ - -int -__isfinite_double(double number) -{ - union ieee_double x; - int result; - - x.value = number; - - if(((x.raw[0] & 0x7ff00000) == 0x7ff00000) && ((x.raw[0] & 0x000fffff) != 0 || (x.raw[1] != 0))) - result = 0; /* Exponent = 2047 and fraction != 0.0 -> not a number */ - else if (((x.raw[0] & 0x7fffffff) == 0x7ff00000) && (x.raw[1] == 0)) - result = 0; /* Exponent = 2047 and fraction = 0.0 -> infinity */ - else - result = 1; - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_isunordered.c b/library/math_isunordered.c deleted file mode 100644 index 7410ccf..0000000 --- a/library/math_isunordered.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * $Id: math_isunordered.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#if defined (FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -int -__isunordered_float(float number_x,float number_y) -{ - union ieee_single x; - union ieee_single y; - int result; - - x.value = number_x; - y.value = number_y; - - /* Exponent = 255 and fraction != 0.0 -> not a number */ - if((x.raw[0] & 0x7f800000) == 0x7f800000 && (x.raw[0] & 0x007fffff) != 0) - result = 1; - else if((y.raw[0] & 0x7f800000) == 0x7f800000 && (y.raw[0] & 0x007fffff) != 0) - result = 1; - else - result = 0; - - return(result); -} - -/****************************************************************************/ - -int -__isunordered_float_double(float number_x,double number_y) -{ - union ieee_single x; - union ieee_double y; - int result; - - x.value = number_x; - y.value = number_y; - - if((x.raw[0] & 0x7f800000) == 0x7f800000 && (x.raw[0] & 0x007fffff) != 0) - result = 1; /* Exponent = 255 and fraction != 0.0 -> not a number */ - else if (((y.raw[0] & 0x7ff00000) == 0x7ff00000) && ((y.raw[0] & 0x000fffff) != 0 || (y.raw[1] != 0))) - result = 1; /* Exponent = 2047 and fraction != 0.0 -> not a number */ - else - result = 0; - - return(result); -} - -/****************************************************************************/ - -int -__isunordered_double(double number_x,double number_y) -{ - union ieee_double x; - union ieee_double y; - int result; - - x.value = number_x; - y.value = number_y; - - /* Exponent = 2047 and fraction != 0.0 -> not a number */ - if(((x.raw[0] & 0x7ff00000) == 0x7ff00000) && ((x.raw[0] & 0x000fffff) != 0 || (x.raw[1] != 0))) - result = 1; - else if (((y.raw[0] & 0x7ff00000) == 0x7ff00000) && ((y.raw[0] & 0x000fffff) != 0 || (y.raw[1] != 0))) - result = 1; - else - result = 0; - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_kernel_cos.c b/library/math_kernel_cos.c deleted file mode 100644 index 132ae15..0000000 --- a/library/math_kernel_cos.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * $Id: math_kernel_cos.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) && defined(PPC_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ -C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */ -C2 = -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */ -C3 = 2.48015872894767294178e-05, /* 0x3EFA01A0, 0x19CB1590 */ -C4 = -2.75573143513906633035e-07, /* 0xBE927E4F, 0x809C52AD */ -C5 = 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */ -C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ - -double __kernel_cos(double x, double y) -{ - double a,hz,z,r,qx; - int ix; - - GET_HIGH_WORD(ix,x); - ix &= 0x7fffffff; /* ix = |x|'s high word*/ - if(ix<0x3e400000) { /* if x < 2**27 */ - if(((int)x)==0) return one; /* generate inexact */ - } - z = x*x; - r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6))))); - if(ix < 0x3FD33333) /* if |x| < 0.3 */ - return one - (0.5*z - (z*r - x*y)); - else { - if(ix > 0x3fe90000) { /* x > 0.78125 */ - qx = 0.28125; - } else { - INSERT_WORDS(qx,ix-0x00200000,0); /* x/4 */ - } - hz = 0.5*z-qx; - a = one-qx; - return a - (hz - (z*r-x*y)); - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT && PPC_FLOATING_POINT_SUPPORT */ diff --git a/library/math_kernel_cosf.c b/library/math_kernel_cosf.c deleted file mode 100644 index e7db32f..0000000 --- a/library/math_kernel_cosf.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * $Id: math_kernel_cosf.c,v 1.1 2005-05-30 08:10:38 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -one = 1.0000000000e+00, /* 0x3f800000 */ -C1 = 4.1666667908e-02, /* 0x3d2aaaab */ -C2 = -1.3888889225e-03, /* 0xbab60b61 */ -C3 = 2.4801587642e-05, /* 0x37d00d01 */ -C4 = -2.7557314297e-07, /* 0xb493f27c */ -C5 = 2.0875723372e-09, /* 0x310f74f6 */ -C6 = -1.1359647598e-11; /* 0xad47d74e */ - -float -__kernel_cosf(float x, float y) -{ - volatile float hz; /* prevent optimizing out of existence */ - float a,z,r,qx; - LONG ix; - GET_FLOAT_WORD(ix,x); - ix &= 0x7fffffff; /* ix = |x|'s high word*/ - if(ix<0x32000000) { /* if x < 2**27 */ - if(((int)x)==0) return one; /* generate inexact */ - } - z = x*x; - r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6))))); - if(ix < 0x3e99999a) /* if |x| < 0.3 */ - return one - ((float)0.5*z - (z*r - x*y)); - else { - if(ix > 0x3f480000) { /* x > 0.78125 */ - qx = (float)0.28125; - } else { - SET_FLOAT_WORD(qx,ix-0x01000000); /* x/4 */ - } - hz = (float)0.5*z-qx; - a = one-qx; - return a - (hz - (z*r-x*y)); - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_kernel_expm1.c b/library/math_kernel_expm1.c deleted file mode 100644 index bb3a711..0000000 --- a/library/math_kernel_expm1.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * $Id: math_kernel_expm1.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) && defined(PPC_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ -huge = 1.0e+300, -tiny = 1.0e-300, -o_threshold = 7.09782712893383973096e+02,/* 0x40862E42, 0xFEFA39EF */ -ln2_hi = 6.93147180369123816490e-01,/* 0x3fe62e42, 0xfee00000 */ -ln2_lo = 1.90821492927058770002e-10,/* 0x3dea39ef, 0x35793c76 */ -invln2 = 1.44269504088896338700e+00,/* 0x3ff71547, 0x652b82fe */ - /* scaled coefficients related to __expm1 */ -Q1 = -3.33333333333331316428e-02, /* BFA11111 111110F4 */ -Q2 = 1.58730158725481460165e-03, /* 3F5A01A0 19FE5585 */ -Q3 = -7.93650757867487942473e-05, /* BF14CE19 9EAADBB7 */ -Q4 = 4.00821782732936239552e-06, /* 3ED0CFCA 86E65239 */ -Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ - -double __expm1(double x) -{ - double y,hi,lo,c,t,e,hxs,hfx,r1; - int k,xsb; - unsigned int hx; - - GET_HIGH_WORD(hx,x); - xsb = hx&0x80000000; /* sign bit of x */ - if(xsb==0) y=x; else y= -x; /* y = |x| */ - hx &= 0x7fffffff; /* high word of |x| */ - - /* filter out huge and non-finite argument */ - if(hx >= 0x4043687A) { /* if |x|>=56*ln2 */ - if(hx >= 0x40862E42) { /* if |x|>=709.78... */ - if(hx>=0x7ff00000) { - unsigned int low; - GET_LOW_WORD(low,x); - if(((hx&0xfffff)|low)!=0) - return x+x; /* NaN */ - else return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */ - } - if(x > o_threshold) return huge*huge; /* overflow */ - } - if(xsb!=0) { /* x < -56*ln2, return -1.0 with inexact */ - if(x+tiny<0.0) /* raise inexact */ - return tiny-one; /* return -1 */ - } - } - - /* argument reduction */ - if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ - if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */ - if(xsb==0) - {hi = x - ln2_hi; lo = ln2_lo; k = 1;} - else - {hi = x + ln2_hi; lo = -ln2_lo; k = -1;} - } else { - k = invln2*x+((xsb==0)?0.5:-0.5); - t = k; - hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ - lo = t*ln2_lo; - } - x = hi - lo; - c = (hi-x)-lo; - } - else if(hx < 0x3c900000) { /* when |x|<2**-54, return x */ - t = huge+x; /* return x with inexact flags when x!=0 */ - return x - (t-(huge+x)); - } - else k = 0; - - /* x is now in primary range */ - hfx = 0.5*x; - hxs = x*hfx; - r1 = one+hxs*(Q1+hxs*(Q2+hxs*(Q3+hxs*(Q4+hxs*Q5)))); - t = 3.0-r1*hfx; - e = hxs*((r1-t)/(6.0 - x*t)); - if(k==0) return x - (x*e-hxs); /* c is 0 */ - else { - e = (x*(e-c)-c); - e -= hxs; - if(k== -1) return 0.5*(x-e)-0.5; - if(k==1) { - if(x < -0.25) return -2.0*(e-(x+0.5)); - else return one+2.0*(x-e); - } - if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ - unsigned int high; - y = one-(e-x); - GET_HIGH_WORD(high,y); - SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ - return y-one; - } - t = one; - if(k<20) { - unsigned int high; - SET_HIGH_WORD(t,0x3ff00000 - (0x200000>>k)); /* t=1-2^-k */ - y = t-(e-x); - GET_HIGH_WORD(high,y); - SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ - } else { - unsigned int high; - SET_HIGH_WORD(t,((0x3ff-k)<<20)); /* 2^-k */ - y = x-(e+t); - y += one; - GET_HIGH_WORD(high,y); - SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ - } - } - return y; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT && PPC_FLOATING_POINT_SUPPORT */ diff --git a/library/math_kernel_rem_pio2.c b/library/math_kernel_rem_pio2.c deleted file mode 100644 index e59a91e..0000000 --- a/library/math_kernel_rem_pio2.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - * $Id: math_kernel_rem_pio2.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) && defined(PPC_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const int init_jk[] = {2,3,4,6}; /* initial value for jk */ -static const double PIo2[] = { - 1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */ - 7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */ - 5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */ - 3.28200341580791294123e422, /* 0x3B78CC51, 0x60000000 */ - 1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */ - 1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */ - 2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */ - 2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */ -}; - -static const double -zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ -half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ -two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ -twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ - -INLINE STATIC int kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int *ipio2) -{ - int jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; - double z,fw,f[20],fq[20],q[20]; - - /* initialize jk*/ - jk = init_jk[prec]; - jp = jk; - - /* determine jx,jv,q0, note that 3>q0 */ - jx = nx-1; - jv = (e0-3)/24; if(jv<0) jv=0; - q0 = e0-24*(jv+1); - - /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ - j = jv-jx; m = jx+jk; - for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (double) ipio2[j]; - - /* compute q[0],q[1],...q[jk] */ - for (i=0;i<=jk;i++) { - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; - } - - jz = jk; -recompute: - /* distill q[] into iq[] reversingly */ - for(i=0,j=jz,z=q[jz];j>0;i++,j--) { - fw = (double)((int)(twon24* z)); - iq[i] = (int)(z-two24*fw); - z = q[j-1]+fw; - } - - /* compute n */ - z = __scalbn(z,(int)q0); /* actual value of z */ - z -= 8.0*floor(z*0.125); /* trim off integer >= 8 */ - n = (int) z; - z -= (double)n; - ih = 0; - if(q0>0) { /* need iq[jz-1] to determine n */ - i = (iq[jz-1]>>(24-q0)); n += i; - iq[jz-1] -= i<<(24-q0); - ih = iq[jz-1]>>(23-q0); - } - else if(q0==0) ih = iq[jz-1]>>23; - else if(z>=0.5) ih=2; - - if(ih>0) { /* q > 0.5 */ - n += 1; carry = 0; - for(i=0;i0) { /* rare case: chance is 1 in 12 */ - switch(q0) { - case 1: - iq[jz-1] &= 0x7fffff; break; - case 2: - iq[jz-1] &= 0x3fffff; break; - } - } - if(ih==2) { - z = one - z; - if(carry!=0) z -= __scalbn(one,(int)q0); - } - } - - /* check if recomputation is needed */ - if(z==zero) { - j = 0; - for (i=jz-1;i>=jk;i--) j |= iq[i]; - if(j==0) { /* need recomputation */ - for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */ - - for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */ - f[jx+i] = (double) ipio2[jv+i]; - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; - q[i] = fw; - } - jz += k; - goto recompute; - } - } - - /* chop off zero terms */ - if(z==0.0) { - jz -= 1; q0 -= 24; - while(iq[jz]==0) { jz--; q0-=24;} - } else { /* break z into 24-bit if necessary */ - z = __scalbn(z,-(int)q0); - if(z>=two24) { - fw = (double)((int)(twon24*z)); - iq[jz] = (int)(z-two24*fw); - jz += 1; q0 += 24; - iq[jz] = (int) fw; - } else iq[jz] = (int) z ; - } - - /* convert integer "bit" chunk to floating-point value */ - fw = __scalbn(one,(int)q0); - for(i=jz;i>=0;i--) { - q[i] = fw*(double)iq[i]; fw*=twon24; - } - - /* compute PIo2[0,...,jp]*q[jz,...,0] */ - for(i=jz;i>=0;i--) { - for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; - fq[jz-i] = fw; - } - - /* compress fq[] into y[] */ - switch(prec) { - case 0: - fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; - break; - case 1: - case 2: - fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; - fw = fq[0]-fw; - for (i=1;i<=jz;i++) fw += fq[i]; - y[1] = (ih==0)? fw: -fw; - break; - case 3: /* painful */ - for (i=jz;i>0;i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; - } - for (i=jz;i>1;i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; - } - for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; - if(ih==0) { - y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; - } else { - y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; - } - } - return n&7; -} - -static const int two_over_pi[] = { -0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, -0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, -0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, -0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, -0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, -0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, -0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, -0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, -0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, -0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, -0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, -}; - -static const int npio2_hw[] = { -0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C, -0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C, -0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB, 0x403AB41B, 0x403C463A, -0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C, -0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB, -0x404858EB, 0x404921FB, -}; - -static const double -invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ -pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */ -pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */ -pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */ -pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */ -pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ -pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ - -int __rem_pio2(double x, double *y) -{ - double z,w,t,r,fn; - double tx[3]; - int i,j,n,ix,hx; - int e0,nx; - unsigned int low; - - GET_HIGH_WORD(hx,x); /* high word of x */ - ix = hx&0x7fffffff; - if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */ - {y[0] = x; y[1] = 0; return 0;} - if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */ - if(hx>0) { - z = x - pio2_1; - if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ - y[0] = z - pio2_1t; - y[1] = (z-y[0])-pio2_1t; - } else { /* near pi/2, use 33+33+53 bit pi */ - z -= pio2_2; - y[0] = z - pio2_2t; - y[1] = (z-y[0])-pio2_2t; - } - return 1; - } else { /* negative x */ - z = x + pio2_1; - if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ - y[0] = z + pio2_1t; - y[1] = (z-y[0])+pio2_1t; - } else { /* near pi/2, use 33+33+53 bit pi */ - z += pio2_2; - y[0] = z + pio2_2t; - y[1] = (z-y[0])+pio2_2t; - } - return -1; - } - } - if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */ - t = fabs(x); - n = (int) (t*invpio2+half); - fn = (double)n; - r = t-fn*pio2_1; - w = fn*pio2_1t; /* 1st round good to 85 bit */ - if(n<32&&ix!=npio2_hw[n-1]) { - y[0] = r-w; /* quick check no cancellation */ - } else { - unsigned int high; - j = ix>>20; - y[0] = r-w; - GET_HIGH_WORD(high,y[0]); - i = j-((high>>20)&0x7ff); - if(i>16) { /* 2nd iteration needed, good to 118 */ - t = r; - w = fn*pio2_2; - r = t-w; - w = fn*pio2_2t-((t-r)-w); - y[0] = r-w; - GET_HIGH_WORD(high,y[0]); - i = j-((high>>20)&0x7ff); - if(i>49) { /* 3rd iteration need, 151 bits acc */ - t = r; /* will cover all possible cases */ - w = fn*pio2_3; - r = t-w; - w = fn*pio2_3t-((t-r)-w); - y[0] = r-w; - } - } - } - y[1] = (r-y[0])-w; - if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} - else return n; - } - /* - * all other (large) arguments - */ - if(ix>=0x7ff00000) { /* x is inf or NaN */ - y[0]=y[1]=x-x; return 0; - } - /* set z = __scalbn(|x|,ilogb(x)-23) */ - GET_LOW_WORD(low,x); - SET_LOW_WORD(z,low); - e0 = (int)((ix>>20)-1046); /* e0 = ilogb(z)-23; */ - SET_HIGH_WORD(z, ix - ((int)e0<<20)); - for(i=0;i<2;i++) { - tx[i] = (double)((int)(z)); - z = (z-tx[i])*two24; - } - tx[2] = z; - nx = 3; - while(tx[nx-1]==zero) nx--; /* skip zero term */ - n = kernel_rem_pio2(tx,y,e0,nx,2,two_over_pi); - if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} - return n; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT && PPC_FLOATING_POINT_SUPPORT */ diff --git a/library/math_kernel_scalbn.c b/library/math_kernel_scalbn.c deleted file mode 100644 index c12425a..0000000 --- a/library/math_kernel_scalbn.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * $Id: math_kernel_scalbn.c,v 1.4 2005-05-12 14:50:06 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) && defined(PPC_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double -huge = 1.0e+300, -tiny = 1.0e-300, -two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ -twom54 = 5.55111512312578270212e-17; /* 0x3C900000, 0x00000000 */ - -double __scalbn (double x, int n) -{ - int k,hx,lx; - EXTRACT_WORDS(hx,lx,x); - k = (hx&0x7ff00000)>>20; /* extract exponent */ - if (k==0) { /* 0 or subnormal x */ - if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ - x *= two54; - GET_HIGH_WORD(hx,x); - k = ((hx&0x7ff00000)>>20) - 54; - if (n< -50000) return tiny*x; /*underflow*/ - } - if (k==0x7ff) return x+x; /* NaN or Inf */ - k = k+n; - if (k > 0x7fe) return huge*copysign(huge,x); /* overflow */ - if (k > 0) /* normal result */ - {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;} - if (k <= -54) { - if (n > 50000) /* in case integer overflow in n+k */ - return huge*copysign(huge,x); /*overflow*/ - else return tiny*copysign(tiny,x); /*underflow*/ - } - k += 54; /* subnormal result */ - SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); - return x*twom54; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT && PPC_FLOATING_POINT_SUPPORT */ diff --git a/library/math_kernel_sin.c b/library/math_kernel_sin.c deleted file mode 100644 index d45c5f0..0000000 --- a/library/math_kernel_sin.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * $Id: math_kernel_sin.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) && defined(PPC_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double -zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ -half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ -S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ -S2 = 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */ -S3 = -1.98412698298579493134e-04, /* 0xBF2A01A0, 0x19C161D5 */ -S4 = 2.75573137070700676789e-06, /* 0x3EC71DE3, 0x57B1FE7D */ -S5 = -2.50507602534068634195e-08, /* 0xBE5AE5E6, 0x8A2B9CEB */ -S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ - -double __kernel_sin(double x, double y, int iy) -{ - double z,r,v; - int ix; - - GET_HIGH_WORD(ix,x); - - ix &= 0x7fffffff; /* high word of x */ - if(ix<0x3e400000) /* |x| < 2**-27 */ - {if((int)x==0) return x;} /* generate inexact */ - z = x*x; - v = z*x; - r = S2+z*(S3+z*(S4+z*(S5+z*S6))); - if(iy==0) return x+v*(S1+z*r); - else return x-((z*(half*y-v*r)-y)-v*S1); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT && PPC_FLOATING_POINT_SUPPORT */ diff --git a/library/math_kernel_sinf.c b/library/math_kernel_sinf.c deleted file mode 100644 index 893463c..0000000 --- a/library/math_kernel_sinf.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * $Id: math_kernel_sinf.c,v 1.1 2005-05-30 08:10:38 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -half = 5.0000000000e-01,/* 0x3f000000 */ -S1 = -1.6666667163e-01, /* 0xbe2aaaab */ -S2 = 8.3333337680e-03, /* 0x3c088889 */ -S3 = -1.9841270114e-04, /* 0xb9500d01 */ -S4 = 2.7557314297e-06, /* 0x3638ef1b */ -S5 = -2.5050759689e-08, /* 0xb2d72f34 */ -S6 = 1.5896910177e-10; /* 0x2f2ec9d3 */ - -float -__kernel_sinf(float x, float y, int iy) -{ - float z,r,v; - LONG ix; - GET_FLOAT_WORD(ix,x); - ix &= 0x7fffffff; /* high word of x */ - if(ix<0x32000000) /* |x| < 2**-27 */ - {if((int)x==0) return x;} /* generate inexact */ - z = x*x; - v = z*x; - r = S2+z*(S3+z*(S4+z*(S5+z*S6))); - if(iy==0) return x+v*(S1+z*r); - else return x-((z*(half*y-v*r)-y)-v*S1); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_kernel_tan.c b/library/math_kernel_tan.c deleted file mode 100644 index 2937137..0000000 --- a/library/math_kernel_tan.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * $Id: math_kernel_tan.c,v 1.3 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) && defined(PPC_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ -pio4 = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */ -pio4lo= 3.06161699786838301793e-17, /* 0x3C81A626, 0x33145C07 */ -T[] = { - 3.33333333333334091986e-01, /* 0x3FD55555, 0x55555563 */ - 1.33333333333201242699e-01, /* 0x3FC11111, 0x1110FE7A */ - 5.39682539762260521377e-02, /* 0x3FABA1BA, 0x1BB341FE */ - 2.18694882948595424599e-02, /* 0x3F9664F4, 0x8406D637 */ - 8.86323982359930005737e-03, /* 0x3F8226E3, 0xE96E8493 */ - 3.59207910759131235356e-03, /* 0x3F6D6D22, 0xC9560328 */ - 1.45620945432529025516e-03, /* 0x3F57DBC8, 0xFEE08315 */ - 5.88041240820264096874e-04, /* 0x3F4344D8, 0xF2F26501 */ - 2.46463134818469906812e-04, /* 0x3F3026F7, 0x1A8D1068 */ - 7.81794442939557092300e-05, /* 0x3F147E88, 0xA03792A6 */ - 7.14072491382608190305e-05, /* 0x3F12B80F, 0x32F0A7E9 */ - -1.85586374855275456654e-05, /* 0xBEF375CB, 0xDB605373 */ - 2.59073051863633712884e-05, /* 0x3EFB2A70, 0x74BF7AD4 */ -}; - -double __kernel_tan(double x, double y, int iy) -{ - double z,r,v,w,s; - int ix,hx; - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; /* high word of |x| */ - if(ix<0x3e300000) /* x < 2**-28 */ - { - if((int)x==0) { /* generate inexact */ - unsigned int low; - GET_LOW_WORD(low,x); - if(((ix|low)|(iy+1))==0) return one/fabs(x); - else { - if (iy == 1) - return x; - else { /* compute -1 / (x+y) carefully */ - double a, t; - - z = w = x + y; - SET_LOW_WORD(z,0); - v = y - (z - x); - t = a = -one / w; - SET_LOW_WORD(t,0); - s = one + t * z; - return t + a * (s + t * v); - } - } - } - } - if(ix>=0x3FE59428) { /* |x|>=0.6744 */ - if(hx<0) {x = -x; y = -y;} - z = pio4-x; - w = pio4lo-y; - x = z+w; y = 0.0; - } - z = x*x; - w = z*z; - /* Break x^5*(T[1]+x^2*T[2]+...) into - * x^5(T[1]+x^4*T[3]+...+x^20*T[11]) + - * x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12])) - */ - r = T[1]+w*(T[3]+w*(T[5]+w*(T[7]+w*(T[9]+w*T[11])))); - v = z*(T[2]+w*(T[4]+w*(T[6]+w*(T[8]+w*(T[10]+w*T[12]))))); - s = z*x; - r = y + z*(s*(r+v)+y); - r += T[0]*s; - w = x+r; - if(ix>=0x3FE59428) { - v = (double)iy; - return (double)(1-((hx>>30)&2))*(v-2.0*(x-(w*w/(w+v)-r))); - } - if(iy==1) return w; - else { /* if allow error up to 2 ulp, - simply return -1.0/(x+r) here */ - /* compute -1.0/(x+r) accurately */ - double a,t; - z = w; - SET_LOW_WORD(z,0); - v = r-(z - x); /* z+v = r+x */ - t = a = -1.0/w; /* a = -1.0/w */ - SET_LOW_WORD(t,0); - s = 1.0+t*z; - return t+a*(s+t*v); - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT && PPC_FLOATING_POINT_SUPPORT */ diff --git a/library/math_kernel_tanf.c b/library/math_kernel_tanf.c deleted file mode 100644 index 4851b3a..0000000 --- a/library/math_kernel_tanf.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * $Id: math_kernel_tanf.c,v 1.1 2005-05-30 08:10:38 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -one = 1.0000000000e+00, /* 0x3f800000 */ -pio4 = 7.8539812565e-01, /* 0x3f490fda */ -pio4lo= 3.7748947079e-08, /* 0x33222168 */ -T[] = { - 3.3333334327e-01, /* 0x3eaaaaab */ - 1.3333334029e-01, /* 0x3e088889 */ - 5.3968254477e-02, /* 0x3d5d0dd1 */ - 2.1869488060e-02, /* 0x3cb327a4 */ - 8.8632395491e-03, /* 0x3c11371f */ - 3.5920790397e-03, /* 0x3b6b6916 */ - 1.4562094584e-03, /* 0x3abede48 */ - 5.8804126456e-04, /* 0x3a1a26c8 */ - 2.4646313977e-04, /* 0x398137b9 */ - 7.8179444245e-05, /* 0x38a3f445 */ - 7.1407252108e-05, /* 0x3895c07a */ - -1.8558637748e-05, /* 0xb79bae5f */ - 2.5907305826e-05, /* 0x37d95384 */ -}; - -float -__kernel_tanf(float x, float y, int iy) -{ - float z,r,v,w,s; - LONG ix,hx; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; /* high word of |x| */ - if(ix<0x31800000) /* x < 2**-28 */ - {if((int)x==0) { /* generate inexact */ - if((ix|(iy+1))==0) return one/fabsf(x); - else return (iy==1)? x: -one/x; - } - } - if(ix>=0x3f2ca140) { /* |x|>=0.6744 */ - if(hx<0) {x = -x; y = -y;} - z = pio4-x; - w = pio4lo-y; - x = z+w; y = 0.0; - } - z = x*x; - w = z*z; - /* Break x^5*(T[1]+x^2*T[2]+...) into - * x^5(T[1]+x^4*T[3]+...+x^20*T[11]) + - * x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12])) - */ - r = T[1]+w*(T[3]+w*(T[5]+w*(T[7]+w*(T[9]+w*T[11])))); - v = z*(T[2]+w*(T[4]+w*(T[6]+w*(T[8]+w*(T[10]+w*T[12]))))); - s = z*x; - r = y + z*(s*(r+v)+y); - r += T[0]*s; - w = x+r; - if(ix>=0x3f2ca140) { - v = (float)iy; - return (float)(1-((hx>>30)&2))*(v-(float)2.0*(x-(w*w/(w+v)-r))); - } - if(iy==1) return w; - else { /* if allow error up to 2 ulp, - simply return -1.0/(x+r) here */ - /* compute -1.0/(x+r) accurately */ - float a,t; - LONG i; - z = w; - GET_FLOAT_WORD(i,z); - SET_FLOAT_WORD(z,i&0xfffff000U); - v = r-(z - x); /* z+v = r+x */ - t = a = -(float)1.0/w; /* a = -1.0/w */ - GET_FLOAT_WORD(i,t); - SET_FLOAT_WORD(t,i&0xfffff000U); - s = (float)1.0+t*z; - return t+a*(s+t*v); - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_ldexp.c b/library/math_ldexp.c deleted file mode 100644 index 5d0745b..0000000 --- a/library/math_ldexp.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * $Id: math_ldexp.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -#define MANT_MASK 0x800FFFFF /* Mantissa extraction mask */ -#define ZPOS_MASK 0x3FF00000 /* Positive # mask for exp = 0 */ -#define ZNEG_MASK 0x3FF00000 /* Negative # mask for exp = 0 */ - -#define EXP_MASK 0x7FF00000 /* Mask for exponent */ -#define EXP_SHIFTS 20 /* Shifts to get into LSB's */ -#define EXP_BIAS 1023 /* Exponent bias */ - -union dtol -{ - double dval; - long ival[2]; -}; - -INLINE STATIC const double -__ldexp(double x,int n) -{ - union dtol number; - long *iptr, cn; - - number.dval = x; - - iptr = &number.ival[0]; - - cn = (((*iptr) & EXP_MASK) >> EXP_SHIFTS) - EXP_BIAS; - - (*iptr) &= ~EXP_MASK; - - n += EXP_BIAS; - - /* ZZZ we can't just muck with the exponent, we - * have to check for underflow and overflow, too! - */ - (*iptr) |= ((n + cn) << EXP_SHIFTS) & EXP_MASK; - - return(number.dval); -} - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__ldexp(double x,int n) -{ - double result; - - __asm ("fscale%.l %2,%0" - : "=f" (result) - : "0" (x), - "dmi" (n)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -#define MANT_MASK 0x800FFFFF /* Mantissa extraction mask */ -#define ZPOS_MASK 0x3FF00000 /* Positive # mask for exp = 0 */ -#define ZNEG_MASK 0x3FF00000 /* Negative # mask for exp = 0 */ - -#define EXP_MASK 0x7FF00000 /* Mask for exponent */ -#define EXP_SHIFTS 20 /* Shifts to get into LSB's */ -#define EXP_BIAS 1023 /* Exponent bias */ - -union dtol -{ - double dval; - long ival[2]; -}; - -INLINE STATIC const double -__ldexp(double x,int n) -{ - union dtol number; - long *iptr, cn; - - number.dval = x; - - iptr = &number.ival[0]; - - cn = (((*iptr) & EXP_MASK) >> EXP_SHIFTS) - EXP_BIAS; - - (*iptr) &= ~EXP_MASK; - - n += EXP_BIAS; - - /* ZZZ we can't just muck with the exponent, we - * have to check for underflow and overflow, too! - */ - (*iptr) |= ((n + cn) << EXP_SHIFTS) & EXP_MASK; - - return(number.dval); -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -ldexp(double x,int n) -{ - double result; - - if(x != 0.0) - result = __ldexp(x,n); - else - result = 0.0; - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_ldexpf.c b/library/math_ldexpf.c deleted file mode 100644 index d5be6f1..0000000 --- a/library/math_ldexpf.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id: math_ldexpf.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -ldexpf(float x,int exp) -{ - float result; - - if(isinf(x) || fpclassify(x) == FP_ZERO) - { - result = x; - } - else - { - result = scalbnf(x,exp); - - if(isinf(result) || (result < FLT_MIN || result > -FLT_MIN)) - __set_errno(ERANGE); - } - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_ledf2.c b/library/math_ledf2.c deleted file mode 100644 index b10fc3e..0000000 --- a/library/math_ledf2.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: math_ledf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___ledf2 - -___ledf2: - - moveml d2/d3/a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(16),d0/d1/d2/d3 - jsr a6@(-42:W) - moveml sp@+,d2/d3/a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_lesf2.c b/library/math_lesf2.c deleted file mode 100644 index 773c9a3..0000000 --- a/library/math_lesf2.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: math_lesf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -float -__lesf2(float x,float y) -{ - float result; - - result = IEEESPCmp(x,y); - - return(result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_lgamma.c b/library/math_lgamma.c deleted file mode 100644 index 4bcd182..0000000 --- a/library/math_lgamma.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * $Id: math_lgamma.c,v 1.2 2005-05-30 08:47:26 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double -two52= 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ -half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ -one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ -pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ -a0 = 7.72156649015328655494e-02, /* 0x3FB3C467, 0xE37DB0C8 */ -a1 = 3.22467033424113591611e-01, /* 0x3FD4A34C, 0xC4A60FAD */ -a2 = 6.73523010531292681824e-02, /* 0x3FB13E00, 0x1A5562A7 */ -a3 = 2.05808084325167332806e-02, /* 0x3F951322, 0xAC92547B */ -a4 = 7.38555086081402883957e-03, /* 0x3F7E404F, 0xB68FEFE8 */ -a5 = 2.89051383673415629091e-03, /* 0x3F67ADD8, 0xCCB7926B */ -a6 = 1.19270763183362067845e-03, /* 0x3F538A94, 0x116F3F5D */ -a7 = 5.10069792153511336608e-04, /* 0x3F40B6C6, 0x89B99C00 */ -a8 = 2.20862790713908385557e-04, /* 0x3F2CF2EC, 0xED10E54D */ -a9 = 1.08011567247583939954e-04, /* 0x3F1C5088, 0x987DFB07 */ -a10 = 2.52144565451257326939e-05, /* 0x3EFA7074, 0x428CFA52 */ -a11 = 4.48640949618915160150e-05, /* 0x3F07858E, 0x90A45837 */ -tc = 1.46163214496836224576e+00, /* 0x3FF762D8, 0x6356BE3F */ -tf = -1.21486290535849611461e-01, /* 0xBFBF19B9, 0xBCC38A42 */ -/* tt = -(tail of tf) */ -tt = -3.63867699703950536541e-18, /* 0xBC50C7CA, 0xA48A971F */ -t0 = 4.83836122723810047042e-01, /* 0x3FDEF72B, 0xC8EE38A2 */ -t1 = -1.47587722994593911752e-01, /* 0xBFC2E427, 0x8DC6C509 */ -t2 = 6.46249402391333854778e-02, /* 0x3FB08B42, 0x94D5419B */ -t3 = -3.27885410759859649565e-02, /* 0xBFA0C9A8, 0xDF35B713 */ -t4 = 1.79706750811820387126e-02, /* 0x3F9266E7, 0x970AF9EC */ -t5 = -1.03142241298341437450e-02, /* 0xBF851F9F, 0xBA91EC6A */ -t6 = 6.10053870246291332635e-03, /* 0x3F78FCE0, 0xE370E344 */ -t7 = -3.68452016781138256760e-03, /* 0xBF6E2EFF, 0xB3E914D7 */ -t8 = 2.25964780900612472250e-03, /* 0x3F6282D3, 0x2E15C915 */ -t9 = -1.40346469989232843813e-03, /* 0xBF56FE8E, 0xBF2D1AF1 */ -t10 = 8.81081882437654011382e-04, /* 0x3F4CDF0C, 0xEF61A8E9 */ -t11 = -5.38595305356740546715e-04, /* 0xBF41A610, 0x9C73E0EC */ -t12 = 3.15632070903625950361e-04, /* 0x3F34AF6D, 0x6C0EBBF7 */ -t13 = -3.12754168375120860518e-04, /* 0xBF347F24, 0xECC38C38 */ -t14 = 3.35529192635519073543e-04, /* 0x3F35FD3E, 0xE8C2D3F4 */ -u0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */ -u1 = 6.32827064025093366517e-01, /* 0x3FE4401E, 0x8B005DFF */ -u2 = 1.45492250137234768737e+00, /* 0x3FF7475C, 0xD119BD6F */ -u3 = 9.77717527963372745603e-01, /* 0x3FEF4976, 0x44EA8450 */ -u4 = 2.28963728064692451092e-01, /* 0x3FCD4EAE, 0xF6010924 */ -u5 = 1.33810918536787660377e-02, /* 0x3F8B678B, 0xBF2BAB09 */ -v1 = 2.45597793713041134822e+00, /* 0x4003A5D7, 0xC2BD619C */ -v2 = 2.12848976379893395361e+00, /* 0x40010725, 0xA42B18F5 */ -v3 = 7.69285150456672783825e-01, /* 0x3FE89DFB, 0xE45050AF */ -v4 = 1.04222645593369134254e-01, /* 0x3FBAAE55, 0xD6537C88 */ -v5 = 3.21709242282423911810e-03, /* 0x3F6A5ABB, 0x57D0CF61 */ -s0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */ -s1 = 2.14982415960608852501e-01, /* 0x3FCB848B, 0x36E20878 */ -s2 = 3.25778796408930981787e-01, /* 0x3FD4D98F, 0x4F139F59 */ -s3 = 1.46350472652464452805e-01, /* 0x3FC2BB9C, 0xBEE5F2F7 */ -s4 = 2.66422703033638609560e-02, /* 0x3F9B481C, 0x7E939961 */ -s5 = 1.84028451407337715652e-03, /* 0x3F5E26B6, 0x7368F239 */ -s6 = 3.19475326584100867617e-05, /* 0x3F00BFEC, 0xDD17E945 */ -r1 = 1.39200533467621045958e+00, /* 0x3FF645A7, 0x62C4AB74 */ -r2 = 7.21935547567138069525e-01, /* 0x3FE71A18, 0x93D3DCDC */ -r3 = 1.71933865632803078993e-01, /* 0x3FC601ED, 0xCCFBDF27 */ -r4 = 1.86459191715652901344e-02, /* 0x3F9317EA, 0x742ED475 */ -r5 = 7.77942496381893596434e-04, /* 0x3F497DDA, 0xCA41A95B */ -r6 = 7.32668430744625636189e-06, /* 0x3EDEBAF7, 0xA5B38140 */ -w0 = 4.18938533204672725052e-01, /* 0x3FDACFE3, 0x90C97D69 */ -w1 = 8.33333333333329678849e-02, /* 0x3FB55555, 0x5555553B */ -w2 = -2.77777777728775536470e-03, /* 0xBF66C16C, 0x16B02E5C */ -w3 = 7.93650558643019558500e-04, /* 0x3F4A019F, 0x98CF38B6 */ -w4 = -5.95187557450339963135e-04, /* 0xBF4380CB, 0x8C0FE741 */ -w5 = 8.36339918996282139126e-04, /* 0x3F4B67BA, 0x4CDAD5D1 */ -w6 = -1.63092934096575273989e-03; /* 0xBF5AB89D, 0x0B9E43E4 */ - -static const double zero= 0.00000000000000000000e+00; - -static double -sin_pi(double x) -{ - double y,z; - LONG n,ix; - - GET_HIGH_WORD(ix,x); - ix &= 0x7fffffff; - - if(ix<0x3fd00000) return __kernel_sin(pi*x,zero,0); - y = -x; /* x is assume negative */ - - /* - * argument reduction, make sure inexact flag not raised if input - * is an integer - */ - z = floor(y); - if(z!=y) { /* inexact anyway */ - y *= 0.5; - y = 2.0*(y - floor(y)); /* y = |x| mod 2.0 */ - n = (LONG) (y*4.0); - } else { - if(ix>=0x43400000) { - y = zero; n = 0; /* y must be even */ - } else { - if(ix<0x43300000) z = y+two52; /* exact */ - GET_LOW_WORD(n,z); - n &= 1; - y = n; - n<<= 2; - } - } - switch (n) { - case 0: y = __kernel_sin(pi*y,zero,0); break; - case 1: - case 2: y = __kernel_cos(pi*(0.5-y),zero); break; - case 3: - case 4: y = __kernel_sin(pi*(one-y),zero,0); break; - case 5: - case 6: y = -__kernel_cos(pi*(y-1.5),zero); break; - default: y = __kernel_sin(pi*(y-2.0),zero,0); break; - } - return -y; -} - -double -lgamma(double x) -{ - double t,y,z,nadj=0.0,p,p1,p2,p3,q,r,w; - LONG i,hx,lx,ix; - - EXTRACT_WORDS(hx,lx,x); - - /* purge off +-inf, NaN, +-0, and negative arguments */ - ix = hx&0x7fffffff; - if(ix>=0x7ff00000) return x*x; - if((ix|lx)==0) return one/zero; - if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */ - if(hx<0) { - return -log(-x); - } else return -log(x); - } - if(hx<0) { - if(ix>=0x43300000) /* |x|>=2**52, must be -integer */ - return one/zero; - t = sin_pi(x); - if(t==zero) return one/zero; /* -integer */ - nadj = log(pi/fabs(t*x)); - x = -x; - } - - /* purge off 1 and 2 */ - if((((ix-0x3ff00000)|lx)==0)||(((ix-0x40000000)|lx)==0)) r = 0; - /* for x < 2.0 */ - else if(ix<0x40000000) { - if(ix<=0x3feccccc) { /* lgamma(x) = lgamma(x+1)-log(x) */ - r = -log(x); - if(ix>=0x3FE76944) {y = one-x; i= 0;} - else if(ix>=0x3FCDA661) {y= x-(tc-one); i=1;} - else {y = x; i=2;} - } else { - r = zero; - if(ix>=0x3FFBB4C3) {y=2.0-x;i=0;} /* [1.7316,2] */ - else if(ix>=0x3FF3B4C4) {y=x-tc;i=1;} /* [1.23,1.73] */ - else {y=x-one;i=2;} - } - switch(i) { - case 0: - z = y*y; - p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10)))); - p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11))))); - p = y*p1+p2; - r += (p-0.5*y); break; - case 1: - z = y*y; - w = z*y; - p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */ - p2 = t1+w*(t4+w*(t7+w*(t10+w*t13))); - p3 = t2+w*(t5+w*(t8+w*(t11+w*t14))); - p = z*p1-(tt-w*(p2+y*p3)); - r += (tf + p); break; - case 2: - p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5))))); - p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5)))); - r += (-0.5*y + p1/p2); - } - } - else if(ix<0x40200000) { /* x < 8.0 */ - i = (LONG)x; - t = zero; - y = x-(double)i; - p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6)))))); - q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6))))); - r = half*y+p/q; - z = one; /* lgamma(1+s) = log(s) + lgamma(s) */ - switch(i) { - case 7: z *= (y+6.0); /* FALLTHRU */ - case 6: z *= (y+5.0); /* FALLTHRU */ - case 5: z *= (y+4.0); /* FALLTHRU */ - case 4: z *= (y+3.0); /* FALLTHRU */ - case 3: z *= (y+2.0); /* FALLTHRU */ - r += log(z); break; - } - /* 8.0 <= x < 2**58 */ - } else if (ix < 0x43900000) { - t = log(x); - z = one/x; - y = z*z; - w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6))))); - r = (x-half)*(t-one)+w; - } else - /* 2**58 <= x <= inf */ - r = x*(log(x)-one); - if(hx<0) r = nadj - r; - return r; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_lgammaf.c b/library/math_lgammaf.c deleted file mode 100644 index f73bd17..0000000 --- a/library/math_lgammaf.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * $Id: math_lgammaf.c,v 1.2 2005-05-30 08:47:26 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -two23= 8.3886080000e+06, /* 0x4b000000 */ -half= 5.0000000000e-01, /* 0x3f000000 */ -one = 1.0000000000e+00, /* 0x3f800000 */ -pi = 3.1415927410e+00, /* 0x40490fdb */ -a0 = 7.7215664089e-02, /* 0x3d9e233f */ -a1 = 3.2246702909e-01, /* 0x3ea51a66 */ -a2 = 6.7352302372e-02, /* 0x3d89f001 */ -a3 = 2.0580807701e-02, /* 0x3ca89915 */ -a4 = 7.3855509982e-03, /* 0x3bf2027e */ -a5 = 2.8905137442e-03, /* 0x3b3d6ec6 */ -a6 = 1.1927076848e-03, /* 0x3a9c54a1 */ -a7 = 5.1006977446e-04, /* 0x3a05b634 */ -a8 = 2.2086278477e-04, /* 0x39679767 */ -a9 = 1.0801156895e-04, /* 0x38e28445 */ -a10 = 2.5214456400e-05, /* 0x37d383a2 */ -a11 = 4.4864096708e-05, /* 0x383c2c75 */ -tc = 1.4616321325e+00, /* 0x3fbb16c3 */ -tf = -1.2148628384e-01, /* 0xbdf8cdcd */ -/* tt = -(tail of tf) */ -tt = 6.6971006518e-09, /* 0x31e61c52 */ -t0 = 4.8383611441e-01, /* 0x3ef7b95e */ -t1 = -1.4758771658e-01, /* 0xbe17213c */ -t2 = 6.4624942839e-02, /* 0x3d845a15 */ -t3 = -3.2788541168e-02, /* 0xbd064d47 */ -t4 = 1.7970675603e-02, /* 0x3c93373d */ -t5 = -1.0314224288e-02, /* 0xbc28fcfe */ -t6 = 6.1005386524e-03, /* 0x3bc7e707 */ -t7 = -3.6845202558e-03, /* 0xbb7177fe */ -t8 = 2.2596477065e-03, /* 0x3b141699 */ -t9 = -1.4034647029e-03, /* 0xbab7f476 */ -t10 = 8.8108185446e-04, /* 0x3a66f867 */ -t11 = -5.3859531181e-04, /* 0xba0d3085 */ -t12 = 3.1563205994e-04, /* 0x39a57b6b */ -t13 = -3.1275415677e-04, /* 0xb9a3f927 */ -t14 = 3.3552918467e-04, /* 0x39afe9f7 */ -u0 = -7.7215664089e-02, /* 0xbd9e233f */ -u1 = 6.3282704353e-01, /* 0x3f2200f4 */ -u2 = 1.4549225569e+00, /* 0x3fba3ae7 */ -u3 = 9.7771751881e-01, /* 0x3f7a4bb2 */ -u4 = 2.2896373272e-01, /* 0x3e6a7578 */ -u5 = 1.3381091878e-02, /* 0x3c5b3c5e */ -v1 = 2.4559779167e+00, /* 0x401d2ebe */ -v2 = 2.1284897327e+00, /* 0x4008392d */ -v3 = 7.6928514242e-01, /* 0x3f44efdf */ -v4 = 1.0422264785e-01, /* 0x3dd572af */ -v5 = 3.2170924824e-03, /* 0x3b52d5db */ -s0 = -7.7215664089e-02, /* 0xbd9e233f */ -s1 = 2.1498242021e-01, /* 0x3e5c245a */ -s2 = 3.2577878237e-01, /* 0x3ea6cc7a */ -s3 = 1.4635047317e-01, /* 0x3e15dce6 */ -s4 = 2.6642270386e-02, /* 0x3cda40e4 */ -s5 = 1.8402845599e-03, /* 0x3af135b4 */ -s6 = 3.1947532989e-05, /* 0x3805ff67 */ -r1 = 1.3920053244e+00, /* 0x3fb22d3b */ -r2 = 7.2193557024e-01, /* 0x3f38d0c5 */ -r3 = 1.7193385959e-01, /* 0x3e300f6e */ -r4 = 1.8645919859e-02, /* 0x3c98bf54 */ -r5 = 7.7794247773e-04, /* 0x3a4beed6 */ -r6 = 7.3266842264e-06, /* 0x36f5d7bd */ -w0 = 4.1893854737e-01, /* 0x3ed67f1d */ -w1 = 8.3333335817e-02, /* 0x3daaaaab */ -w2 = -2.7777778450e-03, /* 0xbb360b61 */ -w3 = 7.9365057172e-04, /* 0x3a500cfd */ -w4 = -5.9518753551e-04, /* 0xba1c065c */ -w5 = 8.3633989561e-04, /* 0x3a5b3dd2 */ -w6 = -1.6309292987e-03; /* 0xbad5c4e8 */ - -static const float zero= 0.0000000000e+00; - -static float -sin_pif(float x) -{ - float y,z; - LONG n,ix; - - GET_FLOAT_WORD(ix,x); - ix &= 0x7fffffff; - - if(ix<0x3e800000) return __kernel_sinf(pi*x,zero,0); - y = -x; /* x is assume negative */ - - /* - * argument reduction, make sure inexact flag not raised if input - * is an integer - */ - z = floorf(y); - if(z!=y) { /* inexact anyway */ - y *= (float)0.5; - y = (float)2.0*(y - floorf(y)); /* y = |x| mod 2.0 */ - n = (LONG) (y*(float)4.0); - } else { - if(ix>=0x4b800000) { - y = zero; n = 0; /* y must be even */ - } else { - if(ix<0x4b000000) z = y+two23; /* exact */ - GET_FLOAT_WORD(n,z); - n &= 1; - y = n; - n<<= 2; - } - } - switch (n) { - case 0: y = __kernel_sinf(pi*y,zero,0); break; - case 1: - case 2: y = __kernel_cosf(pi*((float)0.5-y),zero); break; - case 3: - case 4: y = __kernel_sinf(pi*(one-y),zero,0); break; - case 5: - case 6: y = -__kernel_cosf(pi*(y-(float)1.5),zero); break; - default: y = __kernel_sinf(pi*(y-(float)2.0),zero,0); break; - } - return -y; -} - - -float -lgammaf(float x) -{ - float t,y,z,nadj=0.0,p,p1,p2,p3,q,r,w; - LONG i,hx,ix; - - GET_FLOAT_WORD(hx,x); - - /* purge off +-inf, NaN, +-0, and negative arguments */ - ix = hx&0x7fffffff; - if(ix>=0x7f800000) return x*x; - if(ix==0) return one/zero; - if(ix<0x1c800000) { /* |x|<2**-70, return -log(|x|) */ - if(hx<0) { - return -logf(-x); - } else return -logf(x); - } - if(hx<0) { - if(ix>=0x4b000000) /* |x|>=2**23, must be -integer */ - return one/zero; - t = sin_pif(x); - if(t==zero) return one/zero; /* -integer */ - nadj = logf(pi/fabsf(t*x)); - x = -x; - } - - /* purge off 1 and 2 */ - if (ix==0x3f800000||ix==0x40000000) r = 0; - /* for x < 2.0 */ - else if(ix<0x40000000) { - if(ix<=0x3f666666) { /* lgamma(x) = lgamma(x+1)-log(x) */ - r = -logf(x); - if(ix>=0x3f3b4a20) {y = one-x; i= 0;} - else if(ix>=0x3e6d3308) {y= x-(tc-one); i=1;} - else {y = x; i=2;} - } else { - r = zero; - if(ix>=0x3fdda618) {y=(float)2.0-x;i=0;} /* [1.7316,2] */ - else if(ix>=0x3F9da620) {y=x-tc;i=1;} /* [1.23,1.73] */ - else {y=x-one;i=2;} - } - switch(i) { - case 0: - z = y*y; - p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10)))); - p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11))))); - p = y*p1+p2; - r += (p-(float)0.5*y); break; - case 1: - z = y*y; - w = z*y; - p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */ - p2 = t1+w*(t4+w*(t7+w*(t10+w*t13))); - p3 = t2+w*(t5+w*(t8+w*(t11+w*t14))); - p = z*p1-(tt-w*(p2+y*p3)); - r += (tf + p); break; - case 2: - p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5))))); - p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5)))); - r += (-(float)0.5*y + p1/p2); - } - } - else if(ix<0x41000000) { /* x < 8.0 */ - i = (LONG)x; - t = zero; - y = x-(float)i; - p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6)))))); - q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6))))); - r = half*y+p/q; - z = one; /* lgamma(1+s) = log(s) + lgamma(s) */ - switch(i) { - case 7: z *= (y+(float)6.0); /* FALLTHRU */ - case 6: z *= (y+(float)5.0); /* FALLTHRU */ - case 5: z *= (y+(float)4.0); /* FALLTHRU */ - case 4: z *= (y+(float)3.0); /* FALLTHRU */ - case 3: z *= (y+(float)2.0); /* FALLTHRU */ - r += logf(z); break; - } - /* 8.0 <= x < 2**58 */ - } else if (ix < 0x5c800000) { - t = logf(x); - z = one/x; - y = z*z; - w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6))))); - r = (x-half)*(t-one)+w; - } else - /* 2**58 <= x <= inf */ - r = x*(logf(x)-one); - if(hx<0) r = nadj - r; - return r; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_log.c b/library/math_log.c deleted file mode 100644 index 8a15222..0000000 --- a/library/math_log.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * $Id: math_log.c,v 1.6 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __log(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___log - -___log: - - movel a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-84:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__log(double x) -{ - double result; - - result = IEEEDPLog(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__log(double x) -{ - double result; - - __asm ("flogn%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(__PPC__) - -static const double -ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ -ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ -two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ -Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ -Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ -Lg3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */ -Lg4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ -Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ -Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ -Lg7 = 1.479819860511658591e-01, /* 3FC2F112 DF3E5244 */ -zero = 0.0; - -INLINE STATIC const double -__log(double x) -{ - double hfsq,f,s,z,R,w,t1,t2,dk; - int k,hx,i,j; - unsigned int lx; - - EXTRACT_WORDS(hx,lx,x); - - k=0; - if (hx < 0x00100000) /* x < 2**-1022 */ - { - if (((hx&0x7fffffff)|lx)==0) - return -two54/zero; /* log(+-0)=-inf */ - if (hx<0) - return (x-x)/zero; /* log(-#) = NaN */ - k -= 54; - x *= two54; /* subnormal number, scale up x */ - GET_HIGH_WORD(hx,x); - } - - if (hx >= 0x7ff00000) - return x+x; - - k += (hx>>20)-1023; - hx &= 0x000fffff; - i = (hx+0x95f64)&0x100000; - - SET_HIGH_WORD(x,hx|(i^0x3ff00000)); /* normalize x or x/2 */ - - k += (i>>20); - f = x-1.0; - - if((0x000fffff&(2+hx))<3) /* |f| < 2**-20 */ - { - if(f==zero) - { - if(k==0) - return zero; - else - { - dk=(double)k; - return dk*ln2_hi+dk*ln2_lo; - } - } - - R = f*f*(0.5-0.33333333333333333*f); - - if(k==0) - return f-R; - else - { - dk=(double)k; - return dk*ln2_hi-((R-dk*ln2_lo)-f); - } - } - - s = f/(2.0+f); - dk = (double)k; - z = s*s; - i = hx-0x6147a; - w = z*z; - j = 0x6b851-hx; - t1= w*(Lg2+w*(Lg4+w*Lg6)); - t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); - i |= j; - R = t2+t1; - - if(i>0) - { - hfsq=0.5*f*f; - if(k==0) - return f-(hfsq-s*(hfsq+R)); - else - return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f); - } - else - { - if(k==0) - return f-s*(f-R); - else - return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); - } -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -log(double x) -{ - double result; - - if(x > DBL_EPSILON) - { - result = __log(x); - } - else - { - __set_errno(ERANGE); - - /* This should really be minus infinity. */ - result = (-__get_huge_val()); - } - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_log10.c b/library/math_log10.c deleted file mode 100644 index 87014cf..0000000 --- a/library/math_log10.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - * $Id: math_log10.c,v 1.5 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __log10(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___log10 - -___log10: - - movel a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-126:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__log10(double x) -{ - double result; - - result = IEEEDPLog10(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__log10(double x) -{ - double result; - - __asm ("flog10%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -static const double -two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ -ivln10 = 4.34294481903251816668e-01, /* 0x3FDBCB7B, 0x1526E50E */ -log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */ -log10_2lo = 3.69423907715893078616e-13, /* 0x3D59FEF3, 0x11F12B36 */ -zero = 0.0; - -INLINE STATIC const double -__log10(double x) -{ - double y,z; - int i,k,hx; - unsigned int lx; - - EXTRACT_WORDS(hx,lx,x); - - k=0; - if (hx < 0x00100000) /* x < 2**-1022 */ - { - if (((hx&0x7fffffff)|lx)==0) - return -two54/zero; /* log(+-0)=-inf */ - if (hx<0) - return (x-x)/zero; /* log(-#) = NaN */ - k -= 54; x *= two54; /* subnormal number, scale up x */ - GET_HIGH_WORD(hx,x); - } - - if (hx >= 0x7ff00000) - return x+x; - - k += (hx>>20)-1023; - i = ((unsigned int)k&0x80000000)>>31; - hx = (hx&0x000fffff)|((0x3ff-i)<<20); - y = (double)(k+i); - SET_HIGH_WORD(x,hx); - z = y*log10_2lo + ivln10*log(x); - - return z+y*log10_2hi; -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -log10(double x) -{ - double result; - - if(x > DBL_EPSILON) - { - result = __log10(x); - } - else - { - __set_errno(ERANGE); - - /* This should really be minus infinity. */ - result = (-__get_huge_val()); - } - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_log10f.c b/library/math_log10f.c deleted file mode 100644 index c5ec416..0000000 --- a/library/math_log10f.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * $Id: math_log10f.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -two25 = 3.3554432000e+07, /* 0x4c000000 */ -ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */ -log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */ -log10_2lo = 7.9034151668e-07; /* 0x355427db */ - -static const float zero = 0.0; - -float -log10f(float x) -{ - float y,z; - LONG i,k,hx; - - GET_FLOAT_WORD(hx,x); - - k=0; - if (hx < 0x00800000) { /* x < 2**-126 */ - if ((hx&0x7fffffff)==0) - return -two25/zero; /* log(+-0)=-inf */ - if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ - k -= 25; x *= two25; /* subnormal number, scale up x */ - GET_FLOAT_WORD(hx,x); - } - if (hx >= 0x7f800000) return x+x; - k += (hx>>23)-127; - i = ((ULONG)k&0x80000000U)>>31; - hx = (hx&0x007fffff)|((0x7f-i)<<23); - y = (float)(k+i); - SET_FLOAT_WORD(x,hx); - z = y*log10_2lo + ivln10*logf(x); - return z+y*log10_2hi; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_log1p.c b/library/math_log1p.c deleted file mode 100644 index da9881f..0000000 --- a/library/math_log1p.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * $Id: math_log1p.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double -ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ -ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ -two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ -Lp1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ -Lp2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ -Lp3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */ -Lp4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ -Lp5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ -Lp6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ -Lp7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ - -static const double zero = 0.0; - -double -log1p(double x) -{ - double hfsq,f=0.0,c=0.0,s,z,R; - volatile double u; /* so GCC never optimizes it away */ - LONG k,hx,hu=0.0,ax; - - GET_HIGH_WORD(hx,x); - ax = hx&0x7fffffff; - - k = 1; - if (hx < 0x3FDA827A) { /* x < 0.41422 */ - if(ax>=0x3ff00000) /* x <= -1.0 */ - return log(1+x); /* log1p(-1) */ - if(ax<0x3e200000) { /* |x| < 2**-29 */ - if(two54+x>zero /* raise inexact */ - &&ax<0x3c900000) /* |x| < 2**-54 */ - return x; - else - return x - x*x*0.5; - } - if(hx>0||hx<=((LONG)0xbfd2bec3U)) { - k=0;f=x;hu=1;} /* -0.2929= 0x7ff00000) return x+x; - if(k!=0) { - if(hx<0x43400000) { - u = 1.0+x; - GET_HIGH_WORD(hu,u); - k = (hu>>20)-1023; - c = (k>0)? 1.0-(u-x):x-(u-1.0);/* correction term */ - c /= u; - } else { - u = x; - GET_HIGH_WORD(hu,u); - k = (hu>>20)-1023; - c = 0; - } - hu &= 0x000fffff; - if(hu<0x6a09e) { - SET_HIGH_WORD(u,hu|0x3ff00000); /* normalize u */ - } else { - k += 1; - SET_HIGH_WORD(u,hu|0x3fe00000); /* normalize u/2 */ - hu = (0x00100000-hu)>>2; - } - f = u-1.0; - } - hfsq=0.5*f*f; - if(hu==0) { /* |f| < 2**-20 */ - if(f==zero) { if(k==0) return zero; - else {c += k*ln2_lo; return k*ln2_hi+c;} - } - R = hfsq*(1.0-0.66666666666666666*f); - if(k==0) return f-R; else - return k*ln2_hi-((R-(k*ln2_lo+c))-f); - } - s = f/(2.0+f); - z = s*s; - R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7)))))); - if(k==0) return f-(hfsq-s*(hfsq+R)); else - return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_log1pf.c b/library/math_log1pf.c deleted file mode 100644 index 2816755..0000000 --- a/library/math_log1pf.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * $Id: math_log1pf.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -ln2_hi = 6.9313812256e-01, /* 0x3f317180 */ -ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */ -two25 = 3.355443200e+07, /* 0x4c000000 */ -Lp1 = 6.6666668653e-01, /* 3F2AAAAB */ -Lp2 = 4.0000000596e-01, /* 3ECCCCCD */ -Lp3 = 2.8571429849e-01, /* 3E924925 */ -Lp4 = 2.2222198546e-01, /* 3E638E29 */ -Lp5 = 1.8183572590e-01, /* 3E3A3325 */ -Lp6 = 1.5313838422e-01, /* 3E1CD04F */ -Lp7 = 1.4798198640e-01; /* 3E178897 */ - -static const float zero = 0.0; - -float -log1pf(float x) -{ - float hfsq,f=0.0,c=0.0,s,z,R; - volatile float u; /* so GCC doesn't optimize it away */ - LONG k,hx,hu=0.0,ax; - - GET_FLOAT_WORD(hx,x); - ax = hx&0x7fffffff; - - k = 1; - if (hx < 0x3ed413d7) { /* x < 0.41422 */ - if(ax>=0x3f800000) /* x <= -1.0 */ - return logf(1+x); /* log1p(x<=-1) */ - if(ax<0x31000000) { /* |x| < 2**-29 */ - if(two25+x>zero /* raise inexact */ - &&ax<0x24800000) /* |x| < 2**-54 */ - return x; - else - return x - x*x*(float)0.5; - } - if(hx>0||hx<=((LONG)0xbe95f61fU)) { - k=0;f=x;hu=1;} /* -0.2929= 0x7f800000) return x+x; - if(k!=0) { - if(hx<0x5a000000) { - u = (float)1.0+x; - GET_FLOAT_WORD(hu,u); - k = (hu>>23)-127; - /* correction term */ - c = (k>0)? (float)1.0-(u-x):x-(u-(float)1.0); - c /= u; - } else { - u = x; - GET_FLOAT_WORD(hu,u); - k = (hu>>23)-127; - c = 0; - } - hu &= 0x007fffff; - if(hu<0x3504f7) { - SET_FLOAT_WORD(u,hu|0x3f800000);/* normalize u */ - } else { - k += 1; - SET_FLOAT_WORD(u,hu|0x3f000000); /* normalize u/2 */ - hu = (0x00800000-hu)>>2; - } - f = u-(float)1.0; - } - hfsq=(float)0.5*f*f; - if(hu==0) { /* |f| < 2**-20 */ - if(f==zero) { if(k==0) return zero; - else {c += k*ln2_lo; return k*ln2_hi+c;} - } - R = hfsq*((float)1.0-(float)0.66666666666666666*f); - if(k==0) return f-R; else - return k*ln2_hi-((R-(k*ln2_lo+c))-f); - } - s = f/((float)2.0+f); - z = s*s; - R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7)))))); - if(k==0) return f-(hfsq-s*(hfsq+R)); else - return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_log2.c b/library/math_log2.c deleted file mode 100644 index 85bf8e5..0000000 --- a/library/math_log2.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: math_log2.c,v 1.2 2005-06-26 09:06:11 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -log2(double x) -{ - return(log(x) / log(2.0)); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_log2f.c b/library/math_log2f.c deleted file mode 100644 index 1bc02bc..0000000 --- a/library/math_log2f.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: math_log2f.c,v 1.2 2005-06-26 09:06:11 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -log2f(float x) -{ - return(logf(x) / logf(2.0)); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_logb.c b/library/math_logb.c deleted file mode 100644 index 23ee8d1..0000000 --- a/library/math_logb.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * $Id: math_logb.c,v 1.6 2005-05-08 08:51:29 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) || defined(M68881_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -INLINE STATIC const double -__logb(double x) -{ - double result; - - result = log(x) / log((double)FLT_RADIX); - - return(result); -} - -#endif /* IEEE_FLOATING_POINT_SUPPORT || M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__logb(double x) -{ - unsigned int lx,ix; - - EXTRACT_WORDS(ix,lx,x); - - ix &= 0x7fffffff; /* high |x| */ - if((ix|lx)==0) - return -1.0/fabs(x); - - if(ix>=0x7ff00000) - return x*x; - - if((ix>>=20)==0) /* IEEE 754 logb */ - return -1022.0; - else - return (double) (ix-1023); -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -logb(double x) -{ - double result; - - if(x == 0.0) - { - result = -__get_huge_val(); - goto out; - } - - if(isnan(x)) - { - result = x; - goto out; - } - - if(isinf(x)) - { - if(x < 0) - result = (-x); - else - result = x; - - goto out; - } - - result = __logb(x); - - out: - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_logbf.c b/library/math_logbf.c deleted file mode 100644 index 3a3ebe1..0000000 --- a/library/math_logbf.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: math_logbf.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -logbf(float x) -{ - LONG ix; - GET_FLOAT_WORD(ix,x); - ix &= 0x7fffffff; /* high |x| */ - if(ix==0) return (float)-1.0/fabsf(x); - if(ix>=0x7f800000) return x*x; - if((ix>>=23)==0) /* IEEE 754 logb */ - return -126.0; - else - return (float) (ix-127); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_logf.c b/library/math_logf.c deleted file mode 100644 index c365ce6..0000000 --- a/library/math_logf.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * $Id: math_logf.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -ln2_hi = 6.9313812256e-01, /* 0x3f317180 */ -ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */ -two25 = 3.355443200e+07, /* 0x4c000000 */ -Lg1 = 6.6666668653e-01, /* 3F2AAAAB */ -Lg2 = 4.0000000596e-01, /* 3ECCCCCD */ -Lg3 = 2.8571429849e-01, /* 3E924925 */ -Lg4 = 2.2222198546e-01, /* 3E638E29 */ -Lg5 = 1.8183572590e-01, /* 3E3A3325 */ -Lg6 = 1.5313838422e-01, /* 3E1CD04F */ -Lg7 = 1.4798198640e-01; /* 3E178897 */ - -static const float zero = 0.0; - -float -logf(float x) -{ - float hfsq,f,s,z,R,w,t1,t2,dk; - LONG k,ix,i,j; - - GET_FLOAT_WORD(ix,x); - - k=0; - if (ix < 0x00800000) { /* x < 2**-126 */ - if ((ix&0x7fffffff)==0) - return -two25/zero; /* log(+-0)=-inf */ - if (ix<0) return (x-x)/zero; /* log(-#) = NaN */ - k -= 25; x *= two25; /* subnormal number, scale up x */ - GET_FLOAT_WORD(ix,x); - } - if (ix >= 0x7f800000) return x+x; - k += (ix>>23)-127; - ix &= 0x007fffff; - i = (ix+(0x95f64<<3))&0x800000; - SET_FLOAT_WORD(x,ix|(i^0x3f800000)); /* normalize x or x/2 */ - k += (i>>23); - f = x-(float)1.0; - if((0x007fffff&(15+ix))<16) { /* |f| < 2**-20 */ - if(f==zero) { if(k==0) return zero; else {dk=(float)k; - return dk*ln2_hi+dk*ln2_lo;} - } - R = f*f*((float)0.5-(float)0.33333333333333333*f); - if(k==0) return f-R; else {dk=(float)k; - return dk*ln2_hi-((R-dk*ln2_lo)-f);} - } - s = f/((float)2.0+f); - dk = (float)k; - z = s*s; - i = ix-(0x6147a<<3); - w = z*z; - j = (0x6b851<<3)-ix; - t1= w*(Lg2+w*(Lg4+w*Lg6)); - t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); - i |= j; - R = t2+t1; - if(i>0) { - hfsq=(float)0.5*f*f; - if(k==0) return f-(hfsq-s*(hfsq+R)); else - return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f); - } else { - if(k==0) return f-s*(f-R); else - return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_lrint.c b/library/math_lrint.c deleted file mode 100755 index fcca4d0..0000000 --- a/library/math_lrint.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_lrint.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -long int -lrint(double x) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_lrintf.c b/library/math_lrintf.c deleted file mode 100755 index c241bc8..0000000 --- a/library/math_lrintf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_lrintf.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -long int -lrintf(float x) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_lround.c b/library/math_lround.c deleted file mode 100644 index 7a5c8e3..0000000 --- a/library/math_lround.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_lround.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -long int -lround(double x) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_lroundf.c b/library/math_lroundf.c deleted file mode 100755 index 1f4ad51..0000000 --- a/library/math_lroundf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_lroundf.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -long int -lroundf(float x) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_ltdf2.c b/library/math_ltdf2.c deleted file mode 100644 index 2452b6b..0000000 --- a/library/math_ltdf2.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: math_ltdf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___ltdf2 - -___ltdf2: - - moveml d2/d3/a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(16),d0/d1/d2/d3 - jsr a6@(-42:W) - moveml sp@+,d2/d3/a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_ltsf2.c b/library/math_ltsf2.c deleted file mode 100644 index da85ed5..0000000 --- a/library/math_ltsf2.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: math_ltsf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -float -__ltsf2(float x,float y) -{ - float result; - - result = IEEESPCmp(x,y); - - return(result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_modf.c b/library/math_modf.c deleted file mode 100644 index 983d1cd..0000000 --- a/library/math_modf.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * $Id: math_modf.c,v 1.5 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _STDLIB_NULL_POINTER_CHECK_H -#include "stdlib_null_pointer_check.h" -#endif /* _STDLIB_NULL_POINTER_CHECK_H */ - -/****************************************************************************/ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__modf(double x,double *nptr) -{ - double int_n; - double result; - - if(x < 0.0) - { - int_n = ceil(x); - - result = int_n - x; - } - else - { - int_n = floor(x); - - result = x - int_n; - } - - (*nptr) = int_n; - - return(result); -} - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__modf(double x,double *nptr) -{ - double result; - double temp; - - __asm ("fintrz%.x %1,%0" - : "=f" (temp) /* integer-valued float */ - : "f" (x)); - - (*nptr) = temp; - - result = x - temp; - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(__PPC__) - -INLINE STATIC const double -__modf(double x,double *nptr) -{ - double int_n; - double result; - - if(x < 0.0) - { - int_n = ceil(x); - - result = int_n - x; - } - else - { - int_n = floor(x); - - result = x - int_n; - } - - (*nptr) = int_n; - - return(result); -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -modf(double x,double *nptr) -{ - double result; - - assert( nptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(nptr == NULL) - { - __set_errno(EFAULT); - - result = __get_huge_val(); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = __modf(x,nptr); - - out: - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_modff.c b/library/math_modff.c deleted file mode 100644 index fc522b3..0000000 --- a/library/math_modff.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * $Id: math_modff.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float one = 1.0, Zero[] = {0.0, -0.0,}; - -float -fmodf(float x, float y) -{ - LONG n,hx,hy,hz,ix,iy,sx,i; - - GET_FLOAT_WORD(hx,x); - GET_FLOAT_WORD(hy,y); - sx = hx&0x80000000U; /* sign of x */ - hx ^=sx; /* |x| */ - hy &= 0x7fffffff; /* |y| */ - - /* purge off exception values */ - if(hy==0||(hx>=0x7f800000)|| /* y=0,or x not finite */ - (hy>0x7f800000)) /* or y is NaN */ - return (x*y)/(x*y); - if(hx>31]; /* |x|=|y| return x*0*/ - - /* determine ix = ilogb(x) */ - if(hx<0x00800000) { /* subnormal x */ - for (ix = -126,i=(hx<<8); i>0; i<<=1) ix -=1; - } else ix = (hx>>23)-127; - - /* determine iy = ilogb(y) */ - if(hy<0x00800000) { /* subnormal y */ - for (iy = -126,i=(hy<<8); i>=0; i<<=1) iy -=1; - } else iy = (hy>>23)-127; - - /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -126) - hx = 0x00800000|(0x007fffff&hx); - else { /* subnormal x, shift x to normal */ - n = -126-ix; - hx = hx<= -126) - hy = 0x00800000|(0x007fffff&hy); - else { /* subnormal y, shift y to normal */ - n = -126-iy; - hy = hy<>31]; - hx = hz+hz; - } - } - hz=hx-hy; - if(hz>=0) {hx=hz;} - - /* convert back to floating value and restore the sign */ - if(hx==0) /* return sign(x)*0 */ - return Zero[(ULONG)sx>>31]; - while(hx<0x00800000) { /* normalize x */ - hx = hx+hx; - iy -= 1; - } - if(iy>= -126) { /* normalize output */ - hx = ((hx-0x00800000)|((iy+127)<<23)); - SET_FLOAT_WORD(x,hx|sx); - } else { /* subnormal output */ - n = -126 - iy; - hx >>= n; - SET_FLOAT_WORD(x,hx|sx); - x *= one; /* create necessary signal */ - } - return x; /* exact output */ -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_muldf3.c b/library/math_muldf3.c deleted file mode 100644 index b80404c..0000000 --- a/library/math_muldf3.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: math_muldf3.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___muldf3 - -___muldf3: - - moveml d2/d3/a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(16),d0/d1/d2/d3 - jsr a6@(-78:W) - moveml sp@+,d2/d3/a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_mulsf3.c b/library/math_mulsf3.c deleted file mode 100644 index 0fbe4a5..0000000 --- a/library/math_mulsf3.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: math_mulsf3.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -float -__mulsf3(float x,float y) -{ - float result; - - result = IEEESPMul(x,y); - - return(result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_nan.c b/library/math_nan.c deleted file mode 100644 index d936151..0000000 --- a/library/math_nan.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $Id: math_nan.c,v 1.2 2005-05-14 10:52:31 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#if defined (FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -double -nan(const char * UNUSED tagp) -{ - union ieee_double x; - - /* Exponent = 2047 and fraction != 0.0; this must be a quiet nan. */ - x.raw[0] = 0x7ff80000; - x.raw[1] = 0x00000001; - - return(x.value); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_nanf.c b/library/math_nanf.c deleted file mode 100644 index 56a9742..0000000 --- a/library/math_nanf.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * $Id: math_nanf.c,v 1.2 2005-05-14 10:52:31 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#if defined (FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -float -nanf(const char * UNUSED tagp) -{ - union ieee_single x; - - /* Exponent = 255 and fraction != 0.0; this must be a quiet nan. */ - x.raw[0] = 0x7fc00001; - - return(x.value); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_nearbyint.c b/library/math_nearbyint.c deleted file mode 100644 index 17e2f02..0000000 --- a/library/math_nearbyint.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_nearbyint.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -nearbyint(double x) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_nearbyintf.c b/library/math_nearbyintf.c deleted file mode 100644 index 9e56b85..0000000 --- a/library/math_nearbyintf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_nearbyintf.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -nearbyintf(float x) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_nedf2.c b/library/math_nedf2.c deleted file mode 100644 index cf59bdf..0000000 --- a/library/math_nedf2.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: math_nedf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___nedf2 - -___nedf2: - - moveml d2/d3/a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(16),d0/d1/d2/d3 - jsr a6@(-42:W) - moveml sp@+,d2/d3/a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_negdf2.c b/library/math_negdf2.c deleted file mode 100644 index 08c8cbf..0000000 --- a/library/math_negdf2.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: math_negdf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___negdf2 - -___negdf2: - - movel a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-60:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_negsf2.c b/library/math_negsf2.c deleted file mode 100644 index e5e06d0..0000000 --- a/library/math_negsf2.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: math_negsf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -float -__negsf2(float x) -{ - float result; - - result = IEEESPNeg(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_nesf2.c b/library/math_nesf2.c deleted file mode 100644 index fc7a0e7..0000000 --- a/library/math_nesf2.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: math_nesf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -float -__nesf2(float x,float y) -{ - float result; - - result = IEEESPCmp(x,y); - - return(result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_nextafter.c b/library/math_nextafter.c deleted file mode 100644 index 094d943..0000000 --- a/library/math_nextafter.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * $Id: math_nextafter.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -nextafter(double x,double y) -{ - long hx,hy,ix,iy; - unsigned long lx,ly; - - EXTRACT_WORDS(hx,lx,x); - EXTRACT_WORDS(hy,ly,y); - ix = hx&0x7fffffff; /* |x| */ - iy = hy&0x7fffffff; /* |y| */ - - if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */ - ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */ - return x+y; - if(x==y) return x; /* x=y, return x */ - if((ix|lx)==0) { /* x == 0 */ - INSERT_WORDS(x,hy&0x80000000U,1); /* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ - } - if(hx>=0) { /* x > 0 */ - if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */ - if(lx==0) hx -= 1; - lx -= 1; - } else { /* x < y, x += ulp */ - lx += 1; - if(lx==0) hx += 1; - } - } else { /* x < 0 */ - if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))){/* x < y, x -= ulp */ - if(lx==0) hx -= 1; - lx -= 1; - } else { /* x > y, x += ulp */ - lx += 1; - if(lx==0) hx += 1; - } - } - hy = hx&0x7ff00000; - if(hy>=0x7ff00000) return x+x; /* overflow */ - if(hy<0x00100000) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - INSERT_WORDS(y,hx,lx); - return y; - } - } - INSERT_WORDS(x,hx,lx); - return x; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_nextafterf.c b/library/math_nextafterf.c deleted file mode 100644 index d4854d4..0000000 --- a/library/math_nextafterf.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * $Id: math_nextafterf.c,v 1.2 2005-05-29 08:19:36 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -nextafterf(float x, float y) -{ - long hx,hy,ix,iy; - - GET_FLOAT_WORD(hx,x); - GET_FLOAT_WORD(hy,y); - ix = hx&0x7fffffff; /* |x| */ - iy = hy&0x7fffffff; /* |y| */ - - if((ix>0x7f800000) || /* x is nan */ - (iy>0x7f800000)) /* y is nan */ - return (float)(x+y); - if(x==y) return x; /* x=y, return x */ - if(ix==0) { /* x == 0 */ - SET_FLOAT_WORD(x,(hy&0x80000000U)|1);/* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ - } - if(hx>=0) { /* x > 0 */ - if(hx>hy) { /* x > y, x -= ulp */ - hx -= 1; - } else { /* x < y, x += ulp */ - hx += 1; - } - } else { /* x < 0 */ - if(hy>=0||hx>hy){ /* x < y, x -= ulp */ - hx -= 1; - } else { /* x > y, x += ulp */ - hx += 1; - } - } - hy = hx&0x7f800000; - if(hy>=0x7f800000) return (float)(x+x); /* overflow */ - if(hy<0x00800000) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(y,hx); - return y; - } - } - SET_FLOAT_WORD(x,hx); - return x; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_pow.c b/library/math_pow.c deleted file mode 100644 index 3cca6a9..0000000 --- a/library/math_pow.c +++ /dev/null @@ -1,467 +0,0 @@ -/* - * $Id: math_pow.c,v 1.6 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __pow(double x,double y); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___pow - -___pow: - - moveml d2/d3/a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - moveml sp@(16),d0/d1 | Note that the parameters - moveml sp@(24),d2/d3 | are reversed! - jsr a6@(-90:W) - moveml sp@+,d2/d3/a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__pow(double x,double y) -{ - double result; - - /* NOTE: order of parameters is reversed! */ - result = IEEEDPPow(y,x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__exp(double x) -{ - double result; - - __asm ("fetox%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -INLINE STATIC const double -__log(double x) -{ - double result; - - __asm ("flogn%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -INLINE STATIC const double -__pow(double x,double y) -{ - double result; - - if(x > 0) - { - result = __exp(y * __log(x)); - } - else - { - int i = (int)y; - - if((i & 1) == 0) /* even */ - result = __exp(y) * __log(-x); - else - result = -(__exp(y) * __log(-x)); - } - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(__PPC__) - -/****************************************************************************/ - -static const double -bp[] = {1.0, 1.5,}, -dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ -dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ -zero = 0.0, -one = 1.0, -two = 2.0, -two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */ -huge = 1.0e300, -tiny = 1.0e-300, - /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */ -L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */ -L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */ -L3 = 3.33333329818377432918e-01, /* 0x3FD55555, 0x518F264D */ -L4 = 2.72728123808534006489e-01, /* 0x3FD17460, 0xA91D4101 */ -L5 = 2.30660745775561754067e-01, /* 0x3FCD864A, 0x93C9DB65 */ -L6 = 2.06975017800338417784e-01, /* 0x3FCA7E28, 0x4A454EEF */ -P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */ -P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */ -P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */ -P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */ -P5 = 4.13813679705723846039e-08, /* 0x3E663769, 0x72BEA4D0 */ -lg2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ -lg2_h = 6.93147182464599609375e-01, /* 0x3FE62E43, 0x00000000 */ -lg2_l = -1.90465429995776804525e-09, /* 0xBE205C61, 0x0CA86C39 */ -ovt = 8.0085662595372944372e-0017, /* -(1024-log2(ovfl+.5ulp)) */ -cp = 9.61796693925975554329e-01, /* 0x3FEEC709, 0xDC3A03FD =2/(3ln2) */ -cp_h = 9.61796700954437255859e-01, /* 0x3FEEC709, 0xE0000000 =(float)cp */ -cp_l = -7.02846165095275826516e-09, /* 0xBE3E2FE0, 0x145B01F5 =tail of cp_h*/ -ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */ -ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/ -ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ - -INLINE STATIC const double -__pow(double x,double y) -{ - double z,ax,z_h,z_l,p_h,p_l; - double y1,t1,t2,r,s,t,u,v,w; - int i,j,k,yisint,n; - int hx,hy,ix,iy; - unsigned int lx,ly; - - EXTRACT_WORDS(hx,lx,x); - EXTRACT_WORDS(hy,ly,y); - ix = hx&0x7fffffff; iy = hy&0x7fffffff; - - /* y==zero: x**0 = 1 */ - if((iy|ly)==0) return one; - - /* +-NaN return x+y */ - if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || - iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) - return x+y; - - /* determine if y is an odd int when x < 0 - * yisint = 0 ... y is not an integer - * yisint = 1 ... y is an odd int - * yisint = 2 ... y is an even int - */ - yisint = 0; - if(hx<0) { - if(iy>=0x43400000) yisint = 2; /* even integer y */ - else if(iy>=0x3ff00000) { - k = (iy>>20)-0x3ff; /* exponent */ - if(k>20) { - j = ly>>(52-k); - if((j<<(52-k))==ly) yisint = 2-(j&1); - } else if(ly==0) { - j = iy>>(20-k); - if((j<<(20-k))==iy) yisint = 2-(j&1); - } - } - } - - /* special value of y */ - if(ly==0) { - if (iy==0x7ff00000) { /* y is +-inf */ - if(((ix-0x3ff00000)|lx)==0) - return y - y; /* inf**+-1 is NaN */ - else if (ix >= 0x3ff00000)/* (|x|>1)**+-inf = inf,0 */ - return (hy>=0)? y: zero; - else /* (|x|<1)**-,+inf = inf,0 */ - return (hy<0)?-y: zero; - } - if(iy==0x3ff00000) { /* y is +-1 */ - if(hy<0) return one/x; else return x; - } - if(hy==0x40000000) return x*x; /* y is 2 */ - if(hy==0x3fe00000) { /* y is 0.5 */ - if(hx>=0) /* x >= +0 */ - return sqrt(x); - } - } - - ax = fabs(x); - /* special value of x */ - if(lx==0) { - if(ix==0x7ff00000||ix==0||ix==0x3ff00000){ - z = ax; /*x is +-0,+-inf,+-1*/ - if(hy<0) z = one/z; /* z = (1/|x|) */ - if(hx<0) { - if(((ix-0x3ff00000)|yisint)==0) { - z = (z-z)/(z-z); /* (-1)**non-int is NaN */ - } else if(yisint==1) - z = -z; /* (x<0)**odd = -(|x|**odd) */ - } - return z; - } - } - - /* (x<0)**(non-int) is NaN */ - n = ((unsigned int)hx>>31)+1; - if((n|yisint)==0) return (x-x)/(x-x); - - s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ - if((n|(yisint-1))==0) - s = -one;/* (-ve)**(odd int) */ - - /* |y| is huge */ - if(iy>0x41e00000) { /* if |y| > 2**31 */ - if(iy>0x43f00000){ /* if |y| > 2**64, must o/uflow */ - if(ix<=0x3fefffff) return (hy<0)? huge*huge:tiny*tiny; - if(ix>=0x3ff00000) return (hy>0)? huge*huge:tiny*tiny; - } - /* over/underflow if x is not close to one */ - if(ix<0x3fefffff) return (hy<0)? s*huge*huge:s*tiny*tiny; - if(ix>0x3ff00000) return (hy>0)? s*huge*huge:s*tiny*tiny; - /* now |1-x| is tiny <= 2**-20, suffice to compute - log(x) by x-x^2/2+x^3/3-x^4/4 */ - t = ax-one; /* t has 20 trailing zeros */ - w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25)); - u = ivln2_h*t; /* ivln2_h has 21 sig. bits */ - v = t*ivln2_l-w*ivln2; - t1 = u+v; - SET_LOW_WORD(t1,0); - t2 = v-(t1-u); - } else { - double ss,s2,s_h,s_l,t_h,t_l; - n = 0; - /* take care subnormal number */ - if(ix<0x00100000) - {ax *= two53; n -= 53; GET_HIGH_WORD(ix,ax); } - n += ((ix)>>20)-0x3ff; - j = ix&0x000fffff; - /* determine interval */ - ix = j|0x3ff00000; /* normalize ix */ - if(j<=0x3988E) k=0; /* |x|>1)|0x20000000)+0x00080000+(k<<18)); - t_l = ax - (t_h-bp[k]); - s_l = v*((u-s_h*t_h)-s_h*t_l); - /* compute log(ax) */ - s2 = ss*ss; - r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); - r += s_l*(s_h+ss); - s2 = s_h*s_h; - t_h = 3.0+s2+r; - SET_LOW_WORD(t_h,0); - t_l = r-((t_h-3.0)-s2); - /* u+v = ss*(1+...) */ - u = s_h*t_h; - v = s_l*t_h+t_l*ss; - /* 2/(3log2)*(ss+...) */ - p_h = u+v; - SET_LOW_WORD(p_h,0); - p_l = v-(p_h-u); - z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ - z_l = cp_l*p_h+p_l*cp+dp_l[k]; - /* log2(ax) = (ss+..)*2/(3*log2) = n + dp_h + z_h + z_l */ - t = (double)n; - t1 = (((z_h+z_l)+dp_h[k])+t); - SET_LOW_WORD(t1,0); - t2 = z_l-(((t1-t)-dp_h[k])-z_h); - } - - /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ - y1 = y; - SET_LOW_WORD(y1,0); - p_l = (y-y1)*t1+y*t2; - p_h = y1*t1; - z = p_l+p_h; - EXTRACT_WORDS(j,i,z); - if (j>=0x40900000) { /* z >= 1024 */ - if(((j-0x40900000)|i)!=0) /* if z > 1024 */ - return s*huge*huge; /* overflow */ - else { - if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */ - } - } else if((j&0x7fffffff)>=0x4090cc00 ) { /* z <= -1075 */ - if(((j-0xc090cc00)|i)!=0) /* z < -1075 */ - return s*tiny*tiny; /* underflow */ - else { - if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */ - } - } - /* - * compute 2**(p_h+p_l) - */ - i = j&0x7fffffff; - k = (i>>20)-0x3ff; - n = 0; - if(i>0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */ - n = j+(0x00100000>>(k+1)); - k = ((n&0x7fffffff)>>20)-0x3ff; /* new k for n */ - t = zero; - SET_HIGH_WORD(t,n&~(0x000fffff>>k)); - n = ((n&0x000fffff)|0x00100000)>>(20-k); - if(j<0) n = -n; - p_h -= t; - } - t = p_l+p_h; - SET_LOW_WORD(t,0); - u = t*lg2_h; - v = (p_l-(t-p_h))*lg2+t*lg2_l; - z = u+v; - w = v-(z-u); - t = z*z; - t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); - r = (z*t1)/(t1-two)-(w+z*w); - z = one-(r-z); - GET_HIGH_WORD(j,z); - j += (n<<20); - if((j>>20)<=0) z = __scalbn(z,(int)n); /* subnormal output */ - else SET_HIGH_WORD(z,j); - return s*z; -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -pow(double x,double y) -{ - double result; - - if(x == 0.0 && y < 0.0) - { - __set_errno(EDOM); - - result = __get_huge_val(); - goto out; - } - - if(x < 0.0) - { - double abs_y; - - abs_y = fabs(y); - if(floor(abs_y) != abs_y) - { - __set_errno(EDOM); - - result = __get_huge_val(); - goto out; - } - } - - if(x != 0.0 && y == 0.0) - { - result = 1.0; - } - else if (x == 0.0 && y > 0.0) - { - result = 0.0; - } - else - { - result = __pow(x,y); - } - - out: - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_powf.c b/library/math_powf.c deleted file mode 100644 index e897e66..0000000 --- a/library/math_powf.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * $Id: math_powf.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float -bp[] = {1.0, 1.5,}, -dp_h[] = { 0.0, 5.84960938e-01,}, /* 0x3f15c000 */ -dp_l[] = { 0.0, 1.56322085e-06,}, /* 0x35d1cfdc */ -zero = 0.0, -one = 1.0, -two = 2.0, -two24 = 16777216.0, /* 0x4b800000 */ -huge = 1.0e30, -tiny = 1.0e-30, - /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */ -L1 = 6.0000002384e-01, /* 0x3f19999a */ -L2 = 4.2857143283e-01, /* 0x3edb6db7 */ -L3 = 3.3333334327e-01, /* 0x3eaaaaab */ -L4 = 2.7272811532e-01, /* 0x3e8ba305 */ -L5 = 2.3066075146e-01, /* 0x3e6c3255 */ -L6 = 2.0697501302e-01, /* 0x3e53f142 */ -P1 = 1.6666667163e-01, /* 0x3e2aaaab */ -P2 = -2.7777778450e-03, /* 0xbb360b61 */ -P3 = 6.6137559770e-05, /* 0x388ab355 */ -P4 = -1.6533901999e-06, /* 0xb5ddea0e */ -P5 = 4.1381369442e-08, /* 0x3331bb4c */ -lg2 = 6.9314718246e-01, /* 0x3f317218 */ -lg2_h = 6.93145752e-01, /* 0x3f317200 */ -lg2_l = 1.42860654e-06, /* 0x35bfbe8c */ -ovt = 4.2995665694e-08, /* -(128-log2(ovfl+.5ulp)) */ -cp = 9.6179670095e-01, /* 0x3f76384f =2/(3ln2) */ -cp_h = 9.6179199219e-01, /* 0x3f763800 =head of cp */ -cp_l = 4.7017383622e-06, /* 0x369dc3a0 =tail of cp_h */ -ivln2 = 1.4426950216e+00, /* 0x3fb8aa3b =1/ln2 */ -ivln2_h = 1.4426879883e+00, /* 0x3fb8aa00 =16b 1/ln2*/ -ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ - -float -powf(float x, float y) -{ - volatile float z; /* prevent optimizing it out of existence */ - float ax,z_h,z_l,p_h,p_l; - float y_1,t1,t2,r,s,t,u,v,w; - LONG i,j,k,yisint,n; - LONG hx,hy,ix,iy,is; - - GET_FLOAT_WORD(hx,x); - GET_FLOAT_WORD(hy,y); - ix = hx&0x7fffffff; iy = hy&0x7fffffff; - - /* y==zero: x**0 = 1 */ - if(iy==0) return one; - - /* +-NaN return x+y */ - if(ix > 0x7f800000 || - iy > 0x7f800000) - return x+y; - - /* determine if y is an odd int when x < 0 - * yisint = 0 ... y is not an integer - * yisint = 1 ... y is an odd int - * yisint = 2 ... y is an even int - */ - yisint = 0; - if(hx<0) { - if(iy>=0x4b800000) yisint = 2; /* even integer y */ - else if(iy>=0x3f800000) { - k = (iy>>23)-0x7f; /* exponent */ - j = iy>>(23-k); - if((j<<(23-k))==iy) yisint = 2-(j&1); - } - } - - /* special value of y */ - if (iy==0x7f800000) { /* y is +-inf */ - if (ix==0x3f800000) - return y - y; /* inf**+-1 is NaN */ - else if (ix > 0x3f800000)/* (|x|>1)**+-inf = inf,0 */ - return (hy>=0)? y: zero; - else /* (|x|<1)**-,+inf = inf,0 */ - return (hy<0)?-y: zero; - } - if(iy==0x3f800000) { /* y is +-1 */ - if(hy<0) return one/x; else return x; - } - if(hy==0x40000000) return x*x; /* y is 2 */ - if(hy==0x3f000000) { /* y is 0.5 */ - if(hx>=0) /* x >= +0 */ - return sqrtf(x); - } - - ax = fabsf(x); - /* special value of x */ - if(ix==0x7f800000||ix==0||ix==0x3f800000){ - z = ax; /*x is +-0,+-inf,+-1*/ - if(hy<0) z = one/z; /* z = (1/|x|) */ - if(hx<0) { - if(((ix-0x3f800000)|yisint)==0) { - z = (z-z)/(z-z); /* (-1)**non-int is NaN */ - } else if(yisint==1) - z = -z; /* (x<0)**odd = -(|x|**odd) */ - } - return z; - } - - /* (x<0)**(non-int) is NaN */ - if(((((ULONG)hx>>31)-1)|yisint)==0) return (x-x)/(x-x); - - /* |y| is huge */ - if(iy>0x4d000000) { /* if |y| > 2**27 */ - /* over/underflow if x is not close to one */ - if(ix<0x3f7ffff8) return (hy<0)? huge*huge:tiny*tiny; - if(ix>0x3f800007) return (hy>0)? huge*huge:tiny*tiny; - /* now |1-x| is tiny <= 2**-20, suffice to compute - log(x) by x-x^2/2+x^3/3-x^4/4 */ - t = x-1; /* t has 20 trailing zeros */ - w = (t*t)*((float)0.5-t*((float)0.333333333333-t*(float)0.25)); - u = ivln2_h*t; /* ivln2_h has 16 sig. bits */ - v = t*ivln2_l-w*ivln2; - t1 = u+v; - GET_FLOAT_WORD(is,t1); - SET_FLOAT_WORD(t1,is&0xfffff000U); - t2 = v-(t1-u); - } else { - float s2,s_h,s_l,t_h,t_l; - n = 0; - /* take care subnormal number */ - if(ix<0x00800000) - {ax *= two24; n -= 24; GET_FLOAT_WORD(ix,ax); } - n += ((ix)>>23)-0x7f; - j = ix&0x007fffff; - /* determine interval */ - ix = j|0x3f800000; /* normalize ix */ - if(j<=0x1cc471) k=0; /* |x|>1)|0x20000000)+0x0040000+(k<<21)); - t_l = ax - (t_h-bp[k]); - s_l = v*((u-s_h*t_h)-s_h*t_l); - /* compute log(ax) */ - s2 = s*s; - r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); - r += s_l*(s_h+s); - s2 = s_h*s_h; - t_h = (float)3.0+s2+r; - GET_FLOAT_WORD(is,t_h); - SET_FLOAT_WORD(t_h,is&0xfffff000U); - t_l = r-((t_h-(float)3.0)-s2); - /* u+v = s*(1+...) */ - u = s_h*t_h; - v = s_l*t_h+t_l*s; - /* 2/(3log2)*(s+...) */ - p_h = u+v; - GET_FLOAT_WORD(is,p_h); - SET_FLOAT_WORD(p_h,is&0xfffff000U); - p_l = v-(p_h-u); - z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ - z_l = cp_l*p_h+p_l*cp+dp_l[k]; - /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ - t = (float)n; - t1 = (((z_h+z_l)+dp_h[k])+t); - GET_FLOAT_WORD(is,t1); - SET_FLOAT_WORD(t1,is&0xfffff000U); - t2 = z_l-(((t1-t)-dp_h[k])-z_h); - } - - s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ - if(((((ULONG)hx>>31)-1)|(yisint-1))==0) - s = -one; /* (-ve)**(odd int) */ - - /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ - GET_FLOAT_WORD(is,y); - SET_FLOAT_WORD(y_1,is&0xfffff000U); - p_l = (y-y_1)*t1+y*t2; - p_h = y_1*t1; - z = p_l+p_h; - GET_FLOAT_WORD(j,z); - if (j>0x43000000) /* if z > 128 */ - return s*huge*huge; /* overflow */ - else if (j==0x43000000) { /* if z == 128 */ - if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */ - } - else if ((j&0x7fffffff)>0x43160000) /* z <= -150 */ - return s*tiny*tiny; /* underflow */ - else if (j==(LONG)0xc3160000U){ /* z == -150 */ - if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */ - } - /* - * compute 2**(p_h+p_l) - */ - i = j&0x7fffffff; - k = (i>>23)-0x7f; - n = 0; - if(i>0x3f000000) { /* if |z| > 0.5, set n = [z+0.5] */ - n = j+(0x00800000>>(k+1)); - k = ((n&0x7fffffff)>>23)-0x7f; /* new k for n */ - SET_FLOAT_WORD(t,n&~(0x007fffff>>k)); - n = ((n&0x007fffff)|0x00800000)>>(23-k); - if(j<0) n = -n; - p_h -= t; - } - t = p_l+p_h; - GET_FLOAT_WORD(is,t); - SET_FLOAT_WORD(t,is&0xfffff000U); - u = t*lg2_h; - v = (p_l-(t-p_h))*lg2+t*lg2_l; - z = u+v; - w = v-(z-u); - t = z*z; - t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); - r = (z*t1)/(t1-two)-(w+z*w); - z = one-(r-z); - GET_FLOAT_WORD(j,z); - j += (n<<23); - if((j>>23)<=0) z = scalbnf(z,(int)n); /* subnormal output */ - else SET_FLOAT_WORD(z,j); - return s*z; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_rem_pio2f.c b/library/math_rem_pio2f.c deleted file mode 100755 index af649f4..0000000 --- a/library/math_rem_pio2f.c +++ /dev/null @@ -1,389 +0,0 @@ -/* - * $Id: math_rem_pio2f.c,v 1.1 2005-05-30 08:10:38 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -/* In the float version, the input parameter x contains 8 bit - integers, not 24 bit integers. 113 bit precision is not supported. */ - -static const int init_jk[] = {4,7,9}; /* initial value for jk */ - -static const float PIo2[] = { - 1.5703125000e+00, /* 0x3fc90000 */ - 4.5776367188e-04, /* 0x39f00000 */ - 2.5987625122e-05, /* 0x37da0000 */ - 7.5437128544e-08, /* 0x33a20000 */ - 6.0026650317e-11, /* 0x2e840000 */ - 7.3896444519e-13, /* 0x2b500000 */ - 5.3845816694e-15, /* 0x27c20000 */ - 5.6378512969e-18, /* 0x22d00000 */ - 8.3009228831e-20, /* 0x1fc40000 */ - 3.2756352257e-22, /* 0x1bc60000 */ - 6.3331015649e-25, /* 0x17440000 */ -}; - -static const float -zero = 0.0, -one = 1.0, -two8 = 2.5600000000e+02, /* 0x43800000 */ -twon8 = 3.9062500000e-03; /* 0x3b800000 */ - -static int -__kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const LONG *ipio2) -{ - LONG jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; - float z,fw,f[20],fq[20],q[20]; - - /* initialize jk*/ - jk = init_jk[prec]; - jp = jk; - - /* determine jx,jv,q0, note that 3>q0 */ - jx = nx-1; - jv = (e0-3)/8; if(jv<0) jv=0; - q0 = e0-8*(jv+1); - - /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ - j = jv-jx; m = jx+jk; - for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (float) ipio2[j]; - - /* compute q[0],q[1],...q[jk] */ - for (i=0;i<=jk;i++) { - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; - } - - jz = jk; -recompute: - /* distill q[] into iq[] reversingly */ - for(i=0,j=jz,z=q[jz];j>0;i++,j--) { - fw = (float)((LONG)(twon8* z)); - iq[i] = (LONG)(z-two8*fw); - z = q[j-1]+fw; - } - - /* compute n */ - z = scalbnf(z,(int)q0); /* actual value of z */ - z -= (float)8.0*floorf(z*(float)0.125); /* trim off integer >= 8 */ - n = (LONG) z; - z -= (float)n; - ih = 0; - if(q0>0) { /* need iq[jz-1] to determine n */ - i = (iq[jz-1]>>(8-q0)); n += i; - iq[jz-1] -= i<<(8-q0); - ih = iq[jz-1]>>(7-q0); - } - else if(q0==0) ih = iq[jz-1]>>8; - else if(z>=(float)0.5) ih=2; - - if(ih>0) { /* q > 0.5 */ - n += 1; carry = 0; - for(i=0;i0) { /* rare case: chance is 1 in 12 */ - switch(q0) { - case 1: - iq[jz-1] &= 0x7f; break; - case 2: - iq[jz-1] &= 0x3f; break; - } - } - if(ih==2) { - z = one - z; - if(carry!=0) z -= scalbnf(one,(int)q0); - } - } - - /* check if recomputation is needed */ - if(z==zero) { - j = 0; - for (i=jz-1;i>=jk;i--) j |= iq[i]; - if(j==0) { /* need recomputation */ - for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */ - - for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */ - f[jx+i] = (float) ipio2[jv+i]; - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; - q[i] = fw; - } - jz += k; - goto recompute; - } - } - - /* chop off zero terms */ - if(z==(float)0.0) { - jz -= 1; q0 -= 8; - while(iq[jz]==0) { jz--; q0-=8;} - } else { /* break z into 8-bit if necessary */ - z = scalbnf(z,-(int)q0); - if(z>=two8) { - fw = (float)((LONG)(twon8*z)); - iq[jz] = (LONG)(z-two8*fw); - jz += 1; q0 += 8; - iq[jz] = (LONG) fw; - } else iq[jz] = (LONG) z ; - } - - /* convert integer "bit" chunk to floating-point value */ - fw = scalbnf(one,(int)q0); - for(i=jz;i>=0;i--) { - q[i] = fw*(float)iq[i]; fw*=twon8; - } - - /* compute PIo2[0,...,jp]*q[jz,...,0] */ - for(i=jz;i>=0;i--) { - for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; - fq[jz-i] = fw; - } - - /* compress fq[] into y[] */ - switch(prec) { - case 0: - fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; - break; - case 1: - case 2: - fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; - fw = fq[0]-fw; - for (i=1;i<=jz;i++) fw += fq[i]; - y[1] = (ih==0)? fw: -fw; - break; - case 3: /* painful */ - for (i=jz;i>0;i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; - } - for (i=jz;i>1;i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; - } - for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; - if(ih==0) { - y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; - } else { - y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; - } - } - return n&7; -} - -/****************************************************************************/ - -/* - * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi - */ -static const LONG two_over_pi[] = { -0xA2, 0xF9, 0x83, 0x6E, 0x4E, 0x44, 0x15, 0x29, 0xFC, -0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62, -0x95, 0x99, 0x3C, 0x43, 0x90, 0x41, 0xFE, 0x51, 0x63, -0xAB, 0xDE, 0xBB, 0xC5, 0x61, 0xB7, 0x24, 0x6E, 0x3A, -0x42, 0x4D, 0xD2, 0xE0, 0x06, 0x49, 0x2E, 0xEA, 0x09, -0xD1, 0x92, 0x1C, 0xFE, 0x1D, 0xEB, 0x1C, 0xB1, 0x29, -0xA7, 0x3E, 0xE8, 0x82, 0x35, 0xF5, 0x2E, 0xBB, 0x44, -0x84, 0xE9, 0x9C, 0x70, 0x26, 0xB4, 0x5F, 0x7E, 0x41, -0x39, 0x91, 0xD6, 0x39, 0x83, 0x53, 0x39, 0xF4, 0x9C, -0x84, 0x5F, 0x8B, 0xBD, 0xF9, 0x28, 0x3B, 0x1F, 0xF8, -0x97, 0xFF, 0xDE, 0x05, 0x98, 0x0F, 0xEF, 0x2F, 0x11, -0x8B, 0x5A, 0x0A, 0x6D, 0x1F, 0x6D, 0x36, 0x7E, 0xCF, -0x27, 0xCB, 0x09, 0xB7, 0x4F, 0x46, 0x3F, 0x66, 0x9E, -0x5F, 0xEA, 0x2D, 0x75, 0x27, 0xBA, 0xC7, 0xEB, 0xE5, -0xF1, 0x7B, 0x3D, 0x07, 0x39, 0xF7, 0x8A, 0x52, 0x92, -0xEA, 0x6B, 0xFB, 0x5F, 0xB1, 0x1F, 0x8D, 0x5D, 0x08, -0x56, 0x03, 0x30, 0x46, 0xFC, 0x7B, 0x6B, 0xAB, 0xF0, -0xCF, 0xBC, 0x20, 0x9A, 0xF4, 0x36, 0x1D, 0xA9, 0xE3, -0x91, 0x61, 0x5E, 0xE6, 0x1B, 0x08, 0x65, 0x99, 0x85, -0x5F, 0x14, 0xA0, 0x68, 0x40, 0x8D, 0xFF, 0xD8, 0x80, -0x4D, 0x73, 0x27, 0x31, 0x06, 0x06, 0x15, 0x56, 0xCA, -0x73, 0xA8, 0xC9, 0x60, 0xE2, 0x7B, 0xC0, 0x8C, 0x6B, -}; - -/* This array is like the one in e_rem_pio2.c, but the numbers are - single precision and the last 8 bits are forced to 0. */ -static const LONG npio2_hw[] = { -0x3fc90f00, 0x40490f00, 0x4096cb00, 0x40c90f00, 0x40fb5300, 0x4116cb00, -0x412fed00, 0x41490f00, 0x41623100, 0x417b5300, 0x418a3a00, 0x4196cb00, -0x41a35c00, 0x41afed00, 0x41bc7e00, 0x41c90f00, 0x41d5a000, 0x41e23100, -0x41eec200, 0x41fb5300, 0x4203f200, 0x420a3a00, 0x42108300, 0x4216cb00, -0x421d1400, 0x42235c00, 0x4229a500, 0x422fed00, 0x42363600, 0x423c7e00, -0x4242c700, 0x42490f00 -}; - -/* - * invpio2: 24 bits of 2/pi - * pio2_1: first 17 bit of pi/2 - * pio2_1t: pi/2 - pio2_1 - * pio2_2: second 17 bit of pi/2 - * pio2_2t: pi/2 - (pio2_1+pio2_2) - * pio2_3: third 17 bit of pi/2 - * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) - */ - -static const float -half = 5.0000000000e-01, /* 0x3f000000 */ -invpio2 = 6.3661980629e-01, /* 0x3f22f984 */ -pio2_1 = 1.5707855225e+00, /* 0x3fc90f80 */ -pio2_1t = 1.0804334124e-05, /* 0x37354443 */ -pio2_2 = 1.0804273188e-05, /* 0x37354400 */ -pio2_2t = 6.0770999344e-11, /* 0x2e85a308 */ -pio2_3 = 6.0770943833e-11, /* 0x2e85a300 */ -pio2_3t = 6.1232342629e-17; /* 0x248d3132 */ - -LONG -__rem_pio2f(float x, float *y) -{ - volatile float z,r; /* prevent optimizing out of existence */ - float w,t,fn; - float tx[3]; - LONG i,j,n,ix,hx; - int e0,nx; - - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix<=0x3f490fd8) /* |x| ~<= pi/4 , no need for reduction */ - {y[0] = x; y[1] = 0; return 0;} - if(ix<0x4016cbe4) { /* |x| < 3pi/4, special case with n=+-1 */ - if(hx>0) { - z = x - pio2_1; - if((ix&0xfffffff0U)!=0x3fc90fd0) { /* 24+24 bit pi OK */ - y[0] = z - pio2_1t; - y[1] = (z-y[0])-pio2_1t; - } else { /* near pi/2, use 24+24+24 bit pi */ - z -= pio2_2; - y[0] = z - pio2_2t; - y[1] = (z-y[0])-pio2_2t; - } - return 1; - } else { /* negative x */ - z = x + pio2_1; - if((ix&0xfffffff0U)!=0x3fc90fd0) { /* 24+24 bit pi OK */ - y[0] = z + pio2_1t; - y[1] = (z-y[0])+pio2_1t; - } else { /* near pi/2, use 24+24+24 bit pi */ - z += pio2_2; - y[0] = z + pio2_2t; - y[1] = (z-y[0])+pio2_2t; - } - return -1; - } - } - if(ix<=0x43490f80) { /* |x| ~<= 2^7*(pi/2), medium size */ - t = fabsf(x); - n = (LONG) (t*invpio2+half); - fn = (float)n; - r = t-fn*pio2_1; - w = fn*pio2_1t; /* 1st round good to 40 bit */ - if(n<32&&((LONG)(ix&0xffffff00U))!=npio2_hw[n-1]) { - y[0] = r-w; /* quick check no cancellation */ - } else { - ULONG high; - j = ix>>23; - y[0] = r-w; - GET_FLOAT_WORD(high,y[0]); - i = j-((high>>23)&0xff); - if(i>8) { /* 2nd iteration needed, good to 57 */ - t = r; - w = fn*pio2_2; - r = t-w; - w = fn*pio2_2t-((t-r)-w); - y[0] = r-w; - GET_FLOAT_WORD(high,y[0]); - i = j-((high>>23)&0xff); - if(i>25) { /* 3rd iteration need, 74 bits acc */ - t = r; /* will cover all possible cases */ - w = fn*pio2_3; - r = t-w; - w = fn*pio2_3t-((t-r)-w); - y[0] = r-w; - } - } - } - y[1] = (r-y[0])-w; - if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} - else return n; - } - /* - * all other (large) arguments - */ - if(ix>=0x7f800000) { /* x is inf or NaN */ - y[0]=y[1]=x-x; return 0; - } - /* set z = scalbn(|x|,ilogb(x)-7) */ - e0 = (int)((ix>>23)-134); /* e0 = ilogb(z)-7; */ - SET_FLOAT_WORD(z, ix - ((LONG)e0<<23)); - for(i=0;i<2;i++) { - tx[i] = (float)((LONG)(z)); - z = (z-tx[i])*two8; - } - tx[2] = z; - nx = 3; - while(tx[nx-1]==zero) nx--; /* skip zero term */ - n = __kernel_rem_pio2f(tx,y,e0,nx,2,two_over_pi); - if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} - return n; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_remainder.c b/library/math_remainder.c deleted file mode 100644 index f92251b..0000000 --- a/library/math_remainder.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * $Id: math_remainder.c,v 1.2 2005-05-30 08:47:26 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double zero = 0.0; - -double -remainder(double x, double p) -{ - LONG hx,hp; - ULONG sx,lx,lp; - double p_half; - - EXTRACT_WORDS(hx,lx,x); - EXTRACT_WORDS(hp,lp,p); - sx = hx&0x80000000U; - hp &= 0x7fffffff; - hx &= 0x7fffffff; - - /* purge off exception values */ - if((hp|lp)==0) return (x*p)/(x*p); /* p = 0 */ - if((hx>=0x7ff00000)|| /* x not finite */ - ((hp>=0x7ff00000)&& /* p is NaN */ - (((hp-0x7ff00000)|lp)!=0))) - return (x*p)/(x*p); - - - if (hp<=0x7fdfffff) x = fmod(x,p+p); /* now x < 2p */ - if (((hx-hp)|(lx-lp))==0) return zero*x; - x = fabs(x); - p = fabs(p); - if (hp<0x00200000) { - if(x+x>p) { - x-=p; - if(x+x>=p) x -= p; - } - } else { - p_half = 0.5*p; - if(x>p_half) { - x-=p; - if(x>=p_half) x -= p; - } - } - GET_HIGH_WORD(hx,x); - SET_HIGH_WORD(x,hx^sx); - return x; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_remainderf.c b/library/math_remainderf.c deleted file mode 100644 index e7b9e34..0000000 --- a/library/math_remainderf.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Id: math_remainderf.c,v 1.2 2005-05-30 08:47:26 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float zero = 0.0; - -float -remainderf(float x, float p) -{ - LONG hx,hp; - ULONG sx; - float p_half; - - GET_FLOAT_WORD(hx,x); - GET_FLOAT_WORD(hp,p); - sx = hx&0x80000000U; - hp &= 0x7fffffff; - hx &= 0x7fffffff; - - /* purge off exception values */ - if(hp==0) return (x*p)/(x*p); /* p = 0 */ - if((hx>=0x7f800000)|| /* x not finite */ - ((hp>0x7f800000))) /* p is NaN */ - return (x*p)/(x*p); - - - if (hp<=0x7effffff) x = fmodf(x,p+p); /* now x < 2p */ - if ((hx-hp)==0) return zero*x; - x = fabsf(x); - p = fabsf(p); - if (hp<0x01000000) { - if(x+x>p) { - x-=p; - if(x+x>=p) x -= p; - } - } else { - p_half = (float)0.5*p; - if(x>p_half) { - x-=p; - if(x>=p_half) x -= p; - } - } - GET_FLOAT_WORD(hx,x); - SET_FLOAT_WORD(x,hx^sx); - return x; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_remquo.c b/library/math_remquo.c deleted file mode 100644 index ea7fb2a..0000000 --- a/library/math_remquo.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_remquo.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -remquo(double x,double y,int * quo) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_remquof.c b/library/math_remquof.c deleted file mode 100644 index e212d4c..0000000 --- a/library/math_remquof.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_remquof.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -remquof(float x,float y,int * quo) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_rint.c b/library/math_rint.c deleted file mode 100755 index 85c950e..0000000 --- a/library/math_rint.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * $Id: math_rint.c,v 1.4 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) (1994) standard. */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) || defined(M68881_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -rint(double x) -{ - return floor ( x+0.5 ); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT || M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double -TWO52[2]={ - 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ - -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */ -}; - -double -rint(double x) -{ - int i0,j0,sx; - unsigned i,i1; - double w,t; - GET_HIGH_WORD(i0,x); - sx = (i0>>31)&1; - GET_LOW_WORD(i1,x); - j0 = ((i0>>20)&0x7ff)-0x3ff; - if(j0<20) { - if(j0<0) { - if(((i0&0x7fffffff)|i1)==0) return x; - i1 |= (i0&0x0fffff); - i0 &= 0xfffe0000; - i0 |= ((i1|-i1)>>12)&0x80000; - SET_HIGH_WORD(x,i0); - w = TWO52[sx]+x; - t = w-TWO52[sx]; - GET_HIGH_WORD(i0,t); - SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31)); - return t; - } else { - i = (0x000fffff)>>j0; - if(((i0&i)|i1)==0) return x; /* x is integral */ - i>>=1; - if(((i0&i)|i1)!=0) { - if(j0==19) i1 = 0x40000000; else - i0 = (i0&(~i))|((0x20000)>>j0); - } - } - } else if (j0>51) { - if(j0==0x400) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } else { - i = ((unsigned)(0xffffffff))>>(j0-20); - if((i1&i)==0) return x; /* x is integral */ - i>>=1; - if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20)); - } - - SET_HIGH_WORD(x,i0); - SET_LOW_WORD(x,i1); - w = TWO52[sx]+x; - return w-TWO52[sx]; -} - -/****************************************************************************/ - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_rintf.c b/library/math_rintf.c deleted file mode 100755 index a5526db..0000000 --- a/library/math_rintf.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * $Id: math_rintf.c,v 1.3 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) (1994) standard. */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) || defined(M68881_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -rintf(float x) -{ - return (float) floor ( x + 0.5f ); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT || M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -/* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. */ - -/****************************************************************************/ - -static const float -TWO23[2]={ - 8.3886080000e+06, /* 0x4b000000 */ - -8.3886080000e+06, /* 0xcb000000 */ -}; - -float -rintf(float x) -{ - int i0,j0,sx; - unsigned int i,i1; - float w,t; - GET_FLOAT_WORD(i0,x); - sx = (i0>>31)&1; - j0 = ((i0>>23)&0xff)-0x7f; - if(j0<23) { - if(j0<0) { - if((i0&0x7fffffff)==0) return x; - i1 = (i0&0x07fffff); - i0 &= 0xfff00000; - i0 |= ((i1|-i1)>>9)&0x400000; - SET_FLOAT_WORD(x,i0); - w = TWO23[sx]+x; - t = w-TWO23[sx]; - GET_FLOAT_WORD(i0,t); - SET_FLOAT_WORD(t,(i0&0x7fffffff)|(sx<<31)); - return t; - } else { - i = (0x007fffff)>>j0; - if((i0&i)==0) return x; /* x is integral */ - i>>=1; - if((i0&i)!=0) i0 = (i0&(~i))|((0x100000)>>j0); - } - } else { - if(j0==0x80) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } - SET_FLOAT_WORD(x,i0); - w = TWO23[sx]+x; - return w-TWO23[sx]; -} - -/****************************************************************************/ - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_round.c b/library/math_round.c deleted file mode 100644 index a6fdc6b..0000000 --- a/library/math_round.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_round.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -round(double x) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_roundf.c b/library/math_roundf.c deleted file mode 100644 index c179470..0000000 --- a/library/math_roundf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_roundf.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -roundf(float x) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_scalbn.c b/library/math_scalbn.c deleted file mode 100644 index 8449d1f..0000000 --- a/library/math_scalbn.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * $Id: math_scalbn.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const double -two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ -twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ -huge = 1.0e+300, -tiny = 1.0e-300; - -double -scalbn (double x, int n) -{ - LONG k,hx,lx; - EXTRACT_WORDS(hx,lx,x); - k = (hx&0x7ff00000)>>20; /* extract exponent */ - if (k==0) { /* 0 or subnormal x */ - if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ - x *= two54; - GET_HIGH_WORD(hx,x); - k = ((hx&0x7ff00000)>>20) - 54; - if (n< -50000) return tiny*x; /*underflow*/ - } - if (k==0x7ff) return x+x; /* NaN or Inf */ - k = k+n; - if (k > 0x7fe) return copysign(HUGE_VAL,x); /* overflow */ - if (k > 0) /* normal result */ - {SET_HIGH_WORD(x,(hx&0x800fffffU)|(k<<20)); return x;} - if (k <= -54) { - if (n > 50000) /* in case integer overflow in n+k */ - return copysign(HUGE_VAL,x); /*overflow*/ - else return tiny*copysign(tiny,x); /*underflow*/ - } - k += 54; /* subnormal result */ - SET_HIGH_WORD(x,(hx&0x800fffffU)|(k<<20)); - return x*twom54; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_scalbnf.c b/library/math_scalbnf.c deleted file mode 100644 index b86a5d6..0000000 --- a/library/math_scalbnf.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * $Id: math_scalbnf.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if INT_MAX > 50000 -#define OVERFLOW_INT 50000 -#else -#define OVERFLOW_INT 30000 -#endif - -static const float -two25 = 3.355443200e+07, /* 0x4c000000 */ -twom25 = 2.9802322388e-08, /* 0x33000000 */ -huge = 1.0e+30, -tiny = 1.0e-30; - -float -scalbnf (float x, int n) -{ - LONG k,ix; - GET_FLOAT_WORD(ix,x); - k = (ix&0x7f800000)>>23; /* extract exponent */ - if (k==0) { /* 0 or subnormal x */ - if ((ix&0x7fffffff)==0) return x; /* +-0 */ - x *= two25; - GET_FLOAT_WORD(ix,x); - k = ((ix&0x7f800000)>>23) - 25; - if (n< -50000) return tiny*x; /*underflow*/ - } - if (k==0xff) return x+x; /* NaN or Inf */ - k = k+n; - if (k > 0xfe) return copysignf(__inff(),x); /* overflow */ - if (k > 0) /* normal result */ - {SET_FLOAT_WORD(x,(ix&0x807fffffU)|(k<<23)); return x;} - if (k <= -25) { - if (n > OVERFLOW_INT) /* in case integer overflow in n+k */ - return copysignf(__inff(),x);/*overflow*/ - else return tiny*copysignf(tiny,x); /*underflow*/ - } - k += 25; /* subnormal result */ - SET_FLOAT_WORD(x,(ix&0x807fffffU)|(k<<23)); - return x*twom25; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_signbit.c b/library/math_signbit.c deleted file mode 100644 index 6b53f03..0000000 --- a/library/math_signbit.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * $Id: math_signbit.c,v 1.1 2005-05-08 08:51:29 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#if defined (FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard, but it should - be part of ISO/IEC 9899:1999, also known as "C99". */ - -/****************************************************************************/ - -int -__signbit_float(float number) -{ - union ieee_single x; - int result; - - x.value = number; - - result = ((x.raw[0] = 0x80000000) != 0); - - return(result); -} - -/****************************************************************************/ - -int -__signbit_double(double number) -{ - union ieee_double x; - int result; - - x.value = number; - - result = ((x.raw[0] = 0x80000000) != 0); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_sin.c b/library/math_sin.c deleted file mode 100644 index 1287307..0000000 --- a/library/math_sin.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * $Id: math_sin.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __sin(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___sin - -___sin: - - movel a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-36:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__sin(double x) -{ - double result; - - result = IEEEDPSin(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__sin(double x) -{ - double result; - - __asm ("fsin%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__sin(double x) -{ - double y[2],z=0.0; - int n,ix; - - /* High word of x. */ - GET_HIGH_WORD(ix,x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if(ix <= 0x3fe921fb) - return __kernel_sin(x,z,0); - - /* sin(Inf or NaN) is NaN */ - else if (ix>=0x7ff00000) return x-x; - - /* argument reduction needed */ - else { - n = __rem_pio2(x,y); - switch(n&3) { - case 0: return __kernel_sin(y[0],y[1],1); - case 1: return __kernel_cos(y[0],y[1]); - case 2: return -__kernel_sin(y[0],y[1],1); - default: - return -__kernel_cos(y[0],y[1]); - } - } -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -sin(double x) -{ - double result; - - result = __sin(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_sinf.c b/library/math_sinf.c deleted file mode 100644 index 72207b3..0000000 --- a/library/math_sinf.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * $Id: math_sinf.c,v 1.2 2005-05-30 08:10:38 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -sinf(float x) -{ - float y[2],z=0.0; - LONG n,ix; - - GET_FLOAT_WORD(ix,x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if(ix <= 0x3f490fd8) return __kernel_sinf(x,z,0); - - /* sin(Inf or NaN) is NaN */ - else if (ix>=0x7f800000) return x-x; - - /* argument reduction needed */ - else { - n = __rem_pio2f(x,y); - switch(n&3) { - case 0: return __kernel_sinf(y[0],y[1],1); - case 1: return __kernel_cosf(y[0],y[1]); - case 2: return -__kernel_sinf(y[0],y[1],1); - default: - return -__kernel_cosf(y[0],y[1]); - } - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_sinh.c b/library/math_sinh.c deleted file mode 100644 index 6112db6..0000000 --- a/library/math_sinh.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * $Id: math_sinh.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __sinh(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___sinh - -___sinh: - - movel a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-60:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__sinh(double x) -{ - double result; - - result = IEEEDPSinh(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__sinh(double x) -{ - double result; - - __asm ("fsinh%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -static const double one = 1.0, shuge = 1.0e307; - -INLINE STATIC const double -__sinh(double x) -{ - double t,w,h; - int ix,jx; - unsigned int lx; - - /* High word of |x|. */ - GET_HIGH_WORD(jx,x); - ix = jx&0x7fffffff; - - /* x is INF or NaN */ - if(ix>=0x7ff00000) return x+x; - - h = 0.5; - if (jx<0) h = -h; - /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */ - if (ix < 0x40360000) { /* |x|<22 */ - if (ix<0x3e300000) /* |x|<2**-28 */ - if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */ - t = __expm1(fabs(x)); - if(ix<0x3ff00000) return h*(2.0*t-t*t/(t+one)); - return h*(t+t/(t+one)); - } - - /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */ - if (ix < 0x40862E42) return h*exp(fabs(x)); - - /* |x| in [log(maxdouble), overflowthresold] */ - GET_LOW_WORD(lx,x); - if (ix<0x408633CE || (ix==0x408633ce && lx<=(unsigned int)0x8fb9f87d)) { - w = exp(0.5*fabs(x)); - t = h*w; - return t*w; - } - - /* |x| > overflowthresold, sinh(x) overflow */ - return x*shuge; -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -sinh(double x) -{ - double result; - - result = __sinh(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_sinhf.c b/library/math_sinhf.c deleted file mode 100644 index 05cc1f7..0000000 --- a/library/math_sinhf.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * $Id: math_sinhf.c,v 1.2 2005-05-30 08:10:38 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float one = 1.0, shuge = 1.0e37; - -float -sinhf(float x) -{ - float t,w,h; - LONG ix,jx; - - GET_FLOAT_WORD(jx,x); - ix = jx&0x7fffffff; - - /* x is INF or NaN */ - if(ix>=0x7f800000) return x+x; - - h = 0.5; - if (jx<0) h = -h; - /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */ - if (ix < 0x41b00000) { /* |x|<22 */ - if (ix<0x31800000) /* |x|<2**-28 */ - if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */ - t = expm1f(fabsf(x)); - if(ix<0x3f800000) return h*((float)2.0*t-t*t/(t+one)); - return h*(t+t/(t+one)); - } - - /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */ - if (ix < 0x42b17180) return h*expf(fabsf(x)); - - /* |x| in [log(maxdouble), overflowthresold] */ - if (ix<=0x42b2d4fc) { - w = expf((float)0.5*fabsf(x)); - t = h*w; - return t*w; - } - - /* |x| > overflowthresold, sinh(x) overflow */ - return x*shuge; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_sqrt.c b/library/math_sqrt.c deleted file mode 100644 index 59f3117..0000000 --- a/library/math_sqrt.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * $Id: math_sqrt.c,v 1.6 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __sqrt(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___sqrt - -___sqrt: - - movel a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-96:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__sqrt(double x) -{ - double result; - - result = IEEEDPSqrt(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__sqrt(double x) -{ - double result; - - __asm ("fsqrt%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#ifdef __PPC__ - -static const double one = 1.0, tiny=1.0e-300; - -INLINE STATIC const double -__sqrt(double x) -{ - double z; - int sign = (int)0x80000000; - unsigned int r,t1,s1,ix1,q1; - int ix0,s0,q,m,t,i; - - EXTRACT_WORDS(ix0,ix1,x); - - /* take care of Inf and NaN */ - if((ix0&0x7ff00000)==0x7ff00000) { - return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf - sqrt(-inf)=sNaN */ - } - /* take care of zero */ - if(ix0<=0) { - if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */ - else if(ix0<0) - return (x-x)/(x-x); /* sqrt(-ve) = sNaN */ - } - /* normalize x */ - m = (ix0>>20); - if(m==0) { /* subnormal x */ - while(ix0==0) { - m -= 21; - ix0 |= (ix1>>11); ix1 <<= 21; - } - for(i=0;(ix0&0x00100000)==0;i++) ix0<<=1; - m -= i-1; - ix0 |= (ix1>>(32-i)); - ix1 <<= i; - } - m -= 1023; /* unbias exponent */ - ix0 = (ix0&0x000fffff)|0x00100000; - if(m&1){ /* odd m, double x to make it even */ - ix0 += ix0 + ((ix1&sign)>>31); - ix1 += ix1; - } - m >>= 1; /* m = [m/2] */ - - /* generate sqrt(x) bit by bit */ - ix0 += ix0 + ((ix1&sign)>>31); - ix1 += ix1; - q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */ - r = 0x00200000; /* r = moving bit from right to left */ - - while(r!=0) { - t = s0+r; - if(t<=ix0) { - s0 = t+r; - ix0 -= t; - q += r; - } - ix0 += ix0 + ((ix1&sign)>>31); - ix1 += ix1; - r>>=1; - } - - r = sign; - while(r!=0) { - t1 = s1+r; - t = s0; - if((t>31); - ix1 += ix1; - r>>=1; - } - - /* use floating add to find out rounding direction */ - if((ix0|ix1)!=0) { - z = one-tiny; /* trigger inexact flag */ - if (z>=one) { - z = one+tiny; - if (q1==(unsigned int)0xffffffff) { q1=0; q += 1;} - else if (z>one) { - if (q1==(unsigned int)0xfffffffe) q+=1; - q1+=2; - } else - q1 += (q1&1); - } - } - ix0 = (q>>1)+0x3fe00000; - ix1 = q1>>1; - if ((q&1)==1) ix1 |= sign; - ix0 += (m <<20); - INSERT_WORDS(z,ix0,ix1); - return z; -} - -#endif - -/****************************************************************************/ - -double -sqrt(double x) -{ - double result; - - if(x >= 0.0) - { - result = __sqrt(x); - } - else - { - result = 0; - __set_errno(EDOM); - } - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_sqrtf.c b/library/math_sqrtf.c deleted file mode 100644 index d230902..0000000 --- a/library/math_sqrtf.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * $Id: math_sqrtf.c,v 1.2 2005-05-29 14:45:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float one = 1.0, tiny=1.0e-30; - -float -sqrtf(float x) -{ - volatile float z; /* to prevent GCC from optimizing it away */ - LONG sign = (LONG)0x80000000U; - ULONG r; - LONG ix,s,q,m,t,i; - - GET_FLOAT_WORD(ix,x); - - /* take care of Inf and NaN */ - if((ix&0x7f800000)==0x7f800000) { - return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf - sqrt(-inf)=sNaN */ - } - /* take care of zero */ - if(ix<=0) { - if((ix&(~sign))==0) return x;/* sqrt(+-0) = +-0 */ - else if(ix<0) - return (x-x)/(x-x); /* sqrt(-ve) = sNaN */ - } - /* normalize x */ - m = (ix>>23); - if(m==0) { /* subnormal x */ - for(i=0;(ix&0x00800000)==0;i++) ix<<=1; - m -= i-1; - } - m -= 127; /* unbias exponent */ - ix = (ix&0x007fffff)|0x00800000; - if(m&1) /* odd m, double x to make it even */ - ix += ix; - m >>= 1; /* m = [m/2] */ - - /* generate sqrt(x) bit by bit */ - ix += ix; - q = s = 0; /* q = sqrt(x) */ - r = 0x01000000; /* r = moving bit from right to left */ - - while(r!=0) { - t = s+r; - if(t<=ix) { - s = t+r; - ix -= t; - q += r; - } - ix += ix; - r>>=1; - } - - /* use floating add to find out rounding direction */ - if(ix!=0) { - z = one-tiny; /* trigger inexact flag */ - if (z>=one) { - z = one+tiny; - if (z>one) - q += 2; - else - q += (q&1); - } - } - ix = (q>>1)+0x3f000000; - ix += (m <<23); - SET_FLOAT_WORD(z,ix); - return z; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_subdf3.c b/library/math_subdf3.c deleted file mode 100644 index 9b74f39..0000000 --- a/library/math_subdf3.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: math_subdf3.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubBasBase - .globl ___subdf3 - -___subdf3: - - moveml d2/d3/a6,sp@- - movel "A4(_MathIeeeDoubBasBase)",a6 - moveml sp@(16),d0/d1/d2/d3 - jsr a6@(-72:W) - moveml sp@+,d2/d3/a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_subsf3.c b/library/math_subsf3.c deleted file mode 100644 index aef03aa..0000000 --- a/library/math_subsf3.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: math_subsf3.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -float -__subsf3(float x,float y) -{ - float result; - - result = IEEESPSub(x,y); - - return(result); -} - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_tan.c b/library/math_tan.c deleted file mode 100644 index b540b0d..0000000 --- a/library/math_tan.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * $Id: math_tan.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __tan(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___tan - -___tan: - - movel a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-48:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__tan(double x) -{ - double result; - - result = IEEEDPTan(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__tan(double x) -{ - double result; - - __asm ("ftan%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__tan(double x) -{ - double y[2],z=0.0; - int n,ix; - - /* High word of x. */ - GET_HIGH_WORD(ix,x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if(ix <= 0x3fe921fb) return __kernel_tan(x,z,1); - - /* tan(Inf or NaN) is NaN */ - else if (ix>=0x7ff00000) return x-x; /* NaN */ - - /* argument reduction needed */ - else { - n = __rem_pio2(x,y); - return __kernel_tan(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even - -1 -- n odd */ - } -} -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -tan(double x) -{ - double result; - - result = __tan(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_tanf.c b/library/math_tanf.c deleted file mode 100644 index 92ede37..0000000 --- a/library/math_tanf.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * $Id: math_tanf.c,v 1.2 2005-05-30 08:10:38 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -tanf(float x) -{ - float y[2],z=0.0; - LONG n,ix; - - GET_FLOAT_WORD(ix,x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if(ix <= 0x3f490fda) return __kernel_tanf(x,z,1); - - /* tan(Inf or NaN) is NaN */ - else if (ix>=0x7f800000) return x-x; /* NaN */ - - /* argument reduction needed */ - else { - n = __rem_pio2f(x,y); - return __kernel_tanf(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even - -1 -- n odd */ - } -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_tanh.c b/library/math_tanh.c deleted file mode 100644 index 6f55d42..0000000 --- a/library/math_tanh.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * $Id: math_tanh.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -extern double __tanh(double x); - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___tanh - -___tanh: - - movel a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-72:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC const double -__tanh(double x) -{ - double result; - - result = IEEEDPTanh(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(M68881_FLOATING_POINT_SUPPORT) - -INLINE STATIC const double -__tanh(double x) -{ - double result; - - __asm ("ftanh%.x %1,%0" - : "=f" (result) - : "f" (x)); - - return(result); -} - -#endif /* M68881_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#if defined(PPC_FLOATING_POINT_SUPPORT) - -static const double one=1.0, two=2.0, tiny = 1.0e-300; - -INLINE STATIC const double -__tanh(double x) -{ - double t,z; - int jx,ix; - - /* High word of |x|. */ - GET_HIGH_WORD(jx,x); - ix = jx&0x7fffffff; - - /* x is INF or NaN */ - if(ix>=0x7ff00000) { - if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ - else return one/x-one; /* tanh(NaN) = NaN */ - } - - /* |x| < 22 */ - if (ix < 0x40360000) { /* |x|<22 */ - if (ix<0x3c800000) /* |x|<2**-55 */ - return x*(one+x); /* tanh(small) = small */ - if (ix>=0x3ff00000) { /* |x|>=1 */ - t = __expm1(two*fabs(x)); - z = one - two/(t+two); - } else { - t = __expm1(-two*fabs(x)); - z= -t/(t+two); - } - /* |x| > 22, return +-1 */ - } else { - z = one - tiny; /* raised inexact flag */ - } - return (jx>=0)? z: -z; -} - -#endif /* PPC_FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -double -tanh(double x) -{ - double result; - - result = __tanh(x); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_tanhf.c b/library/math_tanhf.c deleted file mode 100644 index f9b65a4..0000000 --- a/library/math_tanhf.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * $Id: math_tanhf.c,v 1.2 2005-05-30 08:10:38 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - * - * - * PowerPC math library based in part on work by Sun Microsystems - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -static const float one=1.0, two=2.0, tiny = 1.0e-30; - -float -tanhf(float x) -{ - float t,z; - LONG jx,ix; - - GET_FLOAT_WORD(jx,x); - ix = jx&0x7fffffff; - - /* x is INF or NaN */ - if(ix>=0x7f800000) { - if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ - else return one/x-one; /* tanh(NaN) = NaN */ - } - - /* |x| < 22 */ - if (ix < 0x41b00000) { /* |x|<22 */ - if (ix<0x24000000) /* |x|<2**-55 */ - return x*(one+x); /* tanh(small) = small */ - if (ix>=0x3f800000) { /* |x|>=1 */ - t = expm1f(two*fabsf(x)); - z = one - two/(t+two); - } else { - t = expm1f(-two*fabsf(x)); - z= -t/(t+two); - } - /* |x| > 22, return +-1 */ - } else { - z = one - tiny; /* raised inexact flag */ - } - return (jx>=0)? z: -z; -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_tgamma.c b/library/math_tgamma.c deleted file mode 100644 index e53f0e5..0000000 --- a/library/math_tgamma.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_tgamma.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -tgamma(double x) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_tgammaf.c b/library/math_tgammaf.c deleted file mode 100644 index a277e21..0000000 --- a/library/math_tgammaf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_tgammaf.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -tgammaf(float x) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_trunc.c b/library/math_trunc.c deleted file mode 100644 index 9d409b9..0000000 --- a/library/math_trunc.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_trunc.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -trunc(double x) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/math_truncdfsf2.c b/library/math_truncdfsf2.c deleted file mode 100644 index ae890db..0000000 --- a/library/math_truncdfsf2.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * $Id: math_truncdfsf2.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(IEEE_FLOATING_POINT_SUPPORT) && defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl _MathIeeeDoubTransBase - .globl ___truncdfsf2 - -___truncdfsf2: - - movel a6,sp@- - movel "A4(_MathIeeeDoubTransBase)",a6 - moveml sp@(8),d0/d1 - jsr a6@(-102:W) - movel sp@+,a6 - rts - -"); - -/****************************************************************************/ - -#endif /* IEEE_FLOATING_POINT_SUPPORT */ diff --git a/library/math_truncf.c b/library/math_truncf.c deleted file mode 100644 index dc7a56a..0000000 --- a/library/math_truncf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id: math_truncf.c,v 1.1 2005-05-29 11:19:01 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -float -truncf(float x) -{ - /* ZZZ unimplemented */ - return(0); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/mount_convertinfo.c b/library/mount_convertinfo.c deleted file mode 100644 index aae7cc4..0000000 --- a/library/mount_convertinfo.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * $Id: mount_convertinfo.c,v 1.5 2005-07-03 10:36:46 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MOUNT_HEADERS_H -#include "mount_headers.h" -#endif /* _MOUNT_HEADERS_H */ - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -void -__convert_info_to_statfs(struct InfoData * id,struct statfs * f) -{ - LONG num_blocks,num_blocks_used,bytes_per_block; - - ENTER(); - - assert( id != NULL && f != NULL ); - - SHOWVALUE(id->id_NumSoftErrors); - SHOWVALUE(id->id_UnitNumber); - SHOWVALUE(id->id_DiskState); - SHOWVALUE(id->id_NumBlocks); - SHOWVALUE(id->id_NumBlocksUsed); - SHOWVALUE(id->id_BytesPerBlock); - SHOWVALUE(id->id_DiskType); - SHOWVALUE(id->id_VolumeNode); - SHOWVALUE(id->id_InUse); - - memset(f,0,sizeof(*f)); - - if(id->id_NumBlocks > 0) - { - num_blocks = id->id_NumBlocks; - num_blocks_used = id->id_NumBlocksUsed; - } - else - { - num_blocks = 1; - num_blocks_used = 1; - } - - if(id->id_BytesPerBlock > 0) - bytes_per_block = id->id_BytesPerBlock; - else - bytes_per_block = 512; - - f->f_bsize = bytes_per_block; - f->f_blocks = num_blocks; - f->f_bfree = num_blocks - num_blocks_used; - f->f_iosize = f->f_bsize; - f->f_bavail = f->f_bfree; - f->f_ffree = LONG_MAX; - f->f_flags = MNT_NOATIME|MNT_SYMPERM|MNT_LOCAL; - - if(id->id_DiskState != ID_VALIDATED) - SET_FLAG(f->f_flags,MNT_RDONLY); - - switch (id->id_DiskType) - { - case ID_NO_DISK_PRESENT: - strcpy(f->f_fstypename, "None"); - break; - - case ID_UNREADABLE_DISK: - strcpy(f->f_fstypename, "NDOS"); - break; - - case ID_BUSY_DISK: - strcpy(f->f_fstypename, "Busy"); - break; - - case ID_DOS_DISK: - strcpy(f->f_fstypename, "DOS\\0"); - break; - - case ID_FFS_DISK: - strcpy(f->f_fstypename, "DOS\\1"); - break; - - case ID_INTER_DOS_DISK: - strcpy(f->f_fstypename, "DOS\\2"); - break; - - case ID_INTER_FFS_DISK: - strcpy(f->f_fstypename, "DOS\\3"); - break; - - case ID_FASTDIR_DOS_DISK: - strcpy(f->f_fstypename, "DOS\\4"); - break; - - case ID_FASTDIR_FFS_DISK: - strcpy(f->f_fstypename, "DOS\\5"); - break; - - case ID_LONGNAME_DOS_DISK: - strcpy(f->f_fstypename, "DOS\\6"); - break; - - case ID_LONGNAME_FFS_DISK: - strcpy(f->f_fstypename, "DOS\\7"); - break; - - case 0x53465300: - strcpy(f->f_fstypename, "SFS\\0"); - break; - - case ID_NOT_REALLY_DOS: - strcpy(f->f_fstypename, "NDOS"); - break; - - default: - strcpy(f->f_fstypename, "Unknown"); - break; - } - - SHOWVALUE(f->f_bsize); - SHOWVALUE(f->f_blocks); - SHOWVALUE(f->f_bfree); - SHOWVALUE(f->f_iosize); - SHOWVALUE(f->f_bavail); - SHOWVALUE(f->f_ffree); - SHOWVALUE(f->f_flags); - - LEAVE(); -} diff --git a/library/mount_fstatfs.c b/library/mount_fstatfs.c deleted file mode 100644 index 579d39f..0000000 --- a/library/mount_fstatfs.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * $Id: mount_fstatfs.c,v 1.11 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MOUNT_HEADERS_H -#include "mount_headers.h" -#endif /* _MOUNT_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -fstatfs(int file_descriptor, struct statfs *buf) -{ - D_S(struct InfoData,id); - BPTR parent_dir = ZERO; - int result = ERROR; - struct fd * fd = NULL; - LONG success; - - ENTER(); - - SHOWVALUE(file_descriptor); - SHOWPOINTER(buf); - - assert( buf != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(buf == NULL) - { - SHOWMSG("invalid buffer parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - __fd_lock(fd); - - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET)) - { - __set_errno(EINVAL); - goto out; - } - - if(FLAG_IS_SET(fd->fd_Flags,FDF_STDIO)) - { - __set_errno(EBADF); - goto out; - } - - PROFILE_OFF(); - parent_dir = __safe_parent_of_file_handle(fd->fd_DefaultFile); - PROFILE_ON(); - - if(parent_dir == ZERO) - { - SHOWMSG("couldn't find parent directory"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - PROFILE_OFF(); - success = Info(parent_dir,id); - PROFILE_ON(); - - if(NO success) - { - SHOWMSG("couldn't get info on drive"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - __convert_info_to_statfs(id,buf); - - result = OK; - - out: - - __fd_unlock(fd); - - UnLock(parent_dir); - - RETURN(result); - return(result); -} diff --git a/library/mount_headers.h b/library/mount_headers.h deleted file mode 100644 index 8323af2..0000000 --- a/library/mount_headers.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * $Id: mount_headers.h,v 1.4 2005-03-18 12:38:22 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MOUNT_HEADERS_H -#define _MOUNT_HEADERS_H - -/****************************************************************************/ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_H */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -extern void __convert_info_to_statfs(struct InfoData * id,struct statfs * f); - -/****************************************************************************/ - -#endif /* _MOUNT_HEADERS_H */ diff --git a/library/mount_statfs.c b/library/mount_statfs.c deleted file mode 100644 index 522dd7f..0000000 --- a/library/mount_statfs.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * $Id: mount_statfs.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _MOUNT_HEADERS_H -#include "mount_headers.h" -#endif /* _MOUNT_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -statfs(const char *path, struct statfs *buf) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info path_nti; - #endif /* UNIX_PATH_SEMANTICS */ - D_S(struct InfoData,id); - LONG status; - BPTR lock = ZERO; - int result = ERROR; - - ENTER(); - - SHOWSTRING(path); - SHOWPOINTER(buf); - - if(__check_abort_enabled) - __check_abort(); - - assert( path != NULL && buf != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(path == NULL || buf == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name(&path,&path_nti) != 0) - goto out; - - SHOWSTRING(path); - - /* The pseudo root directory is a very special case indeed. - * We make up some pseudo data for it. - */ - if(path_nti.is_root) - { - SHOWMSG("returning data for / directory"); - - memset(buf,0,sizeof(*buf)); - - buf->f_bsize = 512; - buf->f_blocks = 1; - buf->f_bfree = 1; - buf->f_iosize = buf->f_bsize; - buf->f_bavail = buf->f_bfree; - buf->f_flags = MNT_NOATIME|MNT_SYMPERM|MNT_LOCAL|MNT_RDONLY; - - result = OK; - - goto out; - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - D(("trying to get a lock on '%s'",path)); - - PROFILE_OFF(); - lock = Lock((STRPTR)path,SHARED_LOCK); - PROFILE_ON(); - - if(lock == ZERO) - { - SHOWMSG("that didn't work"); - - __set_errno(__translate_access_io_error_to_errno(IoErr())); - goto out; - } - - PROFILE_OFF(); - status = Info(lock,id); - PROFILE_ON(); - - if(status == DOSFALSE) - { - SHOWMSG("didn't get the info"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - __convert_info_to_statfs(id,buf); - - result = OK; - - out: - - PROFILE_OFF(); - - UnLock(lock); - - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/ncrt0.S b/library/ncrt0.S deleted file mode 100644 index 5486870..0000000 --- a/library/ncrt0.S +++ /dev/null @@ -1,116 +0,0 @@ -| -| $Id: ncrt0.S,v 1.2 2005-01-02 09:07:07 obarthel Exp $ -| -| :ts=4 -| -| Portable ISO 'C' (1994) runtime library for the Amiga computer -| Copyright (c) 2002-2005 by Olaf Barthel -| 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. -| - -|----------------------------------------------------------------------------- - - .text - - .globl __main - -|----------------------------------------------------------------------------- - -#if defined(SMALL_DATA) - - jbsr _geta4 - - movel #___bss_size,d1 - beqs no_bss - lea a4@(__edata:W),a1 - -clear_bss: - - clrl a1@+ - subql #4,d1 - bnes clear_bss - -no_bss: - -#endif /* SMALL_DATA */ - -|----------------------------------------------------------------------------- - -#if defined(SMALL_DATA32) - - jbsr _geta4 - - movel #___bss_size,d1 - beqs no_bss - lea a4@(__edata:L),a1 - -clear_bss: - - clrl a1@+ - subql #4,d1 - bnes clear_bss - -no_bss: - -#endif /* SMALL_DATA32 */ - -|----------------------------------------------------------------------------- - - jmp __main - -|----------------------------------------------------------------------------- - - .globl _geta4 - -_geta4: - -#if defined(SMALL_DATA) - lea ___a4_init,a4 -#endif /* SMALL_DATA */ - -#if defined(SMALL_DATA32) - lea ___a4_init,a4 -#endif /* SMALL_DATA32 */ - - rts - -|----------------------------------------------------------------------------- - - .globl ___get_a4 - -___get_a4: - - movel a4,d0 - rts - -|----------------------------------------------------------------------------- - - .globl ___set_a4 - -___set_a4: - - movel sp@(4),a4 - rts diff --git a/library/net.lib_rev.c b/library/net.lib_rev.c deleted file mode 100644 index 9f8e641..0000000 --- a/library/net.lib_rev.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * $Id: net.lib_rev.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 "net.lib_rev.h" - -/****************************************************************************/ - -char __net_lib_version[] = VERSTAG; diff --git a/library/net.lib_rev.h b/library/net.lib_rev.h deleted file mode 100644 index 27e9b8a..0000000 --- a/library/net.lib_rev.h +++ /dev/null @@ -1,6 +0,0 @@ -#define VERSION 1 -#define REVISION 193 -#define DATE "4.6.2005" -#define VERS "net.lib 1.193" -#define VSTRING "net.lib 1.193 (4.6.2005)\r\n" -#define VERSTAG "\0$VER: net.lib 1.193 (4.6.2005)" diff --git a/library/net.lib_rev.rev b/library/net.lib_rev.rev deleted file mode 100644 index 2455a46..0000000 --- a/library/net.lib_rev.rev +++ /dev/null @@ -1 +0,0 @@ -193 diff --git a/library/nrcrt0.S b/library/nrcrt0.S deleted file mode 100644 index ab8fc46..0000000 --- a/library/nrcrt0.S +++ /dev/null @@ -1,182 +0,0 @@ -| -| $Id: nrcrt0.S,v 1.2 2005-01-02 09:07:07 obarthel Exp $ -| -| :ts=4 -| -| Portable ISO 'C' (1994) runtime library for the Amiga computer -| Copyright (c) 2002-2005 by Olaf Barthel -| 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. -| - -|----------------------------------------------------------------------------- - -LVOAllocMem = -0xc6 -LVOFreeMem = -0xd2 -LVOFindTask = -0x126 -LVOCopyMem = -0x270 - -|----------------------------------------------------------------------------- - -pr_Result2 = 148 -pr_CLI = 172 - -|----------------------------------------------------------------------------- - -RETURN_FAIL = 20 -ERROR_NO_FREE_STORE = 103 - -|----------------------------------------------------------------------------- - -MEMF_CLEAR = 65536 - -|----------------------------------------------------------------------------- - - .text - - .globl __main - .globl ___is_resident - -|----------------------------------------------------------------------------- - - movel 4:W,a6 - - subal a1,a1 - jsr a6@(LVOFindTask:W) - - movel d0,a2 - tstl a2@(pr_CLI:W) - bnes from_shell - -|----------------------------------------------------------------------------- - - lea ___a4_init,a4 - - movel #___bss_size,d1 - beqs no_bss - -#if defined(SMALL_DATA) - lea a4@(__edata:W),a1 -#endif /* SMALL_DATA */ - -#if defined(SMALL_DATA32) - lea a4@(__edata:L),a1 -#endif /* SMALL_DATA32 */ - -clear_bss: - - clrl a1@+ - subql #4,d1 - bnes clear_bss - -no_bss: - - jmp __main - -|----------------------------------------------------------------------------- - -from_shell: - - movel #___data_size,d5 - movel #___bss_size,d0 - addl d5,d0 - movel #MEMF_CLEAR,d1 - jsr a6@(LVOAllocMem:W) - tstl d0 - beqs fail - - movel d0,a4 - - lea ___a4_init-0x7ffe,a5 - movel d5,d0 - movel a5,a0 - movel a4,a1 - jsr a6@(LVOCopyMem:W) - - lea ___datadata_relocs,a0 - movel a0@+,d0 - beqs no_reloc - - movel a5,d1 - subl a4,d1 - -do_reloc: - - movel a0@+,a1 - subl d1,a4@(a1:l) - subql #1,d0 - bnes do_reloc - -no_reloc: - - lea a4@(0x7ffe:W),a4 - -#if defined(SMALL_DATA) - lea a4@(___is_resident:W),a2 -#endif /* SMALL_DATA */ - -#if defined(SMALL_DATA32) - lea a4@(___is_resident:L),a2 -#endif /* SMALL_DATA32 */ - - movew #1,a2@ - - jbsr __main - movel d0,d2 - - movel 4:W,a6 - movel #___data_size,d0 - addl #___bss_size,d0 - lea a4@(-0x7ffe:W),a1 - jsr a6@(LVOFreeMem:W) - - movel d2,d0 - - rts - -fail: - - movel #ERROR_NO_FREE_STORE,a2@(pr_Result2:W) - moveql #RETURN_FAIL,d0 - - rts - -|----------------------------------------------------------------------------- - - .globl ___get_a4 - -___get_a4: - - movel a4,d0 - rts - -|----------------------------------------------------------------------------- - - .globl ___set_a4 - -___set_a4: - - movel sp@(4),a4 - rts diff --git a/library/profile__mcount.c b/library/profile__mcount.c deleted file mode 100644 index fde8576..0000000 --- a/library/profile__mcount.c +++ /dev/null @@ -1,106 +0,0 @@ -#include "profile_gmon.h" -#include -#include -#include - - -void __mcount(uint32 frompc, uint32 selfpc); - -void -__mcount(uint32 frompc, uint32 selfpc) -{ - uint16 *frompcindex; - struct tostruct *top, *prevtop; - struct gmonparam *p; - - int32 toindex; - - p = &_gmonparam; - - if (p->state != kGmonProfOn) return; - - p->state = kGmonProfBusy; - - /* - * Check if the PC is inside our text segment. - * Really should be... - */ - frompc -= p->lowpc; - selfpc -= p->lowpc; - if (frompc > p->textsize) goto done; - -#if (HASHFRACTION & (HASHFRACTION-1)) == 0 - if (p->hashfraction == HASHFRACTION) - { - frompcindex = &p->froms[(size_t)(frompc / (HASHFRACTION * - sizeof(*p->froms)))]; - } - else -#endif - { - frompcindex = &p->froms[(size_t)(frompc / (p->hashfraction * - sizeof(*p->froms)))]; - } - - toindex = *frompcindex; - - if (toindex == 0) - { - /* first time down this arc */ - toindex = ++p->tos[0].link; - if (toindex >= p->tolimit) - /* Ouch! Overflow */ - goto overflow; - - *frompcindex = (uint16)toindex; - top = &p->tos[toindex]; - top->selfpc = selfpc; - top->count = 1; - top->link = 0; - goto done; - } - - top = &p->tos[toindex]; - if (top->selfpc == selfpc) - { - /* arc at front of chain */ - top->count++; - goto done; - } - - for (;;) - { - if (top->link == 0) - { - toindex = ++p->tos[0].link; - if (toindex >= p->tolimit) - goto overflow; - - top = &p->tos[toindex]; - top->selfpc = selfpc; - top->count = 1; - top->link = *frompcindex; - *frompcindex = (uint16)toindex; - goto done; - } - prevtop = top; - top = &p->tos[top->link]; - if (top->selfpc == selfpc) - { - top->count++; - toindex = prevtop->link; - prevtop->link = top->link; - top->link = *frompcindex; - *frompcindex = (uint16)toindex; - goto done; - } - } - -done: - p->state = kGmonProfOn; - return; - -overflow: - p->state = kGmonProfError; - return; -} diff --git a/library/profile_gmon.c b/library/profile_gmon.c deleted file mode 100644 index b73a65b..0000000 --- a/library/profile_gmon.c +++ /dev/null @@ -1,288 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#define SCALE_1_TO_1 0x10000L - -#include "profile_gmon.h" -#undef DebugPrintF -#define dprintf(format, args...)((struct ExecIFace *)((*(struct ExecBase **)4)->MainInterface))->DebugPrintF("[%s] " format, __PRETTY_FUNCTION__ , ## args) - -struct gmonparam _gmonparam = -{ - state: kGmonProfOn -}; - -static unsigned int s_scale; - -void moncontrol(int); -void monstartup(uint32, uint32); -void moncleanup(void); -void mongetpcs(uint32* lowpc, uint32 *highpc); - -extern int profil(uint16 *buffer, uint32 bufSize, - uint32 offset, uint32 scale); - -void -monstartup(uint32 low_pc, uint32 high_pc) -{ - uint8 *cp; - uint32 lowpc, highpc; - struct gmonparam *p = &_gmonparam; - dprintf("in monstartup)\n"); - /* - * If we don't get proper lowpc and highpc, then - * we'll try to get them from the elf handle. - */ - if (low_pc == 0 && high_pc == 0) - { - mongetpcs(&lowpc, &highpc); - } - else - { - lowpc = low_pc; - highpc = high_pc; - } - - /* - * Round lowpc and highpc to multiples of the density - * to prevent using floating point scaling - */ - p->lowpc = ROUNDDOWN(lowpc, HISTFRACTION * sizeof(HISTCOUNTER)); - p->highpc = ROUNDUP(highpc, HISTFRACTION * sizeof(HISTCOUNTER)); - - /* Size of the text segment */ - p->textsize = p->highpc - p->lowpc; - - /* - * Size of the histogram. Due to the nature of PowerPC code, - * we can safely use a histogram fraction of at least 4, since - * every instruction is exactly one word wide and always aligned. - */ - p->kcountsize = p->textsize / HISTFRACTION; - - /* - * The hash table size - */ - p->hashfraction = HASHFRACTION; - p->fromssize = p->textsize / p->hashfraction; - - p->tolimit = p->textsize * ARCDENSITY / 100; - if (p->tolimit < MINARCS) - p->tolimit = MINARCS; - else if (p->tolimit > MAXARCS) - p->tolimit = MAXARCS; - - p->tossize = p->tolimit * sizeof(struct tostruct); - - dprintf("lowpc = %p, highpc = %p\n", lowpc, highpc); - dprintf("textsize = %d\n", p->textsize); - dprintf("kcountsize = %d\n", p->kcountsize); - dprintf("fromssize = %d\n", p->fromssize); - dprintf("tolimit = %d, tossize = %d\n", p->tolimit, p->tossize); - - cp = (uint8*)AllocMem(p->kcountsize + p->fromssize + p->tossize, - MEMF_CLEAR); - if (!cp) - { - p->state = kGmonProfError; - return; - } - - p->memory = cp; - p->tos = (struct tostruct *)cp; - cp += p->tossize; - - p->kcount = (uint16 *)cp; - cp += p->kcountsize; - - p->froms = (uint16 *)cp; - - p->tos[0].link = 0; - - /* Verify granularity for sampling */ - if (p->kcountsize < p->textsize) - /* FIXME Avoid floating point */ - s_scale = ((float)p->kcountsize / p->textsize) * SCALE_1_TO_1; - else - s_scale = SCALE_1_TO_1; - - s_scale >>= 1; - dprintf("Enabling monitor\n"); - moncontrol(1); -} - -void -moncontrol(int mode) -{ - struct gmonparam *p = &_gmonparam; - - if (mode) - { - /* Start profiling. */ - profil((uint16 *)p->kcount, (size_t)p->kcountsize, - p->lowpc, s_scale); - p->state = kGmonProfOn; - } - else - { - /* Stop Profiling. */ - profil(NULL, 0, (uint32)0, 0); - p->state = kGmonProfOff; - } -} - -void -moncleanup(void) -{ - BPTR fd; - int fromindex; - int endfrom; - uint32 frompc; - int toindex; - struct rawarc rawarc; - struct gmonparam *p = &_gmonparam; - struct gmonhdr gmonhdr, *hdr; -#ifdef DEBUG - FILE *log; -#endif - - moncontrol(0); - - if (p->state == kGmonProfError) - { - fprintf(stderr, "WARNING: Overflow during profiling\n"); - } - - fd = Open("gmon.out", MODE_NEWFILE); - if (!fd) - { - fprintf(stderr, "ERROR: could not open gmon.out\n"); - return; - } - - hdr = (struct gmonhdr *)&gmonhdr; - - hdr->lpc = 0; //p->lowpc; - hdr->hpc = p->highpc - p->lowpc; - hdr->ncnt = (int)p->kcountsize + sizeof(gmonhdr); - hdr->version = GMONVERSION; - hdr->profrate = 100; //FIXME:!! - - Write(fd, hdr, sizeof(*hdr)); - Write(fd, p->kcount, p->kcountsize); - - endfrom = p->fromssize / sizeof(*p->froms); - -#ifdef DEBUG - log = fopen("gmon.log", "w"); -#endif - - for (fromindex = 0; fromindex < endfrom; fromindex++) - { - if (p->froms[fromindex] == 0) continue; - - frompc = 0; /* FIXME: was p->lowpc; needs to be 0 and assumes - -Ttext=0 on compile. Better idea? */ - frompc += fromindex * p->hashfraction * sizeof (*p->froms); - for (toindex = p->froms[fromindex]; toindex != 0; - toindex = p->tos[toindex].link) - { -#ifdef DEBUG - if (log) fprintf(log, "%p called from %p: %d times\n", frompc, - p->tos[toindex].selfpc, - p->tos[toindex].count); -#endif - rawarc.raw_frompc = frompc; - rawarc.raw_selfpc = p->tos[toindex].selfpc; - rawarc.raw_count = p->tos[toindex].count; - Write(fd, &rawarc, sizeof(rawarc)); - } - } - -#ifdef DEBUG - if (log) fclose(log); -#endif - Close(fd); - -} - -void -mongetpcs(uint32* lowpc, uint32 *highpc) -{ - struct Library *ElfBase = NULL; - struct ElfIFace *IElf = NULL; - struct Process *self; - BPTR seglist; - Elf32_Handle elfHandle; - uint32 i; - Elf32_Shdr *shdr; - uint32 numSections; - - *lowpc = 0; - *highpc = 0; - - ElfBase = OpenLibrary("elf.library", 0L); - if (!ElfBase) goto out; - - IElf = (struct ElfIFace *)GetInterface(ElfBase, "main", 1, NULL); - if (!IElf) goto out; - - self = (struct Process *)FindTask(0); - seglist = GetProcSegList(self); - - GetSegListInfoTags(seglist, - GSLI_ElfHandle, &elfHandle, - TAG_DONE); - - elfHandle = OpenElfTags( - OET_ElfHandle, elfHandle, - TAG_DONE); - - if (!elfHandle) goto out; - - GetElfAttrsTags(elfHandle, EAT_NumSections, &numSections, TAG_DONE); - - for (i = 0; i < numSections; i++) - { - shdr = GetSectionHeaderTags(elfHandle, - GST_SectionIndex, i, - TAG_DONE); - if (shdr && (shdr->sh_flags & SWF_EXECINSTR)) - { - uint32 base = (uint32)GetSectionTags(elfHandle, - GST_SectionIndex, i, - TAG_DONE); - *lowpc = base; - *highpc = base + shdr->sh_size; - break; - } - } - - CloseElfTags(elfHandle, CET_ReClose, TRUE, TAG_DONE); - -out: - if (IElf) DropInterface((struct Interface *)IElf); - if (ElfBase) CloseLibrary(ElfBase); -} - - -#include "macros.h" - -int __profiler_init(void) __attribute__((constructor)); -void __profiler_exit(void) __attribute__((destructor)); - -int __profiler_init(void) -{ - monstartup(0,0); - return OK; -} - -void __profiler_exit(void) -{ - moncleanup(); -} diff --git a/library/profile_gmon.h b/library/profile_gmon.h deleted file mode 100644 index 9805b9e..0000000 --- a/library/profile_gmon.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef _GMON_H -#define _GMON_H - -#include - -struct gmonhdr -{ - uint32 lpc; - uint32 hpc; - int ncnt; - int version; - int profrate; - int reserved[3]; -}; - -#define GMONVERSION 0x00051879 - -#define HISTCOUNTER uint16 -// I am sure we can make these bigger -#define HISTFRACTION 2 -#define HASHFRACTION 4 - -#define ARCDENSITY 2 -#define MINARCS 50 -#define MAXARCS ((1 << (8 * sizeof(HISTCOUNTER)))-2) - -struct tostruct -{ - uint32 selfpc; - int32 count; - uint16 link; - uint16 pad; -}; - -struct rawarc -{ - uint32 raw_frompc; - uint32 raw_selfpc; - int32 raw_count; -}; - -#define ROUNDDOWN(x,y) (((x)/(y))*(y)) -#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y)) - -struct gmonparam -{ - int state; - uint16 * kcount; - uint32 kcountsize; - uint16 * froms; - uint32 fromssize; - struct tostruct * tos; - uint32 tossize; - int32 tolimit; - uint32 lowpc; - uint32 highpc; - uint32 textsize; - uint32 hashfraction; - uint8 * memory; -}; - -extern struct gmonparam _gmonparam; - -enum -{ - kGmonProfOn = 0, - kGmonProfBusy = 1, - kGmonProfError = 2, - kGmonProfOff = 3 -}; - -enum -{ - kGprofState = 0, - kGprofCount = 1, - kGprofFroms = 2, - kGprofTos = 3, - kGprofGmonParam = 4 -}; - -#endif diff --git a/library/profile_mcount.S b/library/profile_mcount.S deleted file mode 100644 index 1bfb51a..0000000 --- a/library/profile_mcount.S +++ /dev/null @@ -1,36 +0,0 @@ - .globl _mcount - .type _mcount,@function -_mcount: - stwu r1,-64(r1) - stw r3,16(r1) - stw r4,20(r1) - stw r5,24(r1) - stw r6,28(r1) - stw r7,32(r1) - stw r8,36(r1) - stw r9,40(r1) - stw r10,44(r1) - - mflr r4 - stw r4,48(r1) - lwz r3,68(r1) - - bl __mcount - lwz r3,68(r1) - mtlr r3 - lwz r4,48(r1) - mtctr r4 - - lwz r3,16(r1) - lwz r4,20(r1) - lwz r5,24(r1) - lwz r6,28(r1) - lwz r7,32(r1) - lwz r8,36(r1) - lwz r9,40(r1) - lwz r10,44(r1) - addi r1,r1,64 - bctr -_mcount_end: - .size _mcount,_mcount_end-_mcount - diff --git a/library/profile_profil.c b/library/profile_profil.c deleted file mode 100644 index b41d13b..0000000 --- a/library/profile_profil.c +++ /dev/null @@ -1,127 +0,0 @@ -#include -#include -#include -#include -#include - -static struct Interrupt CounterInt; -static struct PerformanceMonitorIFace *IPM; - -static struct IntData -{ - struct PerformanceMonitorIFace *IPM; - uint16 *Buffer; - uint32 BufferSize; - uint32 Offset; - uint32 Scale; - uint32 CounterStart; -} ProfileData; - -uint32 GetCounterStart(void); -uint32 CounterIntFn(struct ExceptionContext *, struct ExecBase *, struct IntData *); - - -uint32 -GetCounterStart(void) -{ - uint64 fsb; - double bit0time; - uint32 count; - - GetCPUInfoTags( - GCIT_FrontsideSpeed, &fsb, - TAG_DONE); - - /* Timebase ticks at 1/4 of FSB */ - bit0time = 8.0 / (double)fsb; - count = (uint32)(0.01 / bit0time); - - return 0x80000000 - count; -} - -uint32 -CounterIntFn(struct ExceptionContext *ctx, struct ExecBase *ExecBase, - struct IntData *ProfileData) -{ - uint32 sia = (uint32)ProfileData->IPM->GetSampledAddress(); - - /* Silence compiler */ - (void)ExecBase; - (void)ctx; - - sia = ((sia - ProfileData->Offset) * ProfileData->Scale) >> 16; - - if (sia <= (ProfileData->BufferSize>>1)) - { - //if (ProfileData->Buffer[sia] != 0xffff) - ProfileData->Buffer[sia]++; - } - - IPM->CounterControl(1, ProfileData->CounterStart, PMCI_Transition); - - return 1; -} - - -int -profil(unsigned short *buffer, size_t bufSize, size_t offset, unsigned int scale) -{ - APTR Stack; - - if (buffer == 0) - { - Stack = SuperState(); - IPM->EventControlTags( - PMECT_Disable, PMEC_MasterInterrupt, - TAG_DONE); - - IPM->SetInterruptVector(1, 0); - - IPM->Unmark(0); - IPM->Release(); - if (Stack) UserState(Stack); - - return 0; - } - - IPM = (struct PerformanceMonitorIFace *) - OpenResource("performancemonitor.resource"); - - if (!IPM || IPM->Obtain() != 1) - { - return 0; - } - - Stack = SuperState(); - - /* Init IntData */ - ProfileData.IPM = IPM; - ProfileData.Buffer = buffer; - ProfileData.BufferSize = bufSize; - ProfileData.Offset = offset; - ProfileData.Scale = scale; - ProfileData.CounterStart = GetCounterStart(); - - /* Set interrupt vector */ - CounterInt.is_Code = (void (*)())CounterIntFn; - CounterInt.is_Data = &ProfileData; - IPM->SetInterruptVector(1, &CounterInt); - - /* Prepare Performance Monitor */ - IPM->MonitorControlTags( - PMMCT_FreezeCounters, PMMC_Unmarked, - PMMCT_RTCBitSelect, PMMC_BIT0, - TAG_DONE); - IPM->CounterControl(1, ProfileData.CounterStart, PMCI_Transition); - - IPM->EventControlTags( - PMECT_Enable, 1, - PMECT_Enable, PMEC_MasterInterrupt, - TAG_DONE); - - IPM->Mark(0); - - if (Stack) UserState(Stack); - - return 0; -} diff --git a/library/releasenotes b/library/releasenotes deleted file mode 100644 index 114b22d..0000000 --- a/library/releasenotes +++ /dev/null @@ -1,10 +0,0 @@ -c.lib 1.180 (23.10.2004) - -- The printf() family now produces no output at all for floating point - numbers (%e, %f and %g) if the floating point support code is disabled. - In previous versions of the library some output (series of 0 or blank - space characters) could still be produced. - -- The scanf() family no longer ignores a conversion request of - type '%x' (hexadecimal) and treats the number to be processed - as in octal notation if that number begins with the digit 0. diff --git a/library/sas_cxamemcpy.asm b/library/sas_cxamemcpy.asm deleted file mode 100644 index be51e42..0000000 --- a/library/sas_cxamemcpy.asm +++ /dev/null @@ -1,46 +0,0 @@ -* -* $Id: sas_cxamemcpy.asm,v 1.2 2005-01-02 09:07:07 obarthel Exp $ -* -* :ts=8 -* -* Portable ISO 'C' (1994) runtime library for the Amiga computer -* Copyright (c) 2002-2005 by Olaf Barthel -* 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 - - xdef __CXAMEMCPY - -__CXAMEMCPY: - - move.b (a0)+,(a1)+ - subq.l #1,d0 - bne.b __CXAMEMCPY - - rts - - end diff --git a/library/sas_cxamemset.asm b/library/sas_cxamemset.asm deleted file mode 100644 index cdc4033..0000000 --- a/library/sas_cxamemset.asm +++ /dev/null @@ -1,89 +0,0 @@ -* -* $Id: sas_cxamemset.asm,v 1.1.1.1 2004-07-26 16:31:03 obarthel Exp $ -* -* :ts=8 -* -* Adapted from reassembled SAS/C runtime library code. -* - - section text,code - - xdef __CXAMEMSET - -__CXAMEMSET: - - cmpi.l #$18,d1 - blt.s L2A - -L10: move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - subi.l #$18,d1 - cmpi.l #$18,d1 - bge.s L10 - -L2A: add.w d1,d1 - move.w L34(pc,d1.w),d1 - jmp L34(pc,d1.w) - -L34: dc.w $66 - dc.w $58 - dc.w $4A - dc.w $3A - dc.w $64 - dc.w $56 - dc.w $48 - dc.w $38 - dc.w $62 - dc.w $54 - dc.w $46 - dc.w $36 - dc.w $60 - dc.w $52 - dc.w $44 - dc.w $34 - dc.w $5E - dc.w $50 - dc.w $42 - dc.w $32 - dc.w $5C - dc.w $4E - dc.w $40 - dc.w $30 - - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - move.w d0,(a0)+ - move.b d0,(a0)+ - rts - - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - move.w d0,(a0)+ - rts - - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - move.b d0,(a0)+ - rts - - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - move.l d0,(a0)+ - rts - - end diff --git a/library/sas_cxferr.c b/library/sas_cxferr.c deleted file mode 100644 index f3f1978..0000000 --- a/library/sas_cxferr.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * $Id: sas_cxferr.c,v 1.1.1.1 2004-07-26 16:31:03 obarthel Exp $ - * - * :ts=4 - * - * Adapted from SAS/C runtime library code. - */ - -#ifndef _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -/****************************************************************************/ - -void __stdargs -_CXFERR(int code) -{ - raise(SIGFPE); -} diff --git a/library/sas_cxv.asm b/library/sas_cxv.asm deleted file mode 100644 index e8d7d3f..0000000 --- a/library/sas_cxv.asm +++ /dev/null @@ -1,141 +0,0 @@ -* -* $Id: sas_cxv.asm,v 1.1.1.1 2004-07-26 16:31:04 obarthel Exp $ -* -* :ts=8 -* -* Adapted from reassembled SAS/C runtime library code. -* - - section text,code - - xdef __CXV25 - xdef __CXV35 - xdef __CXNRM5 - xdef __CXTAB5 - -__CXV25: - - MOVEM.L D2-D5/A1,-(SP) - MOVEQ #0,D4 - MOVEQ #0,D1 - BRA L2C - -__CXV35: - - MOVEM.L D2-D5/A1,-(SP) - MOVEQ #0,D4 - MOVEQ #0,D1 - TST.L D0 - BEQ L54 - BPL L2C - MOVE.W #$8000,D4 - NEG.L D0 - -L2C: CMP.L #$200000,D0 - BCC L44 - MOVE.W #$4120,D5 - JSR __CXNRM5(PC) -L54: MOVEM.L (SP)+,D2-D5/A1 - RTS - -L44: MOVE.W D0,D1 - CLR.W D0 - SWAP D0 - SWAP D1 - MOVE.W #$4220,D5 - JSR __CXNRM5(PC) - MOVEM.L (SP)+,D2-D5/A1 - RTS - -__CXNRM5: - - CMP.L #$20,D0 - BGE L98 - SWAP D0 - SWAP D1 - MOVE.W D1,D0 - CLR.W D1 - SUB.W #$100,D5 - BGE.S __CXNRM5 - BRA LDC - -__CXTAB5: - - dc.b 5 - dc.b 4 - dc.b 3 - dc.b 3 - dc.b 2 - dc.b 2 - dc.b 2 - dc.b 2 - dc.b 1 - dc.b 1 - dc.b 1 - dc.b 1 - dc.b 1 - dc.b 1 - dc.b 1 - dc.b 1 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - -L98: MOVEQ #0,D3 - CMP.L #$2000,D0 - BGE LA8 - LSL.L #8,D0 - ADDQ.W #8,D3 - -LA8: SWAP D0 - TST.W D0 - BNE LB4 - ROL.L #4,D0 - ADDQ.W #4,D3 - -LB4: MOVEQ #0,D2 - MOVE.B __CXTAB5(PC,D0.W),D2 - ROL.L D2,D0 - ADD.W D2,D3 - SWAP D0 - MOVE.L D1,D2 - LSL.L D3,D1 - ROL.L D3,D2 - EOR.W D1,D2 - EOR.W D2,D0 - LSL.W #4,D3 - SUB.W D3,D5 - BLT LDC - SWAP D0 - ADD.W D5,D0 - OR.W D4,D0 - SWAP D0 - RTS - -LDC: NEG.W D5 - LSR.W #4,D5 - MOVE.L D0,D2 - LSR.L D5,D0 - ROR.L D5,D2 - LSR.L D5,D1 - EOR.L D0,D2 - EOR.L D2,D1 - SWAP D0 - EOR.W D4,D0 - SWAP D0 - RTS - - end diff --git a/library/sas_cxv45.asm b/library/sas_cxv45.asm deleted file mode 100644 index b1ebca0..0000000 --- a/library/sas_cxv45.asm +++ /dev/null @@ -1,143 +0,0 @@ -* -* $Id: sas_cxv45.asm,v 1.1.1.1 2004-07-26 16:31:04 obarthel Exp $ -* -* :ts=8 -* -* Adapted from reassembled SAS/C runtime library code. -* - - section text,code - - xdef __CXV45 - -__CXV45 - MOVE.L D0,D1 - SWAP D1 - AND.W #$7FFF,D1 - CMP.W #$80,D1 - BLT lbC00003E - CMP.W #$7F80,D1 - BGE lbC000060 - ASR.L #3,D0 - AND.L #$8FFFFFFF,D0 - ADD.L #$38000000,D0 - SWAP D1 - AND.L #7,D1 - ROR.L #3,D1 -lbC00003C - RTS - -lbC00003E - TST.L D1 - BEQ.S lbC00003C - MOVEM.L D2-D5,-(SP) - SWAP D0 - MOVE.W D0,D4 - AND.W #$8000,D4 - MOVE.W #$39D0,D5 - MOVEQ #0,D0 - SWAP D1 - JSR __CXNRM5(PC) - MOVEM.L (SP)+,D2-D5 - RTS - -lbC000060 - ASR.L #3,D0 - OR.L #$7FF00000,D0 - SWAP D1 - AND.L #7,D1 - ROR.L #3,D1 - RTS - -__CXNRM5 - CMP.L #$20,D0 - BGE lbC0000B0 - SWAP D0 - SWAP D1 - MOVE.W D1,D0 - CLR.W D1 - SUB.W #$100,D5 - BGE.S __CXNRM5 - BRA lbC0000F4 - -__CXTAB5 - dc.b 5 - dc.b 4 - dc.b 3 - dc.b 3 - dc.b 2 - dc.b 2 - dc.b 2 - dc.b 2 - dc.b 1 - dc.b 1 - dc.b 1 - dc.b 1 - dc.b 1 - dc.b 1 - dc.b 1 - dc.b 1 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - dc.b 0 - -lbC0000B0 - MOVEQ #0,D3 - CMP.L #$2000,D0 - BGE lbC0000C0 - LSL.L #8,D0 - ADDQ.W #8,D3 -lbC0000C0 - SWAP D0 - TST.W D0 - BNE lbC0000CC - ROL.L #4,D0 - ADDQ.W #4,D3 -lbC0000CC - MOVEQ #0,D2 - MOVE.B __CXTAB5(PC,D0.W),D2 - ROL.L D2,D0 - ADD.W D2,D3 - SWAP D0 - MOVE.L D1,D2 - LSL.L D3,D1 - ROL.L D3,D2 - EOR.W D1,D2 - EOR.W D2,D0 - LSL.W #4,D3 - SUB.W D3,D5 - BLT lbC0000F4 - SWAP D0 - ADD.W D5,D0 - OR.W D4,D0 - SWAP D0 - RTS - -lbC0000F4 - NEG.W D5 - LSR.W #4,D5 - MOVE.L D0,D2 - LSR.L D5,D0 - ROR.L D5,D2 - LSR.L D5,D1 - EOR.L D0,D2 - EOR.L D2,D1 - SWAP D0 - EOR.W D4,D0 - SWAP D0 - RTS - - end diff --git a/library/sas_cxv54.asm b/library/sas_cxv54.asm deleted file mode 100644 index 7493938..0000000 --- a/library/sas_cxv54.asm +++ /dev/null @@ -1,114 +0,0 @@ -* -* $Id: sas_cxv54.asm,v 1.1.1.1 2004-07-26 16:31:04 obarthel Exp $ -* -* :ts=8 -* -* Adapted from reassembled SAS/C runtime library code. -* - - section text,code - - xdef __CXV54 - xref __CXFERR - -__CXV54 - MOVEM.L A0/A1,-(SP) - MOVE.L D4,A0 - SWAP D0 - MOVE.W D0,D4 - AND.W #$8000,D4 - EOR.W D4,D0 - SUB.W #$3800,D0 - CMP.W #$10,D0 - BLT lbC000098 - CMP.W #$FEF,D0 - BLT lbC000102 - CMP.W #$47F0,D0 - BLT lbC000058 - SWAP D0 - LSL.L #3,D0 - ROL.L #3,D1 - AND.L #7,D1 - EOR.L D1,D0 - SWAP D0 - OR.W #$7F80,D0 - BRA lbC000112 - -lbC000058 - CMP.W #$FF0,D0 - BGE lbC000074 - CMP.L #$FFFF0FEF,D0 - BNE lbC000102 - CMP.L #$F0000000,D1 - BCS lbC000102 -lbC000074 - MOVEM.L D0/D1/A0/A1,-(SP) - PEA 2.L - JSR __CXFERR - ADDQ.W #4,SP - MOVEM.L (SP)+,D0/D1/A0/A1 - MOVE.L #$7F80,D0 - EOR.W D4,D0 - SWAP D0 - MOVEQ #0,D1 - BRA lbC000116 - -lbC000098 - CMP.W #$FE90,D0 - BGE lbC0000C4 - ADD.W #$3800,D0 - OR.L D1,D0 - BEQ lbC000112 - MOVEM.L D0/D1/A0/A1,-(SP) - PEA 1.L - JSR __CXFERR - ADDQ.W #4,SP - MOVEM.L (SP)+,D0/D1/A0/A1 - MOVEQ #0,D0 - BRA lbC000112 - -lbC0000C4 - MOVE.L D5,A1 - MOVE.W D0,D5 - AND.W #15,D0 - EOR.W #$10,D0 - SWAP D0 - ASR.W #4,D5 - ADDQ.W #2,D5 - BGE lbC0000E6 - NEG.W D5 - LSR.L D5,D0 - MOVEQ #0,D5 - ADDX.L D5,D0 - BRA lbC0000F6 - -lbC0000E6 - CLR.W D1 - LSL.L D5,D0 - ADDQ.W #1,D5 - ROXL.L D5,D1 - AND.L #15,D1 - ADDX.L D1,D0 -lbC0000F6 - MOVE.L A1,D5 - SWAP D0 - EOR.W D4,D0 - SWAP D0 - BRA lbC000116 - -lbC000102 - SWAP D0 - LSL.L #3,D0 - ROXL.L #4,D1 - AND.L #7,D1 - ADDX.L D1,D0 - SWAP D0 -lbC000112 - EOR.W D4,D0 - SWAP D0 -lbC000116 - MOVE.L A0,D4 - MOVEM.L (SP)+,A0/A1 - RTS - - end diff --git a/library/sas_profile.c b/library/sas_profile.c deleted file mode 100644 index 0a944b7..0000000 --- a/library/sas_profile.c +++ /dev/null @@ -1,348 +0,0 @@ -/* - * $Id: sas_profile.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Adapted from SAS/C runtime library code. - */ - -#ifndef EXEC_MEMORY_H -#include -#endif /* EXEC_MEMORY_H */ - -#ifndef EXEC_PORTS_H -#include -#endif /* EXEC_PORTS_H */ - -#ifndef EXEC_DEVICES_H -#include -#endif /* EXEC_DEVICES_H */ - -#ifndef DEVICES_TIMER_H -#include -#endif /* DEVICES_TIMER_H */ - -/****************************************************************************/ - -#define __NOLIBBASE__ -#define __NOGLOBALIFACE__ - -#ifndef PROTO_EXEC_H -#include -#endif /* PROTO_EXEC_H */ - -#ifndef PROTO_TIMER_H -#include -#endif /* PROTO_TIMER_H */ - -/****************************************************************************/ - -extern struct Library * SysBase; - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -#include "macros.h" -#include "debug.h" - -/****************************************************************************/ - -struct SPROFMSG -{ - struct Message message; - - struct Process * process; - ULONG clock_value; - char * id; - ULONG stack_pointer; - ULONG flags; -}; - -/****************************************************************************/ - -/* Values for the 'flags' field of SPROFMSG */ -#define SPROF_INIT 0x00000001 /* Initialize connection */ -#define SPROF_ENTRY 0x00000002 /* Function entry */ -#define SPROF_EXIT 0x00000004 /* Function exit */ -#define SPROF_TERM 0x00000008 /* Terminate connection, program continues */ -#define SPROF_ABORT 0x00000010 /* Abort program */ -#define SPROF_DENIED 0x00000020 /* Connection refused */ - -/****************************************************************************/ - -static struct Library * TimerBase; - -/****************************************************************************/ - -static struct MsgPort * profiler_port; -static struct MsgPort * reply_port; - -static struct MsgPort * time_port; -static struct timerequest * time_request; - -static struct Process * this_process; - -static struct EClockVal start_time; -static ULONG eclock_frequency; -static struct EClockVal last_time; -static ULONG overhead; - -static ULONG num_messages_allocated; - -static BOOL initialized; - -/****************************************************************************/ - -STATIC int send_profiler_message(ULONG clock_value, char *id, ULONG flags); -STATIC ULONG get_current_time(void); -STATIC void update_overhead(void); -STATIC void __profile_init(void); -STATIC void __profile_exit(void); - -/****************************************************************************/ - -void ASM _PROLOG(REG(a0, char *id)); -void ASM _EPILOG(REG(a0, char *id)); - -/****************************************************************************/ - -STATIC int -send_profiler_message(ULONG clock_value,char * id,ULONG flags) -{ - extern long __builtin_getreg(int); - - struct SPROFMSG * spm; - int result = ERROR; - - spm = (struct SPROFMSG *)GetMsg(reply_port); - if(spm != NULL) - { - if(flags != SPROF_TERM && spm->flags == SPROF_TERM) - { - PutMsg(reply_port,(struct Message *)spm); - - __profile_exit(); - goto out; - } - } - else - { - spm = AllocMem(sizeof(*spm),MEMF_ANY|MEMF_PUBLIC|MEMF_CLEAR); - if(spm == NULL) - { - __profile_exit(); - goto out; - } - - spm->message.mn_Length = sizeof(*spm); - spm->message.mn_ReplyPort = reply_port; - spm->process = this_process; - - num_messages_allocated++; - } - - spm->clock_value = clock_value; - spm->id = id; - spm->stack_pointer = __builtin_getreg(15); /* getreg(REG_A7) */ - spm->flags = flags; - - PutMsg(profiler_port,(struct Message *)spm); - WaitPort(reply_port); - - result = 0; - - out: - - return(result); -} - -/****************************************************************************/ - -STATIC ULONG -get_current_time(void) -{ - ULONG result; - - ReadEClock(&last_time); - - result = (last_time.ev_lo - start_time.ev_lo - overhead) / eclock_frequency; - - return(result); -} - -/****************************************************************************/ - -STATIC void -update_overhead(void) -{ - struct EClockVal ev; - - ReadEClock(&ev); - - overhead += (ev.ev_lo - last_time.ev_lo); -} - -/****************************************************************************/ - -void ASM -_PROLOG(REG(a0,char * id)) -{ - if(initialized) - { - if(send_profiler_message(get_current_time(),id,SPROF_ENTRY) == OK) - update_overhead(); - } -} - -/****************************************************************************/ - -void ASM -_EPILOG(REG(a0,char * id)) -{ - if(initialized) - { - if(send_profiler_message(get_current_time(),id,SPROF_EXIT) == OK) - update_overhead(); - } -} - -/****************************************************************************/ - -STATIC VOID -__profile_init(void) -{ - struct SPROFMSG * spm; - BOOL ready = FALSE; - - this_process = (struct Process *)FindTask(NULL); - - time_port = CreateMsgPort(); - if(time_port == NULL) - goto out; - - time_request = (struct timerequest *)CreateIORequest(time_port,sizeof(*time_request)); - if(time_request == NULL) - goto out; - - if(OpenDevice(TIMERNAME,UNIT_ECLOCK,(struct IORequest *)time_request,0) != OK) - goto out; - - TimerBase = (struct Library *)time_request->tr_node.io_Device; - - reply_port = CreateMsgPort(); - if(reply_port == NULL) - goto out; - - Forbid(); - - profiler_port = FindPort("SPROF_Profiler"); - if(profiler_port == NULL) - { - Permit(); - - goto out; - } - - if(send_profiler_message(0,NULL,SPROF_INIT) != OK) - { - Permit(); - - goto out; - } - - initialized = TRUE; - - Permit(); - - while((spm = (struct SPROFMSG *)GetMsg(reply_port)) == NULL) - WaitPort(reply_port), - - PutMsg(reply_port,(struct Message *)spm); - - if(spm->flags == SPROF_DENIED || spm->flags == SPROF_TERM) - goto out; - - eclock_frequency = ReadEClock(&start_time) / 1000; - - ready = TRUE; - - out: - - if(NOT ready) - __profile_exit(); -} - -/****************************************************************************/ - -STATIC VOID -__profile_exit(void) -{ - if(initialized) - { - send_profiler_message(0,NULL,SPROF_TERM); - - initialized = FALSE; - } - - if(reply_port != NULL) - { - struct SPROFMSG * spm; - - while(num_messages_allocated > 0) - { - while((spm = (struct SPROFMSG *)GetMsg(reply_port)) == NULL) - WaitPort(reply_port), - - FreeMem(spm,sizeof(*spm)); - - num_messages_allocated--; - } - - DeleteMsgPort(reply_port); - reply_port = NULL; - } - - if(time_request != NULL) - { - if(time_request->tr_node.io_Device != NULL) - CloseDevice((struct IORequest *)time_request); - - DeleteIORequest((struct IORequest *)time_request); - time_request = NULL; - } - - if(time_port != NULL) - { - DeleteMsgPort(time_port); - time_port = NULL; - } -} - -/****************************************************************************/ - -PROFILE_CONSTRUCTOR(profile_init) -{ - ENTER(); - - __profile_init(); - - LEAVE(); - - CONSTRUCTOR_SUCCEED(); -} - -/****************************************************************************/ - -PROFILE_DESTRUCTOR(profile_exit) -{ - ENTER(); - - __profile_exit(); - - LEAVE(); -} diff --git a/library/signal_checkabort.c b/library/signal_checkabort.c deleted file mode 100644 index 1acfd6d..0000000 --- a/library/signal_checkabort.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * $Id: signal_checkabort.c,v 1.2 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -#ifndef _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -/****************************************************************************/ - -void -__check_abort(void) -{ - if(__check_abort_enabled && FLAG_IS_SET(SetSignal(0,SIGBREAKF_CTRL_C),SIGBREAKF_CTRL_C)) - raise(SIGINT); -} diff --git a/library/signal_data.c b/library/signal_data.c deleted file mode 100644 index 7cc1c72..0000000 --- a/library/signal_data.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: signal_data.c,v 1.5 2005-03-26 11:01:13 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -/****************************************************************************/ - -BOOL __check_abort_enabled = TRUE; diff --git a/library/signal_headers.h b/library/signal_headers.h deleted file mode 100644 index cf285a2..0000000 --- a/library/signal_headers.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * $Id: signal_headers.h,v 1.7 2005-03-18 12:38:22 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SIGNAL_HEADERS_H -#define _SIGNAL_HEADERS_H - -/****************************************************************************/ - -#ifndef EXEC_LIBRARIES_H -#include -#endif /* EXEC_LIBRARIES_H */ - -#ifndef DOS_DOSEXTENS_H -#include -#endif /* DOS_DOSEXTENS_H */ - -/****************************************************************************/ - -#ifndef PROTO_EXEC_H -#include -#endif /* PROTO_EXEC_H */ - -#ifndef PROTO_DOS_H -#include -#endif /* PROTO_DOS_H */ - -/****************************************************************************/ - -#include -#include -#include -#include -#include - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_H */ - -#ifndef _DEBUG_H -#include "debug.h" -#endif /* _DEBUG_H */ - -/****************************************************************************/ - -#define NUM_SIGNALS (SIGTERM - SIGABRT + 1) - -/****************************************************************************/ - -typedef void (*signal_handler_t)(int sig); - -/****************************************************************************/ - -extern signal_handler_t NOCOMMON __signal_handler_table[NUM_SIGNALS]; - -/****************************************************************************/ - -extern int NOCOMMON __signals_blocked; - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#endif /* _SIGNAL_HEADERS_H */ diff --git a/library/signal_kill.c b/library/signal_kill.c deleted file mode 100644 index 79be99a..0000000 --- a/library/signal_kill.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * $Id: signal_kill.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -kill(pid_t pid, int signal_number) -{ - int result = ERROR; - - ENTER(); - - SHOWVALUE(pid); - SHOWVALUE(signal_number); - - Forbid(); - - if(pid > 0) - { - ULONG max_cli_number,i; - BOOL found = FALSE; - - max_cli_number = MaxCli(); - - for(i = 1 ; i <= max_cli_number ; i++) - { - if(FindCliProc(i) == (struct Process *)pid) - { - found = TRUE; - break; - } - } - - if(NOT found) - { - SHOWMSG("didn't find the process"); - - __set_errno(ESRCH); - goto out; - } - - SHOWMSG("found the process"); - - if(signal_number == SIGTERM || signal_number == SIGINT) - Signal((struct Task *)pid,SIGBREAKF_CTRL_C); - else - SHOWMSG("but won't shut it down"); - } - - result = OK; - - out: - - Permit(); - - RETURN(result); - return(result); -} diff --git a/library/signal_raise.c b/library/signal_raise.c deleted file mode 100644 index e43214f..0000000 --- a/library/signal_raise.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * $Id: signal_raise.c,v 1.9 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -/****************************************************************************/ - -/* This table holds pointers to all signal handlers configured at a time. */ -signal_handler_t NOCOMMON __signal_handler_table[NUM_SIGNALS] = -{ - SIG_DFL, /* SIGABRT */ - SIG_DFL, /* SIGFPE */ - SIG_DFL, /* SIGILL */ - SIG_DFL, /* SIGINT */ - SIG_DFL, /* SIGSEGV */ - SIG_DFL /* SIGTERM */ -}; - -/****************************************************************************/ - -/* This holds a mask of all signals whose delivery is currently blocked. - The sigaddset(), sigblock(), sigprocmask() and sigsetmask() functions - modify or query it. */ -int NOCOMMON __signals_blocked; - -/****************************************************************************/ - -int -raise(int sig) -{ - static int local_signals_blocked; - - int result = ERROR; - - ENTER(); - - SHOWVALUE(sig); - - assert( SIGABRT <= sig && sig <= SIGTERM ); - - /* This has to be a well-known and supported signal. */ - if(sig < SIGABRT || sig > SIGTERM) - { - SHOWMSG("unknown signal number"); - - __set_errno(EINVAL); - goto out; - } - - /* Can we deliver the signal? */ - if(FLAG_IS_CLEAR(__signals_blocked, (1 << sig)) && - FLAG_IS_CLEAR(local_signals_blocked, (1 << sig))) - { - signal_handler_t handler; - - /* Which handler is installed for this signal? */ - handler = __signal_handler_table[sig - SIGABRT]; - - /* Should we ignore this signal? */ - if(handler != SIG_IGN) - { - /* Block delivery of this signal to prevent recursion. */ - SET_FLAG(local_signals_blocked,(1 << sig)); - - /* The default behaviour is to drop into abort(), or do - something very much like it. */ - if(handler == SIG_DFL) - { - SHOWMSG("this is the default handler"); - - if(sig == SIGINT) - { - char break_string[80]; - - /* Turn off ^C checking for good. */ - __check_abort_enabled = FALSE; - - Fault(ERROR_BREAK,NULL,break_string,(LONG)sizeof(break_string)); - - __print_termination_message(break_string); - - SHOWMSG("bye, bye..."); - } - - /* Drop straight into abort(), which might call signal() - again but is otherwise guaranteed to eventually - land us in _exit(). */ - abort(); - } - else - { - SHOWMSG("calling the handler"); - - (*handler)(sig); - - SHOWMSG("done."); - } - - /* Unblock signal delivery again. */ - CLEAR_FLAG(local_signals_blocked,(1 << sig)); - } - } - else - { - SHOWMSG("that signal is blocked"); - } - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/signal_sigaddset.c b/library/signal_sigaddset.c deleted file mode 100644 index 0a686d5..0000000 --- a/library/signal_sigaddset.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $Id: signal_sigaddset.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -sigaddset(sigset_t * set,int sig) -{ - int result = ERROR; - - ENTER(); - - assert( set != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(set == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - (*set) |= sigmask(sig); - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/signal_sigblock.c b/library/signal_sigblock.c deleted file mode 100644 index f1c4d65..0000000 --- a/library/signal_sigblock.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * $Id: signal_sigblock.c,v 1.3 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -sigblock(int signal_mask) -{ - int result; - - ENTER(); - - SHOWVALUE(signal_mask); - - result = __signals_blocked; - - __signals_blocked |= signal_mask; - - RETURN(result); - return(result); -} diff --git a/library/signal_sigemptyset.c b/library/signal_sigemptyset.c deleted file mode 100644 index b4fe6f8..0000000 --- a/library/signal_sigemptyset.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $Id: signal_sigemptyset.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -sigemptyset(sigset_t * set) -{ - int result = ERROR; - - ENTER(); - - assert( set != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(set == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - (*set) = 0; - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/signal_sigmask.c b/library/signal_sigmask.c deleted file mode 100644 index 4b9df11..0000000 --- a/library/signal_sigmask.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * $Id: signal_sigmask.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -sigmask(int sig) -{ - int result; - - ENTER(); - - SHOWVALUE(sig); - - assert( 0 <= sig && sig <= 31 ); - - if(SIGABRT <= sig && sig <= SIGTERM) - result = (1 << sig); - else - result = 0; - - RETURN(result); - return(result); -} diff --git a/library/signal_signal.c b/library/signal_signal.c deleted file mode 100644 index c1d9649..0000000 --- a/library/signal_signal.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id: signal_signal.c,v 1.3 2005-02-03 16:56:15 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -/****************************************************************************/ - -void (*signal(int sig, void (* handler)(int)))(int) -{ - int table_entry = sig - SIGABRT; - void (*result)(int) = SIG_ERR; - - ENTER(); - - SHOWVALUE(sig); - SHOWPOINTER(handler); - - if(sig < SIGABRT || sig > SIGTERM || handler == SIG_ERR) - { - SHOWMSG("unsupported signal"); - - __set_errno(EINVAL); - goto out; - } - - result = (void (*)(int))__signal_handler_table[table_entry]; - - __signal_handler_table[table_entry] = (signal_handler_t)handler; - - out: - - RETURN(result); - return(result); -} diff --git a/library/signal_sigprocmask.c b/library/signal_sigprocmask.c deleted file mode 100644 index 668fbe9..0000000 --- a/library/signal_sigprocmask.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Id: signal_sigprocmask.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -sigprocmask(int how, const sigset_t *set, sigset_t *oset) -{ - int result = ERROR; - - ENTER(); - - SHOWVALUE(how); - SHOWPOINTER(set); - SHOWPOINTER(oset); - - if(how < SIG_BLOCK || how > SIG_SETMASK) - { - SHOWMSG("invalid operating mode"); - - __set_errno(EINVAL); - goto out; - } - - if(oset != NULL) - (*oset) = __signals_blocked; - - if(set != NULL) - { - SHOWVALUE(*set); - - switch(how) - { - case SIG_BLOCK: - - SHOWMSG("SIG_BLOCK"); - - __signals_blocked |= (*set); - break; - - case SIG_UNBLOCK: - - SHOWMSG("SIG_UNBLOCK"); - - __signals_blocked &= ~(*set); - break; - - case SIG_SETMASK: - - SHOWMSG("SIG_SETMASK"); - - __signals_blocked = (*set); - break; - } - } - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/signal_sigsetmask.c b/library/signal_sigsetmask.c deleted file mode 100644 index 4ba0678..0000000 --- a/library/signal_sigsetmask.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * $Id: signal_sigsetmask.c,v 1.3 2005-01-02 09:07:07 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -sigsetmask(int signal_mask) -{ - int result; - - ENTER(); - - SHOWVALUE(signal_mask); - - result = __signals_blocked; - - __signals_blocked = signal_mask; - - RETURN(result); - return(result); -} diff --git a/library/smakefile b/library/smakefile deleted file mode 100644 index 70ed86d..0000000 --- a/library/smakefile +++ /dev/null @@ -1,948 +0,0 @@ -# -# $Id: smakefile,v 1.48 2005-07-03 10:36:47 obarthel Exp $ -# -# :ts=8 -# - -############################################################################## - -.c.o: - @echo "Compiling $<" - @sc nover $(CFLAGS) $< - -.asm.o: - @echo "Assembling $<" - @asm $(AFLAGS) $< - -############################################################################## - -# You might want to change this to the directory where your operating system -# header files are stored. On my system, that's "V:include", but you might -# get lucky with "sc:include" instead, which is the default for SAS/C. -INCLUDE_DIR = V:include -#INCLUDE_DIR = sc:include - -############################################################################## - - OPTIMIZE = optimize opttime optschedule optinline -#DEBUG = debug=line noopt define=CHECK_FOR_NULL_POINTERS -#DEBUG = debug=line -#DEBUG = debug=line define=NDEBUG - DEBUG = debug=sf noopt define=DEBUG -#DEBUG = debug=sf noopt define=CHECK_FOR_NULL_POINTERS -#PROFILE = profile - DATA = data=faronly -#CODE = code=far - CPU = cpu=060 -MATH = define=IEEE_FLOATING_POINT_SUPPORT math=IEEE -SUPPORT = define=UNIX_PATH_SEMANTICS define=SOCKET_SUPPORT define=USERGROUP_SUPPORT \ - define=__C_MACROS__ define=__THREAD_SAFE - -############################################################################## - -CFLAGS = \ - resopt \ - nover \ - memorysize=huge \ - idir=netinclude \ - idlen=64 \ - commentnest \ - nostackcheck \ - stringmerge \ - errorrexx \ - $(PROFILE) $(OPTIMIZE) $(CODE) $(DATA) $(CPU) $(MATH) \ - $(SUPPORT) $(DEBUG) - -AFLAGS = \ - -d -m2 - -############################################################################## - -AMIGA_OBJ = \ - amiga_acrypt.o \ - amiga_addtof.o \ - amiga_argarraydone.o \ - amiga_argarrayinit.o \ - amiga_argint.o \ - amiga_argstring.o \ - amiga_beginio.o \ - amiga_callhook.o \ - amiga_callhooka.o \ - amiga_coercemethod.o \ - amiga_createextio.o \ - amiga_createport.o \ - amiga_createstdio.o \ - amiga_createtask.o \ - amiga_deleteextio.o \ - amiga_deleteport.o \ - amiga_deletestdio.o \ - amiga_deletetask.o \ - amiga_domethod.o \ - amiga_dosupermethod.o \ - amiga_dotimer.o \ - amiga_fastrand.o \ - amiga_freeievents.o \ - amiga_hookentry.o \ - amiga_hotkey.o \ - amiga_invertstring.o \ - amiga_newlist.o \ - amiga_rangerand.o \ - amiga_remtof.o \ - amiga_rexxvars.o \ - amiga_setsuperattrs.o \ - amiga_timedelay.o \ - amiga_waitbeam.o \ - sas_cxamemcpy.o \ - sas_cxamemset.o \ - sas_cxv.o \ - sas_cxv45.o \ - sas_cxv54.o \ - sas_cxferr.o \ - sas_profile.o - -CTYPE_OBJ = \ - ctype_isalnum.o \ - ctype_isalpha.o \ - ctype_isascii.o \ - ctype_isblank.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 - -DEBUG_OBJ = \ - debug.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 \ - debug_level.o - -DIRENT_OBJ = \ - dirent_closedir.o \ - dirent_opendir.o \ - dirent_readdir.o \ - dirent_rewinddir.o - -ERRNO_OBJ = \ - errno_data.o - -FCNTL_OBJ = \ - fcntl_close.o \ - fcntl_creat.o \ - fcntl_fcntl.o \ - fcntl_lock.o \ - fcntl_lseek.o \ - fcntl_open.o \ - fcntl_read.o \ - fcntl_write.o \ - fcntl_get_default_file.o - -LIBGEN_OBJ = \ - libgen_basename.o \ - libgen_dirname.o - -LOCALE_OBJ = \ - locale_init_exit.o \ - locale_localeconv.o \ - locale_open_locale.o \ - locale_setlocale.o - -MATH_OBJ = \ - math_acos.o \ - math_acosf.o \ - math_acosh.o \ - math_acoshf.o \ - math_asin.o \ - math_asinf.o \ - math_asinh.o \ - math_asinhf.o \ - math_atan.o \ - math_atan2.o \ - math_atan2f.o \ - math_atanf.o \ - math_cbrt.o \ - math_cbrtf.o \ - math_ceil.o \ - math_ceilf.o \ - math_copysign.o \ - math_copysignf.o \ - math_cos.o \ - math_cosf.o \ - math_cosh.o \ - math_coshf.o \ - math_erf.o \ - math_erfc.o \ - math_erfcf.o \ - math_erff.o \ - math_exp.o \ - math_expf.o \ - math_expm1.o \ - math_expm1f.o \ - math_fabs.o \ - math_fabsf.o \ - math_fdim.o \ - math_fdimf.o \ - math_floor.o \ - math_floorf.o \ - math_fmax.o \ - math_fmaxf.o \ - math_fmin.o \ - math_fminf.o \ - math_fmod.o \ - math_fmodf.o \ - math_fpclassify.o \ - math_frexp.o \ - math_frexpf.o \ - math_huge_val.o \ - math_huge_valf.o \ - math_hypot.o \ - math_hypotf.o \ - math_ilogb.o \ - math_ilogbf.o \ - math_inf.o \ - math_inff.o \ - math_init_exit.o \ - math_isfinite.o \ - math_isunordered.o \ - math_kernel_cosf.o \ - math_kernel_sinf.o \ - math_kernel_tanf.o \ - math_ldexp.o \ - math_ldexpf.o \ - math_lgamma.o \ - math_lgammaf.o \ - math_log.o \ - math_log10.o \ - math_log10f.o \ - math_log1p.o \ - math_log1pf.o \ - math_logb.o \ - math_logbf.o \ - math_logf.o \ - math_modf.o \ - math_modff.o \ - math_nan.o \ - math_nanf.o \ - math_nextafter.o \ - math_nextafterf.o \ - math_pow.o \ - math_powf.o \ - math_remainder.o \ - math_remainderf.o \ - math_rem_pio2f.o \ - math_rint.o \ - math_rintf.o \ - math_scalbn.o \ - math_scalbnf.o \ - math_signbit.o \ - math_sin.o \ - math_sinf.o \ - math_sinh.o \ - math_sinhf.o \ - math_sqrt.o \ - math_sqrtf.o \ - math_tan.o \ - math_tanf.o \ - math_tanh.o \ - math_tanhf.o - -MOUNT_OBJ = \ - mount_convertinfo.o \ - mount_fstatfs.o \ - mount_statfs.o - -SIGNAL_OBJ = \ - 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 - -SOCKET_OBJ = \ - socket_accept.o \ - socket_bind.o \ - socket_connect.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 - -STAT_OBJ = \ - stat_chmod.o \ - stat_convertfileinfo.o \ - stat_fchmod.o \ - stat_fstat.o \ - stat_lstat.o \ - stat_mkdir.o \ - stat_rmdir.o \ - stat_stat.o \ - stat_umask.o - -STDIO_OBJ = \ - stdio_asprintf.o \ - stdio_clearerr.o \ - stdio_ctermid.o \ - stdio_dropiobreadbuffer.o \ - stdio_duplicate_fd.o \ - stdio_examine_fh.o \ - stdio_fclose.o \ - stdio_fdhookentry.o \ - stdio_feof.o \ - stdio_ferror.o \ - stdio_fflush.o \ - stdio_fgetc.o \ - stdio_fgetpos.o \ - stdio_fgets.o \ - stdio_filliobreadbuffer.o \ - stdio_findvacantfdentry.o \ - stdio_findvacantiobentry.o \ - stdio_flockfile.o \ - stdio_flush.o \ - stdio_flush_all_files.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_fseeko.o \ - stdio_fsetpos.o \ - stdio_ftell.o \ - stdio_ftello.o \ - stdio_ftrylockfile.o \ - stdio_funlockfile.o \ - stdio_fwrite.o \ - stdio_getc.o \ - stdio_getc_unlocked.o \ - stdio_getchar.o \ - stdio_getchar_unlocked.o \ - stdio_gets.o \ - stdio_get_file_descriptor.o \ - stdio_growfdtable.o \ - stdio_growiobtable.o \ - stdio_grow_file.o \ - stdio_initializefd.o \ - stdio_initializeiob.o \ - stdio_file_init.o \ - stdio_init_exit.o \ - stdio_iobhookentry.o \ - stdio_lock.o \ - stdio_locksemaphorename.o \ - stdio_nostdio.o \ - stdio_openiob.o \ - stdio_parent_of_fh.o \ - stdio_perror.o \ - stdio_popen.o \ - stdio_printf.o \ - stdio_putc.o \ - stdio_putc_unlocked.o \ - stdio_putchar.o \ - stdio_putchar_unlocked.o \ - stdio_puts.o \ - stdio_record_locking.o \ - stdio_remove.o \ - stdio_remove_fd_alias.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_unlockfile.o \ - stdio_vasprintf.o \ - stdio_vasprintf_hook_entry.o \ - stdio_vfprintf.o \ - stdio_vfscanf.o \ - stdio_vsscanf.o \ - stdio_vscanf.o \ - stdio_vprintf.o \ - stdio_vsnprintf.o \ - stdio_vsnprintf_hook_entry.o \ - stdio_vsprintf.o \ - stdio_vsprintf_hook_entry.o - -STDLIB_OBJ = \ - inttypes_imaxdiv.o \ - inttypes_imaxabs.o \ - inttypes_strtoimax.o \ - inttypes_strtoumax.o \ - stdlib_abort.o \ - stdlib_abs.o \ - stdlib_alloca.o \ - stdlib_assertion_failure.o \ - stdlib_atexit.o \ - stdlib_atof.o \ - stdlib_atoi.o \ - stdlib_atol.o \ - stdlib_atoll.o \ - stdlib_bsearch.o \ - stdlib_calloc.o \ - stdlib_checkdetach.o \ - stdlib_constructor_begin.o \ - stdlib_constructor.o \ - stdlib_default_pool_size.o \ - stdlib_default_puddle_size.o \ - stdlib_destructor.o \ - stdlib_detach.o \ - stdlib_dosbase.o \ - stdlib_get_errno.o \ - stdlib_set_errno.o \ - stdlib_semaphore.o \ - stdlib_sysbase.o \ - stdlib_termination_message.o \ - stdlib_threshold.o \ - stdlib_disablerequesters.o \ - stdlib_div.o \ - stdlib_exit.o \ - stdlib_free.o \ - stdlib_getdefstacksize.o \ - stdlib_getenv.o \ - stdlib_getsp.o \ - stdlib_isresident.o \ - stdlib_labs.o \ - stdlib_ldiv.o \ - stdlib_lib_main.o \ - stdlib_lib_startup.o \ - stdlib_main.o \ - stdlib_malloc.o \ - stdlib_machine_test.o \ - stdlib_mkdtemp.o \ - stdlib_mkstemp.o \ - stdlib_mktemp.o \ - stdlib_never_free.o \ - stdlib_osliberror.o \ - stdlib_oslibversion.o \ - stdlib_priority.o \ - stdlib_process_name.o \ - stdlib_program_name.o \ - stdlib_putenv.o \ - stdlib_qsort.o \ - stdlib_rand.o \ - stdlib_rand_r.o \ - stdlib_realloc.o \ - stdlib_red_black.o \ - stdlib_setenv.o \ - stdlib_setjmp.o \ - stdlib_set_process_window.o \ - stdlib_shell_escape.o \ - stdlib_showerror.o \ - stdlib_srand.o \ - stdlib_arg.o \ - stdlib_stack_usage.o \ - stdlib_stacksize.o \ - stdlib_strtod.o \ - stdlib_strtof.o \ - stdlib_strtol.o \ - stdlib_strtoul.o \ - stdlib_strtoll.o \ - stdlib_strtoull.o \ - stdlib_swapstack.o \ - stdlib_system.o \ - stdlib_unsetenv.o \ - stdlib_utilitybase.o \ - stdlib_wildcard_expand.o \ - stdlib_stdio_window_spec.o - -STRING_OBJ = \ - 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_strlcat.o \ - string_strlcpy.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_strtok_r.o \ - string_strxfrm.o - -STRINGS_OBJ = \ - strings_ffs.o \ - strings_strcasecmp.o \ - strings_strncasecmp.o - -TIME_OBJ = \ - time_asctime.o \ - time_asctime_r.o \ - time_clock.o \ - time_converttime.o \ - time_convert_datestamp.o \ - time_convert_time.o \ - time_ctime.o \ - time_ctime_r.o \ - time_data.o \ - time_days_per_date.o \ - time_difftime.o \ - time_gettimeofday.o \ - time_gmtime.o \ - time_gmtime_r.o \ - time_localtime.o \ - time_localtime_r.o \ - time_mktime.o \ - time_numbertostring.o \ - time_strftime.o \ - time_time.o \ - time_weekday.o - -UNISTD_OBJ = \ - ftw_ftw.o \ - ftw_nftw.o \ - termios_cfgetispeed.o \ - termios_cfgetospeed.o \ - termios_cfmakeraw.o \ - termios_cfsetispeed.o \ - termios_cfsetospeed.o \ - termios_console_fdhookentry.o \ - termios_headers.h - termios_openserial.o \ - termios_tcdrain.o \ - termios_tcflow.o \ - termios_tcflush.o \ - termios_tcgetattr.o \ - termios_tcsendbreak.o \ - termios_tcsetattr.o \ - uio_readv.o \ - uio_writev.o \ - unistd_access.o \ - unistd_chdir.o \ - unistd_chdir_exit.o \ - unistd_chown.o \ - unistd_currentpathname.o \ - unistd_dup.o \ - unistd_dup2.o \ - unistd_fchown.o \ - unistd_fdatasync.o \ - unistd_fdopen.o \ - unistd_fileno.o \ - unistd_fsync.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_restorepathname.o \ - unistd_setcurrentpath.o \ - unistd_sleep.o \ - unistd_strip_double_slash.o \ - unistd_symlink.o \ - unistd_sync_fd.o \ - unistd_time_delay.o \ - unistd_timer.o \ - unistd_translatea2u.o \ - unistd_translaterel.o \ - unistd_translateu2a.o \ - unistd_truncate.o \ - unistd_ttyname.o \ - unistd_ttyname_r.o \ - unistd_unix_path_semantics.o \ - unistd_unlink.o \ - unistd_usleep.o \ - utsname_uname.o -# \ -# unistd_wildcard_expand.o - -USERGROUP_OBJ = \ - 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 - -UTIME_OBJ = \ - utime_utime.o - -MEMDEBUG_OBJ = \ - stdio_vasprintf_debug.o \ - stdio_vasprintf_hook_debug.o \ - stdlib_alloca_debug.o \ - stdlib_calloc_debug.o \ - stdlib_free_debug.o \ - stdlib_malloc_debug.o \ - string_strdup_debug.o \ - unistd_getcwd_debug.o - -############################################################################## - -all: setup c.lib startup.o cleanup - -clean: - -delete \#?.o \#?.lib \#?.map - -############################################################################## - -setup: - @echo "Setting up include: assignment" - @assign include: include $(INCLUDE_DIR) - -cleanup: - @echo "Cleaning up include: assignment" - @assign include: sc:include - -############################################################################## - -version: - copy clone c.lib_rev.rev amiga.lib_rev.rev - copy clone c.lib_rev.rev debug.lib_rev.rev - copy clone c.lib_rev.rev m.lib_rev.rev - copy clone c.lib_rev.rev m881.lib_rev.rev - copy clone c.lib_rev.rev net.lib_rev.rev - copy clone c.lib_rev.rev stack.lib_rev.rev - copy clone 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_`type c.lib_rev.rev` - -############################################################################## - -c.lib_rev.o : c.lib_rev.c c.lib_rev.h - -amiga_hookentry.o : amiga_hookentry.asm - -amiga_callhooka.o : amiga_callhooka.asm - -stdlib_getsp.o : stdlib_getsp.asm - -stdlib_setjmp.o : stdlib_setjmp.asm - -stdlib_swapstack.o : stdlib_swapstack.asm - -stdio_fdhookentry.o : stdio_fdhookentry.c stdlib_memory.h - -stdio_openiob.o : stdio_openiob.c stdlib_memory.h - -stdlib_alloca.o : stdlib_alloca.c stdlib_memory.h - -stdlib_calloc.o : stdlib_calloc.c stdlib_memory.h - -stdlib_free.o : stdlib_free.c stdlib_memory.h - -stdlib_malloc.o : stdlib_malloc.c stdlib_memory.h - -stdlib_realloc.o : stdlib_realloc.c stdlib_memory.h - -stdlib_red_black.o : stdlib_red_black.c stdlib_memory.h - -dirent_closedir.o : dirent_closedir.c stdlib_memory.h - -dirent_opendir.o : dirent_opendir.c stdlib_memory.h - -fcntl_open.o : fcntl_open.c stdlib_memory.h - -socket_select.o : socket_select.c stdlib_memory.h - -stdio_fclose.o : stdio_fclose.c stdlib_memory.h - -stdio_growfdtable.o : stdio_growfdtable.c stdlib_memory.h - -stdio_growiobtable.o : stdio_growiobtable.c stdlib_memory.h - -stdio_init_exit.o : stdio_init_exit.c stdlib_memory.h - -stdio_popen.o : stdio_popen.c stdlib_memory.h - -stdio_setvbuf.o : stdio_setvbuf.c stdlib_memory.h - -stdio_tmpfile.o : stdio_tmpfile.c stdlib_memory.h - -stdlib_atexit.o : stdlib_atexit.c stdlib_memory.h - -stdlib_setenv.o : stdlib_setenv.c stdlib_memory.h - -stdlib_arg.o : stdlib_arg.c stdlib_memory.h - -stdlib_system.o : stdlib_system.c stdlib_memory.h - -stdlib_unsetenv.o : stdlib_unsetenv.c stdlib_memory.h - -unistd_getcwd.o : unistd_getcwd.c stdlib_memory.h - -unistd_unlink.o : unistd_unlink.c stdlib_memory.h - -unistd_wildcard_expand.o : unistd_wildcard_expand.c stdlib_memory.h - -stdlib_main.o : stdlib_main.c - @echo "Compiling $<" - @sc $(CFLAGS) noprofile stdlib_main.c - -sas_profile.o : sas_profile.c - @echo "Compiling $<" - @sc $(CFLAGS) noprofile sas_profile.c - -stdio_vasprintf_hook_debug.o : stdio_vasprintf_hook_entry.c - @echo "Compiling $<" - @sc $(CFLAGS) define=__USE_MEM_TREES define=__MEM_DEBUG objname=stdio_vasprintf_hook_debug.o stdio_vasprintf_hook_entry.c - -stdio_vasprintf_debug.o : stdio_vasprintf.c - @echo "Compiling $<" - @sc $(CFLAGS) define=__USE_MEM_TREES define=__MEM_DEBUG objname=stdio_vasprintf_debug.o stdio_vasprintf.c - -stdlib_alloca_debug.o : stdlib_alloca.c - @echo "Compiling $<" - @sc $(CFLAGS) define=__USE_MEM_TREES define=__MEM_DEBUG objname=stdlib_alloca_debug.o stdlib_alloca.c - -stdlib_calloc_debug.o : stdlib_calloc.c - @echo "Compiling $<" - @sc $(CFLAGS) define=__USE_MEM_TREES define=__MEM_DEBUG objname=stdlib_calloc_debug.o stdlib_calloc.c - -stdlib_free_debug.o : stdlib_free.c - @echo "Compiling $<" - @sc $(CFLAGS) define=__USE_MEM_TREES define=__MEM_DEBUG objname=stdlib_free_debug.o stdlib_free.c - -stdlib_malloc_debug.o : stdlib_malloc.c - @echo "Compiling $<" - @sc $(CFLAGS) define=__USE_MEM_TREES define=__MEM_DEBUG objname=stdlib_malloc_debug.o stdlib_malloc.c - -string_strdup_debug.o : string_strdup.c - @echo "Compiling $<" - @sc $(CFLAGS) define=__USE_MEM_TREES define=__MEM_DEBUG objname=string_strdup_debug.o string_strdup.c - -unistd_getcwd_debug.o : unistd_getcwd.c - @echo "Compiling $<" - @sc $(CFLAGS) define=__USE_MEM_TREES define=__MEM_DEBUG objname=unistd_getcwd_debug.o unistd_getcwd.c - -############################################################################## - -ctype.lib : $(CTYPE_OBJ) - @date to $@ - -debug.lib : $(DEBUG_OBJ) - @date to $@ - -dirent.lib : $(DIRENT_OBJ) - @date to $@ - -errno.lib : $(ERRNO_OBJ) - @date to $@ - -fcntl.lib : $(FCNTL_OBJ) - @date to $@ - -libgen.lib : $(LIBGEN_OBJ) - @date to $@ - -locale.lib : $(LOCALE_OBJ) - @date to $@ - -math.lib : $(MATH_OBJ) - @date to $@ - -mount.lib : $(MOUNT_OBJ) - @date to $@ - -signal.lib : $(SIGNAL_OBJ) - @date to $@ - -socket.lib : $(SOCKET_OBJ) - @date to $@ - -stat.lib : $(STAT_OBJ) - @date to $@ - -stdio.lib : $(STDIO_OBJ) - @date to $@ - -stdlib.lib : $(STDLIB_OBJ) - @date to $@ - -string.lib : $(STRING_OBJ) - @date to $@ - -strings.lib : $(STRINGS_OBJ) - @date to $@ - -time.lib : $(TIME_OBJ) - @date to $@ - -unistd.lib : $(UNISTD_OBJ) - @date to $@ - -usergroup.lib : $(USERGROUP_OBJ) - @date to $@ - -utime.lib : $(UTIME_OBJ) - @date to $@ - -amiga.lib : $(AMIGA_OBJ) - @date to $@ - -############################################################################## - -c.lib: \ - c.lib_rev.o \ - amiga.lib ctype.lib debug.lib dirent.lib errno.lib fcntl.lib libgen.lib \ - locale.lib math.lib mount.lib signal.lib socket.lib stat.lib stdio.lib \ - stdlib.lib string.lib strings.lib time.lib unistd.lib usergroup.lib \ - utime.lib - @-delete >NIL: T:$@ T:$@.cmd - @echo >>T:$@.cmd c.lib_rev.o - @echo >>T:$@.cmd $(AMIGA_OBJ) - @echo >>T:$@.cmd $(CTYPE_OBJ) - @echo >>T:$@.cmd $(DEBUG_OBJ) - @echo >>T:$@.cmd $(DIRENT_OBJ) - @echo >>T:$@.cmd $(ERRNO_OBJ) - @echo >>T:$@.cmd $(FCNTL_OBJ) - @echo >>T:$@.cmd $(LIBGEN_OBJ) - @echo >>T:$@.cmd $(LOCALE_OBJ) - @echo >>T:$@.cmd $(MATH_OBJ) - @echo >>T:$@.cmd $(MOUNT_OBJ) - @echo >>T:$@.cmd $(SIGNAL_OBJ) - @echo >>T:$@.cmd $(SOCKET_OBJ) - @echo >>T:$@.cmd $(STAT_OBJ) - @echo >>T:$@.cmd $(STDIO_OBJ) - @echo >>T:$@.cmd $(STDLIB_OBJ) - @echo >>T:$@.cmd $(STRINGS_OBJ) - @echo >>T:$@.cmd $(STRING_OBJ) - @echo >>T:$@.cmd $(TIME_OBJ) - @echo >>T:$@.cmd $(UNISTD_OBJ) - @echo >>T:$@.cmd $(USERGROUP_OBJ) - @echo >>T:$@.cmd $(UTIME_OBJ) - oml T:$@ - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -accept(int sockfd,struct sockaddr *cliaddr,socklen_t *addrlen) -{ - struct SignalSemaphore * lock = NULL; - struct fd * fd = NULL; - struct fd * new_fd; - int new_fd_slot_number; - int result = ERROR; - LONG new_socket_fd; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWPOINTER(cliaddr); - SHOWPOINTER(addrlen); - - assert( cliaddr != NULL && addrlen != NULL ); - assert(__SocketBase != NULL); - - __stdio_lock(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(cliaddr == NULL || addrlen == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - __fd_lock(fd); - - new_fd_slot_number = __find_vacant_fd_entry(); - if(new_fd_slot_number < 0) - { - if(__grow_fd_table(0) < 0) - { - SHOWMSG("couldn't find a vacant fd slot and no memory to create one"); - goto out; - } - - new_fd_slot_number = __find_vacant_fd_entry(); - assert( new_fd_slot_number >= 0 ); - } - - #if defined(__THREAD_SAFE) - { - lock = __create_semaphore(); - if(lock == NULL) - { - __set_errno(ENOMEM); - goto out; - } - } - #endif /* __THREAD_SAFE */ - - PROFILE_OFF(); - new_socket_fd = __accept((LONG)fd->fd_DefaultFile,cliaddr,(LONG *)addrlen); - PROFILE_ON(); - - if(new_socket_fd < 0) - { - SHOWMSG("could not accept connection"); - goto out; - } - - new_fd = __fd[new_fd_slot_number]; - - __initialize_fd(new_fd,__socket_hook_entry,(BPTR)new_socket_fd,FDF_IN_USE | FDF_IS_SOCKET | FDF_READ | FDF_WRITE,lock); - - lock = NULL; - - result = new_fd_slot_number; - - out: - - __fd_unlock(fd); - - __stdio_unlock(); - - #if defined(__THREAD_SAFE) - { - __delete_semaphore(lock); - } - #endif /* __THREAD_SAFE */ - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_bind.c b/library/socket_bind.c deleted file mode 100644 index ae85c6a..0000000 --- a/library/socket_bind.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Id: socket_bind.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -bind(int sockfd,struct sockaddr *name,int namelen) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWPOINTER(name); - SHOWVALUE(namelen); - - assert( name != NULL ); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name == NULL) - { - SHOWMSG("invalid name parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - PROFILE_OFF(); - result = __bind((LONG)fd->fd_DefaultFile,name,namelen); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_connect.c b/library/socket_connect.c deleted file mode 100644 index 421cdd2..0000000 --- a/library/socket_connect.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Id: socket_connect.c,v 1.6 2005-06-20 07:43:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -connect(int sockfd,struct sockaddr *name,socklen_t namelen) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWPOINTER(name); - SHOWVALUE(namelen); - - assert( name != NULL ); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name == NULL) - { - SHOWMSG("invalid name parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - PROFILE_OFF(); - result = __connect((LONG)fd->fd_DefaultFile,name,namelen); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_get_descriptor.c b/library/socket_get_descriptor.c deleted file mode 100644 index c290e96..0000000 --- a/library/socket_get_descriptor.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: socket_get_descriptor.c,v 1.4 2005-02-18 18:53:16 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -struct fd * -__get_file_descriptor_socket(int socket_descriptor) -{ - struct fd * result = NULL; - struct fd * fd; - - fd = __get_file_descriptor(socket_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_IS_SOCKET)) - { - __set_errno(ENOTSOCK); - goto out; - } - - result = fd; - - out: - - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_gethostbyaddr.c b/library/socket_gethostbyaddr.c deleted file mode 100644 index 9ae9f41..0000000 --- a/library/socket_gethostbyaddr.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * $Id: socket_gethostbyaddr.c,v 1.4 2005-06-20 07:43:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -struct hostent * -gethostbyaddr(const char *addr, socklen_t len, int type) -{ - struct hostent *result = NULL; - - ENTER(); - - SHOWPOINTER(addr); - SHOWVALUE(len); - SHOWVALUE(type); - - assert(addr != NULL); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(addr == NULL) - { - SHOWMSG("invalid addr parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - result = __gethostbyaddr((STRPTR)addr,len,type); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_gethostbyname.c b/library/socket_gethostbyname.c deleted file mode 100644 index bfda3d5..0000000 --- a/library/socket_gethostbyname.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * $Id: socket_gethostbyname.c,v 1.3 2005-02-03 16:56:15 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -struct hostent * -gethostbyname(const char *name) -{ - struct hostent *result = NULL; - - ENTER(); - - SHOWSTRING(name); - - assert(name != NULL); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name == NULL) - { - SHOWMSG("invalid name parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - result = __gethostbyname((STRPTR)name); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_gethostid.c b/library/socket_gethostid.c deleted file mode 100644 index 63d988a..0000000 --- a/library/socket_gethostid.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id: socket_gethostid.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -long -gethostid(void) -{ - long result; - - ENTER(); - - assert(__SocketBase != NULL); - - PROFILE_OFF(); - result = __gethostid(); - PROFILE_ON(); - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_gethostname.c b/library/socket_gethostname.c deleted file mode 100644 index afc064f..0000000 --- a/library/socket_gethostname.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * $Id: socket_gethostname.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -gethostname(const char *hostname,int size) -{ - int result = ERROR; - - ENTER(); - - SHOWPOINTER(hostname); - SHOWVALUE(size); - - assert(hostname != NULL); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(hostname == NULL) - { - SHOWMSG("invalid host name parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - result = __gethostname((STRPTR)hostname,size); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_getnetbyaddr.c b/library/socket_getnetbyaddr.c deleted file mode 100644 index 1fb06eb..0000000 --- a/library/socket_getnetbyaddr.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * $Id: socket_getnetbyaddr.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -struct netent * -getnetbyaddr(long net,int type) -{ - struct netent *result = NULL; - - ENTER(); - - assert(__SocketBase != NULL); - - PROFILE_OFF(); - result = __getnetbyaddr((ULONG)net,type); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_getnetbyname.c b/library/socket_getnetbyname.c deleted file mode 100644 index 9a90e89..0000000 --- a/library/socket_getnetbyname.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * $Id: socket_getnetbyname.c,v 1.3 2005-02-03 16:56:15 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -struct netent * -getnetbyname(const char *name) -{ - struct netent *result = NULL; - - ENTER(); - - SHOWSTRING(name); - - assert(name != NULL); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name == NULL) - { - SHOWMSG("invalid name parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - result = __getnetbyname((STRPTR)name); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_getpeername.c b/library/socket_getpeername.c deleted file mode 100644 index 1f6b4f5..0000000 --- a/library/socket_getpeername.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Id: socket_getpeername.c,v 1.6 2005-06-20 07:43:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -getpeername(int sockfd,struct sockaddr *name,socklen_t *namelen) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWPOINTER(name); - SHOWPOINTER(namelen); - - assert( name != NULL && namelen != NULL ); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name == NULL || namelen == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - PROFILE_OFF(); - result = __getpeername((LONG)fd->fd_DefaultFile,name,(LONG *)namelen); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_getprotobyname.c b/library/socket_getprotobyname.c deleted file mode 100644 index 2452ad8..0000000 --- a/library/socket_getprotobyname.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * $Id: socket_getprotobyname.c,v 1.3 2005-02-03 16:56:15 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -struct protoent * -getprotobyname(const char *name) -{ - struct protoent *result = NULL; - - ENTER(); - - assert(name != NULL); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - result = __getprotobyname((char *)name); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_getprotobynumber.c b/library/socket_getprotobynumber.c deleted file mode 100644 index 06cb7bc..0000000 --- a/library/socket_getprotobynumber.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id: socket_getprotobynumber.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -struct protoent * -getprotobynumber(int proto) -{ - struct protoent *result; - - ENTER(); - - assert(__SocketBase != NULL); - - PROFILE_OFF(); - result = __getprotobynumber(proto); - PROFILE_ON(); - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_getservbyname.c b/library/socket_getservbyname.c deleted file mode 100644 index 5710d24..0000000 --- a/library/socket_getservbyname.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * $Id: socket_getservbyname.c,v 1.3 2005-02-03 16:56:15 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -struct servent * -getservbyname(const char *name, const char *proto) -{ - struct servent * result = NULL; - - ENTER(); - - assert(name != NULL && proto != NULL); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name == NULL || proto == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - result = __getservbyname((char *)name,(char *)proto); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_getservbyport.c b/library/socket_getservbyport.c deleted file mode 100644 index 1dc9966..0000000 --- a/library/socket_getservbyport.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * $Id: socket_getservbyport.c,v 1.3 2005-02-03 16:56:15 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -struct servent * -getservbyport(int port, const char *proto) -{ - struct servent * result = NULL; - - ENTER(); - - assert(proto != NULL); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(proto == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - result = __getservbyport(port,(char *)proto); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_getsockname.c b/library/socket_getsockname.c deleted file mode 100644 index 7fc22b1..0000000 --- a/library/socket_getsockname.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Id: socket_getsockname.c,v 1.6 2005-06-20 07:43:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -getsockname(int sockfd,struct sockaddr *name,socklen_t *namelen) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWPOINTER(name); - SHOWPOINTER(namelen); - - assert( name != NULL && namelen != NULL ); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name == NULL || namelen == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - PROFILE_OFF(); - result = __getsockname((LONG)fd->fd_DefaultFile,name,(LONG *)namelen); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_getsockopt.c b/library/socket_getsockopt.c deleted file mode 100644 index 202553e..0000000 --- a/library/socket_getsockopt.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * $Id: socket_getsockopt.c,v 1.6 2005-06-20 07:43:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -getsockopt(int sockfd,int level,int optname,void *optval,socklen_t *optlen) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWVALUE(level); - SHOWVALUE(optname); - SHOWPOINTER(optval); - SHOWPOINTER(optlen); - - assert( optval != NULL && optlen != NULL ); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(optval == NULL || optlen == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - PROFILE_OFF(); - result = __getsockopt((LONG)fd->fd_DefaultFile,level,optname,optval,(LONG *)optlen); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_headers.h b/library/socket_headers.h deleted file mode 100644 index d5a7028..0000000 --- a/library/socket_headers.h +++ /dev/null @@ -1,1081 +0,0 @@ -/* - * $Id: socket_headers.h,v 1.8 2005-03-18 12:38:23 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _SOCKET_HEADERS_H -#define _SOCKET_HEADERS_H - -/****************************************************************************/ - -#ifndef _NETINET_IN_H -#include -#endif /* _NETINET_IN_H */ - -/****************************************************************************/ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_H */ - -/****************************************************************************/ - -extern struct Library * NOCOMMON __SocketBase; - -/****************************************************************************/ - -#if defined(__amigaos4__) - -extern struct SocketIFace * NOCOMMON __ISocket; - -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -extern int NOCOMMON h_errno; - -/****************************************************************************/ - -extern struct fd * __get_file_descriptor_socket(int socket_descriptor); -extern int __socket_hook_entry(struct fd * fd,struct file_action_message * fam); - -/****************************************************************************/ - -#if defined(__GNUC__) - -#if defined(__amigaos4__) - -#include - -#define __socket(domain, type, protocol) __ISocket->socket(domain , type , protocol) -#define __bind(sock, name, namelen) __ISocket->bind(sock , name , namelen) -#define __listen(sock, backlog) __ISocket->listen(sock , backlog) -#define __accept(sock, addr, addrlen) __ISocket->accept(sock , addr , addrlen) -#define __connect(sock, name, namelen) __ISocket->connect(sock , name , namelen) -#define __sendto(sock, buf, len, flags, to, tolen) __ISocket->sendto(sock , buf , len , flags , to , tolen) -#define __send(sock, buf, len, flags) __ISocket->send(sock , buf , len , flags) -#define __recvfrom(sock, buf, len, flags, addr, addrlen) __ISocket->recvfrom(sock , buf , len , flags , addr , addrlen) -#define __recv(sock, buf, len, flags) __ISocket->recv(sock , buf , len , flags) -#define __shutdown(sock, how) __ISocket->shutdown(sock , how) -#define __setsockopt(sock, level, optname, optval, optlen) __ISocket->setsockopt(sock , level , optname , optval , optlen) -#define __getsockopt(sock, level, optname, optval, optlen) __ISocket->getsockopt(sock , level , optname , optval , optlen) -#define __getsockname(sock, name, namelen) __ISocket->getsockname(sock , name , namelen) -#define __getpeername(sock, name, namelen) __ISocket->getpeername(sock , name , namelen) -#define __IoctlSocket(sock, req, argp) __ISocket->IoctlSocket(sock , req , argp) -#define __CloseSocket(sock) __ISocket->CloseSocket(sock) -#define __WaitSelect(nfds, read_fds, write_fds, except_fds, timeout, signals) __ISocket->WaitSelect(nfds , read_fds , write_fds , except_fds , timeout , signals) -#define __SetSocketSignals(int_mask, io_mask, urgent_mask) __ISocket->SetSocketSignals(int_mask , io_mask , urgent_mask) -#define __getdtablesize() __ISocket->getdtablesize() -#define __ObtainSocket(id, domain, type, protocol) __ISocket->ObtainSocket(id , domain , type , protocol) -#define __ReleaseSocket(sock, id) __ISocket->ReleaseSocket(sock , id) -#define __ReleaseCopyOfSocket(sock, id) __ISocket->ReleaseCopyOfSocket(sock , id) -#define __Errno() __ISocket->Errno() -#define __SetErrnoPtr(errno_ptr, size) __ISocket->SetErrnoPtr(errno_ptr , size) -#define __Inet_NtoA(ip) __ISocket->Inet_NtoA(ip) -#define __Inet_AtoN(cp, ip) __ISocket->inet_aton(cp, ip) -#define __inet_addr(cp) __ISocket->inet_addr(cp) -#define __Inet_LnaOf(in) __ISocket->Inet_LnaOf(in) -#define __Inet_NetOf(in) __ISocket->Inet_NetOf(in) -#define __Inet_MakeAddr(net, host) __ISocket->Inet_MakeAddr(net , host) -#define __inet_network(cp) __ISocket->inet_network(cp) -#define __gethostbyname(name) __ISocket->gethostbyname(name) -#define __gethostbyaddr(addr, len, type) __ISocket->gethostbyaddr(addr , len , type) -#define __getnetbyname(name) __ISocket->getnetbyname(name) -#define __getnetbyaddr(net, type) __ISocket->getnetbyaddr(net , type) -#define __getservbyname(name, proto) __ISocket->getservbyname(name , proto) -#define __getservbyport(port, proto) __ISocket->getservbyport(port , proto) -#define __getprotobyname(name) __ISocket->getprotobyname(name) -#define __getprotobynumber(proto) __ISocket->getprotobynumber(proto) -#define __vsyslog(pri, msg, args) __ISocket->vsyslog(pri , msg , args) -#define __syslog(pri, msg, tag1...) __ISocket->syslog(pri , msg , ## tag1) -#define __Dup2Socket(old_socket, new_socket) __ISocket->Dup2Socket(old_socket , new_socket) -#define __sendmsg(sock, msg, flags) __ISocket->sendmsg(sock , msg , flags) -#define __recvmsg(sock, msg, flags) __ISocket->recvmsg(sock , msg , flags) -#define __gethostname(name, namelen) __ISocket->gethostname(name , namelen) -#define __gethostid() __ISocket->gethostid() -#define __SocketBaseTagList(tags) __ISocket->SocketBaseTagList(tags) -#define __SocketBaseTags(tag1...) __ISocket->SocketBaseTags(## tag1) - -#else - -#define __socket(domain, type, protocol) ({ \ - LONG _socket_domain = (domain); \ - LONG _socket_type = (type); \ - LONG _socket_protocol = (protocol); \ - LONG _socket__re = \ - ({ \ - register struct Library * const __socket__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __socket__re __asm("d0"); \ - register LONG __socket_domain __asm("d0") = (_socket_domain); \ - register LONG __socket_type __asm("d1") = (_socket_type); \ - register LONG __socket_protocol __asm("d2") = (_socket_protocol); \ - __asm volatile ("jsr a6@(-30:W)" \ - : "=r"(__socket__re) \ - : "r"(__socket__bn), "r"(__socket_domain), "r"(__socket_type), "r"(__socket_protocol) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __socket__re; \ - }); \ - _socket__re; \ -}) - -#define __bind(sock, name, namelen) ({ \ - LONG _bind_sock = (sock); \ - struct sockaddr * _bind_name = (name); \ - LONG _bind_namelen = (namelen); \ - LONG _bind__re = \ - ({ \ - register struct Library * const __bind__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __bind__re __asm("d0"); \ - register LONG __bind_sock __asm("d0") = (_bind_sock); \ - register struct sockaddr * __bind_name __asm("a0") = (_bind_name); \ - register LONG __bind_namelen __asm("d1") = (_bind_namelen); \ - __asm volatile ("jsr a6@(-36:W)" \ - : "=r"(__bind__re) \ - : "r"(__bind__bn), "r"(__bind_sock), "r"(__bind_name), "r"(__bind_namelen) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __bind__re; \ - }); \ - _bind__re; \ -}) - -#define __listen(sock, backlog) ({ \ - LONG _listen_sock = (sock); \ - LONG _listen_backlog = (backlog); \ - LONG _listen__re = \ - ({ \ - register struct Library * const __listen__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __listen__re __asm("d0"); \ - register LONG __listen_sock __asm("d0") = (_listen_sock); \ - register LONG __listen_backlog __asm("d1") = (_listen_backlog); \ - __asm volatile ("jsr a6@(-42:W)" \ - : "=r"(__listen__re) \ - : "r"(__listen__bn), "r"(__listen_sock), "r"(__listen_backlog) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __listen__re; \ - }); \ - _listen__re; \ -}) - -#define __accept(sock, addr, addrlen) ({ \ - LONG _accept_sock = (sock); \ - struct sockaddr * _accept_addr = (addr); \ - LONG * _accept_addrlen = (addrlen); \ - LONG _accept__re = \ - ({ \ - register struct Library * const __accept__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __accept__re __asm("d0"); \ - register LONG __accept_sock __asm("d0") = (_accept_sock); \ - register struct sockaddr * __accept_addr __asm("a0") = (_accept_addr); \ - register LONG * __accept_addrlen __asm("a1") = (_accept_addrlen); \ - __asm volatile ("jsr a6@(-48:W)" \ - : "=r"(__accept__re) \ - : "r"(__accept__bn), "r"(__accept_sock), "r"(__accept_addr), "r"(__accept_addrlen) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __accept__re; \ - }); \ - _accept__re; \ -}) - -#define __connect(sock, name, namelen) ({ \ - LONG _connect_sock = (sock); \ - struct sockaddr * _connect_name = (name); \ - LONG _connect_namelen = (namelen); \ - LONG _connect__re = \ - ({ \ - register struct Library * const __connect__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __connect__re __asm("d0"); \ - register LONG __connect_sock __asm("d0") = (_connect_sock); \ - register struct sockaddr * __connect_name __asm("a0") = (_connect_name); \ - register LONG __connect_namelen __asm("d1") = (_connect_namelen); \ - __asm volatile ("jsr a6@(-54:W)" \ - : "=r"(__connect__re) \ - : "r"(__connect__bn), "r"(__connect_sock), "r"(__connect_name), "r"(__connect_namelen) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __connect__re; \ - }); \ - _connect__re; \ -}) - -#define __sendto(sock, buf, len, flags, to, tolen) ({ \ - LONG _sendto_sock = (sock); \ - APTR _sendto_buf = (buf); \ - LONG _sendto_len = (len); \ - LONG _sendto_flags = (flags); \ - struct sockaddr * _sendto_to = (to); \ - LONG _sendto_tolen = (tolen); \ - LONG _sendto__re = \ - ({ \ - register struct Library * const __sendto__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __sendto__re __asm("d0"); \ - register LONG __sendto_sock __asm("d0") = (_sendto_sock); \ - register APTR __sendto_buf __asm("a0") = (_sendto_buf); \ - register LONG __sendto_len __asm("d1") = (_sendto_len); \ - register LONG __sendto_flags __asm("d2") = (_sendto_flags); \ - register struct sockaddr * __sendto_to __asm("a1") = (_sendto_to); \ - register LONG __sendto_tolen __asm("d3") = (_sendto_tolen); \ - __asm volatile ("jsr a6@(-60:W)" \ - : "=r"(__sendto__re) \ - : "r"(__sendto__bn), "r"(__sendto_sock), "r"(__sendto_buf), "r"(__sendto_len), "r"(__sendto_flags), "r"(__sendto_to), "r"(__sendto_tolen) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __sendto__re; \ - }); \ - _sendto__re; \ -}) - -#define __send(sock, buf, len, flags) ({ \ - LONG _send_sock = (sock); \ - APTR _send_buf = (buf); \ - LONG _send_len = (len); \ - LONG _send_flags = (flags); \ - LONG _send__re = \ - ({ \ - register struct Library * const __send__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __send__re __asm("d0"); \ - register LONG __send_sock __asm("d0") = (_send_sock); \ - register APTR __send_buf __asm("a0") = (_send_buf); \ - register LONG __send_len __asm("d1") = (_send_len); \ - register LONG __send_flags __asm("d2") = (_send_flags); \ - __asm volatile ("jsr a6@(-66:W)" \ - : "=r"(__send__re) \ - : "r"(__send__bn), "r"(__send_sock), "r"(__send_buf), "r"(__send_len), "r"(__send_flags) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __send__re; \ - }); \ - _send__re; \ -}) - -#define __recvfrom(sock, buf, len, flags, addr, addrlen) ({ \ - LONG _recvfrom_sock = (sock); \ - APTR _recvfrom_buf = (buf); \ - LONG _recvfrom_len = (len); \ - LONG _recvfrom_flags = (flags); \ - struct sockaddr * _recvfrom_addr = (addr); \ - LONG * _recvfrom_addrlen = (addrlen); \ - LONG _recvfrom__re = \ - ({ \ - register struct Library * const __recvfrom__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __recvfrom__re __asm("d0"); \ - register LONG __recvfrom_sock __asm("d0") = (_recvfrom_sock); \ - register APTR __recvfrom_buf __asm("a0") = (_recvfrom_buf); \ - register LONG __recvfrom_len __asm("d1") = (_recvfrom_len); \ - register LONG __recvfrom_flags __asm("d2") = (_recvfrom_flags); \ - register struct sockaddr * __recvfrom_addr __asm("a1") = (_recvfrom_addr); \ - register LONG * __recvfrom_addrlen __asm("a2") = (_recvfrom_addrlen); \ - __asm volatile ("jsr a6@(-72:W)" \ - : "=r"(__recvfrom__re) \ - : "r"(__recvfrom__bn), "r"(__recvfrom_sock), "r"(__recvfrom_buf), "r"(__recvfrom_len), "r"(__recvfrom_flags), "r"(__recvfrom_addr), "r"(__recvfrom_addrlen) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __recvfrom__re; \ - }); \ - _recvfrom__re; \ -}) - -#define __recv(sock, buf, len, flags) ({ \ - LONG _recv_sock = (sock); \ - APTR _recv_buf = (buf); \ - LONG _recv_len = (len); \ - LONG _recv_flags = (flags); \ - LONG _recv__re = \ - ({ \ - register struct Library * const __recv__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __recv__re __asm("d0"); \ - register LONG __recv_sock __asm("d0") = (_recv_sock); \ - register APTR __recv_buf __asm("a0") = (_recv_buf); \ - register LONG __recv_len __asm("d1") = (_recv_len); \ - register LONG __recv_flags __asm("d2") = (_recv_flags); \ - __asm volatile ("jsr a6@(-78:W)" \ - : "=r"(__recv__re) \ - : "r"(__recv__bn), "r"(__recv_sock), "r"(__recv_buf), "r"(__recv_len), "r"(__recv_flags) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __recv__re; \ - }); \ - _recv__re; \ -}) - -#define __shutdown(sock, how) ({ \ - LONG _shutdown_sock = (sock); \ - LONG _shutdown_how = (how); \ - LONG _shutdown__re = \ - ({ \ - register struct Library * const __shutdown__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __shutdown__re __asm("d0"); \ - register LONG __shutdown_sock __asm("d0") = (_shutdown_sock); \ - register LONG __shutdown_how __asm("d1") = (_shutdown_how); \ - __asm volatile ("jsr a6@(-84:W)" \ - : "=r"(__shutdown__re) \ - : "r"(__shutdown__bn), "r"(__shutdown_sock), "r"(__shutdown_how) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __shutdown__re; \ - }); \ - _shutdown__re; \ -}) - -#define __setsockopt(sock, level, optname, optval, optlen) ({ \ - LONG _setsockopt_sock = (sock); \ - LONG _setsockopt_level = (level); \ - LONG _setsockopt_optname = (optname); \ - APTR _setsockopt_optval = (optval); \ - LONG _setsockopt_optlen = (optlen); \ - LONG _setsockopt__re = \ - ({ \ - register struct Library * const __setsockopt__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __setsockopt__re __asm("d0"); \ - register LONG __setsockopt_sock __asm("d0") = (_setsockopt_sock); \ - register LONG __setsockopt_level __asm("d1") = (_setsockopt_level); \ - register LONG __setsockopt_optname __asm("d2") = (_setsockopt_optname); \ - register APTR __setsockopt_optval __asm("a0") = (_setsockopt_optval); \ - register LONG __setsockopt_optlen __asm("d3") = (_setsockopt_optlen); \ - __asm volatile ("jsr a6@(-90:W)" \ - : "=r"(__setsockopt__re) \ - : "r"(__setsockopt__bn), "r"(__setsockopt_sock), "r"(__setsockopt_level), "r"(__setsockopt_optname), "r"(__setsockopt_optval), "r"(__setsockopt_optlen) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __setsockopt__re; \ - }); \ - _setsockopt__re; \ -}) - -#define __getsockopt(sock, level, optname, optval, optlen) ({ \ - LONG _getsockopt_sock = (sock); \ - LONG _getsockopt_level = (level); \ - LONG _getsockopt_optname = (optname); \ - APTR _getsockopt_optval = (optval); \ - LONG * _getsockopt_optlen = (optlen); \ - LONG _getsockopt__re = \ - ({ \ - register struct Library * const __getsockopt__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __getsockopt__re __asm("d0"); \ - register LONG __getsockopt_sock __asm("d0") = (_getsockopt_sock); \ - register LONG __getsockopt_level __asm("d1") = (_getsockopt_level); \ - register LONG __getsockopt_optname __asm("d2") = (_getsockopt_optname); \ - register APTR __getsockopt_optval __asm("a0") = (_getsockopt_optval); \ - register LONG * __getsockopt_optlen __asm("a1") = (_getsockopt_optlen); \ - __asm volatile ("jsr a6@(-96:W)" \ - : "=r"(__getsockopt__re) \ - : "r"(__getsockopt__bn), "r"(__getsockopt_sock), "r"(__getsockopt_level), "r"(__getsockopt_optname), "r"(__getsockopt_optval), "r"(__getsockopt_optlen) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getsockopt__re; \ - }); \ - _getsockopt__re; \ -}) - -#define __getsockname(sock, name, namelen) ({ \ - LONG _getsockname_sock = (sock); \ - struct sockaddr * _getsockname_name = (name); \ - LONG * _getsockname_namelen = (namelen); \ - LONG _getsockname__re = \ - ({ \ - register struct Library * const __getsockname__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __getsockname__re __asm("d0"); \ - register LONG __getsockname_sock __asm("d0") = (_getsockname_sock); \ - register struct sockaddr * __getsockname_name __asm("a0") = (_getsockname_name); \ - register LONG * __getsockname_namelen __asm("a1") = (_getsockname_namelen); \ - __asm volatile ("jsr a6@(-102:W)" \ - : "=r"(__getsockname__re) \ - : "r"(__getsockname__bn), "r"(__getsockname_sock), "r"(__getsockname_name), "r"(__getsockname_namelen) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getsockname__re; \ - }); \ - _getsockname__re; \ -}) - -#define __getpeername(sock, name, namelen) ({ \ - LONG _getpeername_sock = (sock); \ - struct sockaddr * _getpeername_name = (name); \ - LONG * _getpeername_namelen = (namelen); \ - LONG _getpeername__re = \ - ({ \ - register struct Library * const __getpeername__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __getpeername__re __asm("d0"); \ - register LONG __getpeername_sock __asm("d0") = (_getpeername_sock); \ - register struct sockaddr * __getpeername_name __asm("a0") = (_getpeername_name); \ - register LONG * __getpeername_namelen __asm("a1") = (_getpeername_namelen); \ - __asm volatile ("jsr a6@(-108:W)" \ - : "=r"(__getpeername__re) \ - : "r"(__getpeername__bn), "r"(__getpeername_sock), "r"(__getpeername_name), "r"(__getpeername_namelen) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getpeername__re; \ - }); \ - _getpeername__re; \ -}) - -#define __IoctlSocket(sock, req, argp) ({ \ - LONG _IoctlSocket_sock = (sock); \ - ULONG _IoctlSocket_req = (req); \ - APTR _IoctlSocket_argp = (argp); \ - LONG _IoctlSocket__re = \ - ({ \ - register struct Library * const __IoctlSocket__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __IoctlSocket__re __asm("d0"); \ - register LONG __IoctlSocket_sock __asm("d0") = (_IoctlSocket_sock); \ - register ULONG __IoctlSocket_req __asm("d1") = (_IoctlSocket_req); \ - register APTR __IoctlSocket_argp __asm("a0") = (_IoctlSocket_argp); \ - __asm volatile ("jsr a6@(-114:W)" \ - : "=r"(__IoctlSocket__re) \ - : "r"(__IoctlSocket__bn), "r"(__IoctlSocket_sock), "r"(__IoctlSocket_req), "r"(__IoctlSocket_argp) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __IoctlSocket__re; \ - }); \ - _IoctlSocket__re; \ -}) - -#define __CloseSocket(sock) ({ \ - LONG _CloseSocket_sock = (sock); \ - LONG _CloseSocket__re = \ - ({ \ - register struct Library * const __CloseSocket__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __CloseSocket__re __asm("d0"); \ - register LONG __CloseSocket_sock __asm("d0") = (_CloseSocket_sock); \ - __asm volatile ("jsr a6@(-120:W)" \ - : "=r"(__CloseSocket__re) \ - : "r"(__CloseSocket__bn), "r"(__CloseSocket_sock) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __CloseSocket__re; \ - }); \ - _CloseSocket__re; \ -}) - -#define __WaitSelect(nfds, read_fds, write_fds, except_fds, timeout, signals) ({ \ - LONG _WaitSelect_nfds = (nfds); \ - APTR _WaitSelect_read_fds = (read_fds); \ - APTR _WaitSelect_write_fds = (write_fds); \ - APTR _WaitSelect_except_fds = (except_fds); \ - struct timeval * _WaitSelect_timeout = (timeout); \ - ULONG * _WaitSelect_signals = (signals); \ - LONG _WaitSelect__re = \ - ({ \ - register struct Library * const __WaitSelect__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __WaitSelect__re __asm("d0"); \ - register LONG __WaitSelect_nfds __asm("d0") = (_WaitSelect_nfds); \ - register APTR __WaitSelect_read_fds __asm("a0") = (_WaitSelect_read_fds); \ - register APTR __WaitSelect_write_fds __asm("a1") = (_WaitSelect_write_fds); \ - register APTR __WaitSelect_except_fds __asm("a2") = (_WaitSelect_except_fds); \ - register struct timeval * __WaitSelect_timeout __asm("a3") = (_WaitSelect_timeout); \ - register ULONG * __WaitSelect_signals __asm("d1") = (_WaitSelect_signals); \ - __asm volatile ("jsr a6@(-126:W)" \ - : "=r"(__WaitSelect__re) \ - : "r"(__WaitSelect__bn), "r"(__WaitSelect_nfds), "r"(__WaitSelect_read_fds), "r"(__WaitSelect_write_fds), "r"(__WaitSelect_except_fds), "r"(__WaitSelect_timeout), "r"(__WaitSelect_signals) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __WaitSelect__re; \ - }); \ - _WaitSelect__re; \ -}) - -#define __SetSocketSignals(int_mask, io_mask, urgent_mask) ({ \ - ULONG _SetSocketSignals_int_mask = (int_mask); \ - ULONG _SetSocketSignals_io_mask = (io_mask); \ - ULONG _SetSocketSignals_urgent_mask = (urgent_mask); \ - { \ - register struct Library * const __SetSocketSignals__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register ULONG __SetSocketSignals_int_mask __asm("d0") = (_SetSocketSignals_int_mask); \ - register ULONG __SetSocketSignals_io_mask __asm("d1") = (_SetSocketSignals_io_mask); \ - register ULONG __SetSocketSignals_urgent_mask __asm("d2") = (_SetSocketSignals_urgent_mask); \ - __asm volatile ("jsr a6@(-132:W)" \ - : \ - : "r"(__SetSocketSignals__bn), "r"(__SetSocketSignals_int_mask), "r"(__SetSocketSignals_io_mask), "r"(__SetSocketSignals_urgent_mask) \ - : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - } \ -}) - -#define __getdtablesize() ({ \ - LONG _getdtablesize__re = \ - ({ \ - register struct Library * const __getdtablesize__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __getdtablesize__re __asm("d0"); \ - __asm volatile ("jsr a6@(-138:W)" \ - : "=r"(__getdtablesize__re) \ - : "r"(__getdtablesize__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getdtablesize__re; \ - }); \ - _getdtablesize__re; \ -}) - -#define __ObtainSocket(id, domain, type, protocol) ({ \ - LONG _ObtainSocket_id = (id); \ - LONG _ObtainSocket_domain = (domain); \ - LONG _ObtainSocket_type = (type); \ - LONG _ObtainSocket_protocol = (protocol); \ - LONG _ObtainSocket__re = \ - ({ \ - register struct Library * const __ObtainSocket__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __ObtainSocket__re __asm("d0"); \ - register LONG __ObtainSocket_id __asm("d0") = (_ObtainSocket_id); \ - register LONG __ObtainSocket_domain __asm("d1") = (_ObtainSocket_domain); \ - register LONG __ObtainSocket_type __asm("d2") = (_ObtainSocket_type); \ - register LONG __ObtainSocket_protocol __asm("d3") = (_ObtainSocket_protocol); \ - __asm volatile ("jsr a6@(-144:W)" \ - : "=r"(__ObtainSocket__re) \ - : "r"(__ObtainSocket__bn), "r"(__ObtainSocket_id), "r"(__ObtainSocket_domain), "r"(__ObtainSocket_type), "r"(__ObtainSocket_protocol) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __ObtainSocket__re; \ - }); \ - _ObtainSocket__re; \ -}) - -#define __ReleaseSocket(sock, id) ({ \ - LONG _ReleaseSocket_sock = (sock); \ - LONG _ReleaseSocket_id = (id); \ - LONG _ReleaseSocket__re = \ - ({ \ - register struct Library * const __ReleaseSocket__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __ReleaseSocket__re __asm("d0"); \ - register LONG __ReleaseSocket_sock __asm("d0") = (_ReleaseSocket_sock); \ - register LONG __ReleaseSocket_id __asm("d1") = (_ReleaseSocket_id); \ - __asm volatile ("jsr a6@(-150:W)" \ - : "=r"(__ReleaseSocket__re) \ - : "r"(__ReleaseSocket__bn), "r"(__ReleaseSocket_sock), "r"(__ReleaseSocket_id) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __ReleaseSocket__re; \ - }); \ - _ReleaseSocket__re; \ -}) - -#define __ReleaseCopyOfSocket(sock, id) ({ \ - LONG _ReleaseCopyOfSocket_sock = (sock); \ - LONG _ReleaseCopyOfSocket_id = (id); \ - LONG _ReleaseCopyOfSocket__re = \ - ({ \ - register struct Library * const __ReleaseCopyOfSocket__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __ReleaseCopyOfSocket__re __asm("d0"); \ - register LONG __ReleaseCopyOfSocket_sock __asm("d0") = (_ReleaseCopyOfSocket_sock); \ - register LONG __ReleaseCopyOfSocket_id __asm("d1") = (_ReleaseCopyOfSocket_id); \ - __asm volatile ("jsr a6@(-156:W)" \ - : "=r"(__ReleaseCopyOfSocket__re) \ - : "r"(__ReleaseCopyOfSocket__bn), "r"(__ReleaseCopyOfSocket_sock), "r"(__ReleaseCopyOfSocket_id) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __ReleaseCopyOfSocket__re; \ - }); \ - _ReleaseCopyOfSocket__re; \ -}) - -#define __Errno() ({ \ - LONG _Errno__re = \ - ({ \ - register struct Library * const __Errno__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __Errno__re __asm("d0"); \ - __asm volatile ("jsr a6@(-162:W)" \ - : "=r"(__Errno__re) \ - : "r"(__Errno__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __Errno__re; \ - }); \ - _Errno__re; \ -}) - -#define __SetErrnoPtr(errno_ptr, size) ({ \ - APTR _SetErrnoPtr_errno_ptr = (errno_ptr); \ - LONG _SetErrnoPtr_size = (size); \ - { \ - register struct Library * const __SetErrnoPtr__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register APTR __SetErrnoPtr_errno_ptr __asm("a0") = (_SetErrnoPtr_errno_ptr); \ - register LONG __SetErrnoPtr_size __asm("d0") = (_SetErrnoPtr_size); \ - __asm volatile ("jsr a6@(-168:W)" \ - : \ - : "r"(__SetErrnoPtr__bn), "r"(__SetErrnoPtr_errno_ptr), "r"(__SetErrnoPtr_size) \ - : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - } \ -}) - -#define __Inet_NtoA(ip) ({ \ - ULONG _Inet_NtoA_ip = (ip); \ - STRPTR _Inet_NtoA__re = \ - ({ \ - register struct Library * const __Inet_NtoA__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register STRPTR __Inet_NtoA__re __asm("d0"); \ - register ULONG __Inet_NtoA_ip __asm("d0") = (_Inet_NtoA_ip); \ - __asm volatile ("jsr a6@(-174:W)" \ - : "=r"(__Inet_NtoA__re) \ - : "r"(__Inet_NtoA__bn), "r"(__Inet_NtoA_ip) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __Inet_NtoA__re; \ - }); \ - _Inet_NtoA__re; \ -}) - -#define __inet_addr(cp) ({ \ - STRPTR _inet_addr_cp = (cp); \ - ULONG _inet_addr__re = \ - ({ \ - register struct Library * const __inet_addr__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register ULONG __inet_addr__re __asm("d0"); \ - register STRPTR __inet_addr_cp __asm("a0") = (_inet_addr_cp); \ - __asm volatile ("jsr a6@(-180:W)" \ - : "=r"(__inet_addr__re) \ - : "r"(__inet_addr__bn), "r"(__inet_addr_cp) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __inet_addr__re; \ - }); \ - _inet_addr__re; \ -}) - -#define __Inet_LnaOf(in) ({ \ - ULONG _Inet_LnaOf_in = (in); \ - ULONG _Inet_LnaOf__re = \ - ({ \ - register struct Library * const __Inet_LnaOf__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register ULONG __Inet_LnaOf__re __asm("d0"); \ - register ULONG __Inet_LnaOf_in __asm("d0") = (_Inet_LnaOf_in); \ - __asm volatile ("jsr a6@(-186:W)" \ - : "=r"(__Inet_LnaOf__re) \ - : "r"(__Inet_LnaOf__bn), "r"(__Inet_LnaOf_in) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __Inet_LnaOf__re; \ - }); \ - _Inet_LnaOf__re; \ -}) - -#define __Inet_NetOf(in) ({ \ - ULONG _Inet_NetOf_in = (in); \ - ULONG _Inet_NetOf__re = \ - ({ \ - register struct Library * const __Inet_NetOf__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register ULONG __Inet_NetOf__re __asm("d0"); \ - register ULONG __Inet_NetOf_in __asm("d0") = (_Inet_NetOf_in); \ - __asm volatile ("jsr a6@(-192:W)" \ - : "=r"(__Inet_NetOf__re) \ - : "r"(__Inet_NetOf__bn), "r"(__Inet_NetOf_in) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __Inet_NetOf__re; \ - }); \ - _Inet_NetOf__re; \ -}) - -#define __Inet_MakeAddr(net, host) ({ \ - ULONG _Inet_MakeAddr_net = (net); \ - ULONG _Inet_MakeAddr_host = (host); \ - ULONG _Inet_MakeAddr__re = \ - ({ \ - register struct Library * const __Inet_MakeAddr__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register ULONG __Inet_MakeAddr__re __asm("d0"); \ - register ULONG __Inet_MakeAddr_net __asm("d0") = (_Inet_MakeAddr_net); \ - register ULONG __Inet_MakeAddr_host __asm("d1") = (_Inet_MakeAddr_host); \ - __asm volatile ("jsr a6@(-198:W)" \ - : "=r"(__Inet_MakeAddr__re) \ - : "r"(__Inet_MakeAddr__bn), "r"(__Inet_MakeAddr_net), "r"(__Inet_MakeAddr_host) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __Inet_MakeAddr__re; \ - }); \ - _Inet_MakeAddr__re; \ -}) - -#define __inet_network(cp) ({ \ - STRPTR _inet_network_cp = (cp); \ - ULONG _inet_network__re = \ - ({ \ - register struct Library * const __inet_network__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register ULONG __inet_network__re __asm("d0"); \ - register STRPTR __inet_network_cp __asm("a0") = (_inet_network_cp); \ - __asm volatile ("jsr a6@(-204:W)" \ - : "=r"(__inet_network__re) \ - : "r"(__inet_network__bn), "r"(__inet_network_cp) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __inet_network__re; \ - }); \ - _inet_network__re; \ -}) - -#define __gethostbyname(name) ({ \ - STRPTR _gethostbyname_name = (name); \ - struct hostent * _gethostbyname__re = \ - ({ \ - register struct Library * const __gethostbyname__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register struct hostent * __gethostbyname__re __asm("d0"); \ - register STRPTR __gethostbyname_name __asm("a0") = (_gethostbyname_name); \ - __asm volatile ("jsr a6@(-210:W)" \ - : "=r"(__gethostbyname__re) \ - : "r"(__gethostbyname__bn), "r"(__gethostbyname_name) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __gethostbyname__re; \ - }); \ - _gethostbyname__re; \ -}) - -#define __gethostbyaddr(addr, len, type) ({ \ - STRPTR _gethostbyaddr_addr = (addr); \ - LONG _gethostbyaddr_len = (len); \ - LONG _gethostbyaddr_type = (type); \ - struct hostent * _gethostbyaddr__re = \ - ({ \ - register struct Library * const __gethostbyaddr__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register struct hostent * __gethostbyaddr__re __asm("d0"); \ - register STRPTR __gethostbyaddr_addr __asm("a0") = (_gethostbyaddr_addr); \ - register LONG __gethostbyaddr_len __asm("d0") = (_gethostbyaddr_len); \ - register LONG __gethostbyaddr_type __asm("d1") = (_gethostbyaddr_type); \ - __asm volatile ("jsr a6@(-216:W)" \ - : "=r"(__gethostbyaddr__re) \ - : "r"(__gethostbyaddr__bn), "r"(__gethostbyaddr_addr), "r"(__gethostbyaddr_len), "r"(__gethostbyaddr_type) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __gethostbyaddr__re; \ - }); \ - _gethostbyaddr__re; \ -}) - -#define __getnetbyname(name) ({ \ - STRPTR _getnetbyname_name = (name); \ - struct netent * _getnetbyname__re = \ - ({ \ - register struct Library * const __getnetbyname__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register struct netent * __getnetbyname__re __asm("d0"); \ - register STRPTR __getnetbyname_name __asm("a0") = (_getnetbyname_name); \ - __asm volatile ("jsr a6@(-222:W)" \ - : "=r"(__getnetbyname__re) \ - : "r"(__getnetbyname__bn), "r"(__getnetbyname_name) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getnetbyname__re; \ - }); \ - _getnetbyname__re; \ -}) - -#define __getnetbyaddr(net, type) ({ \ - ULONG _getnetbyaddr_net = (net); \ - LONG _getnetbyaddr_type = (type); \ - struct netent * _getnetbyaddr__re = \ - ({ \ - register struct Library * const __getnetbyaddr__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register struct netent * __getnetbyaddr__re __asm("d0"); \ - register ULONG __getnetbyaddr_net __asm("d0") = (_getnetbyaddr_net); \ - register LONG __getnetbyaddr_type __asm("d1") = (_getnetbyaddr_type); \ - __asm volatile ("jsr a6@(-228:W)" \ - : "=r"(__getnetbyaddr__re) \ - : "r"(__getnetbyaddr__bn), "r"(__getnetbyaddr_net), "r"(__getnetbyaddr_type) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getnetbyaddr__re; \ - }); \ - _getnetbyaddr__re; \ -}) - -#define __getservbyname(name, proto) ({ \ - STRPTR _getservbyname_name = (name); \ - STRPTR _getservbyname_proto = (proto); \ - struct servent * _getservbyname__re = \ - ({ \ - register struct Library * const __getservbyname__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register struct servent * __getservbyname__re __asm("d0"); \ - register STRPTR __getservbyname_name __asm("a0") = (_getservbyname_name); \ - register STRPTR __getservbyname_proto __asm("a1") = (_getservbyname_proto); \ - __asm volatile ("jsr a6@(-234:W)" \ - : "=r"(__getservbyname__re) \ - : "r"(__getservbyname__bn), "r"(__getservbyname_name), "r"(__getservbyname_proto) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getservbyname__re; \ - }); \ - _getservbyname__re; \ -}) - -#define __getservbyport(port, proto) ({ \ - LONG _getservbyport_port = (port); \ - STRPTR _getservbyport_proto = (proto); \ - struct servent * _getservbyport__re = \ - ({ \ - register struct Library * const __getservbyport__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register struct servent * __getservbyport__re __asm("d0"); \ - register LONG __getservbyport_port __asm("d0") = (_getservbyport_port); \ - register STRPTR __getservbyport_proto __asm("a0") = (_getservbyport_proto); \ - __asm volatile ("jsr a6@(-240:W)" \ - : "=r"(__getservbyport__re) \ - : "r"(__getservbyport__bn), "r"(__getservbyport_port), "r"(__getservbyport_proto) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getservbyport__re; \ - }); \ - _getservbyport__re; \ -}) - -#define __getprotobyname(name) ({ \ - STRPTR _getprotobyname_name = (name); \ - struct protoent * _getprotobyname__re = \ - ({ \ - register struct Library * const __getprotobyname__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register struct protoent * __getprotobyname__re __asm("d0"); \ - register STRPTR __getprotobyname_name __asm("a0") = (_getprotobyname_name); \ - __asm volatile ("jsr a6@(-246:W)" \ - : "=r"(__getprotobyname__re) \ - : "r"(__getprotobyname__bn), "r"(__getprotobyname_name) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getprotobyname__re; \ - }); \ - _getprotobyname__re; \ -}) - -#define __getprotobynumber(proto) ({ \ - LONG _getprotobynumber_proto = (proto); \ - struct protoent * _getprotobynumber__re = \ - ({ \ - register struct Library * const __getprotobynumber__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register struct protoent * __getprotobynumber__re __asm("d0"); \ - register LONG __getprotobynumber_proto __asm("d0") = (_getprotobynumber_proto); \ - __asm volatile ("jsr a6@(-252:W)" \ - : "=r"(__getprotobynumber__re) \ - : "r"(__getprotobynumber__bn), "r"(__getprotobynumber_proto) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getprotobynumber__re; \ - }); \ - _getprotobynumber__re; \ -}) - -#define __vsyslog(pri, msg, args) ({ \ - LONG _vsyslog_pri = (pri); \ - STRPTR _vsyslog_msg = (msg); \ - APTR _vsyslog_args = (args); \ - { \ - register struct Library * const __vsyslog__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __vsyslog_pri __asm("d0") = (_vsyslog_pri); \ - register STRPTR __vsyslog_msg __asm("a0") = (_vsyslog_msg); \ - register APTR __vsyslog_args __asm("a1") = (_vsyslog_args); \ - __asm volatile ("jsr a6@(-258:W)" \ - : \ - : "r"(__vsyslog__bn), "r"(__vsyslog_pri), "r"(__vsyslog_msg), "r"(__vsyslog_args) \ - : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - } \ -}) - -#define __Dup2Socket(old_socket, new_socket) ({ \ - LONG _Dup2Socket_old_socket = (old_socket); \ - LONG _Dup2Socket_new_socket = (new_socket); \ - LONG _Dup2Socket__re = \ - ({ \ - register struct Library * const __Dup2Socket__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __Dup2Socket__re __asm("d0"); \ - register LONG __Dup2Socket_old_socket __asm("d0") = (_Dup2Socket_old_socket); \ - register LONG __Dup2Socket_new_socket __asm("d1") = (_Dup2Socket_new_socket); \ - __asm volatile ("jsr a6@(-264:W)" \ - : "=r"(__Dup2Socket__re) \ - : "r"(__Dup2Socket__bn), "r"(__Dup2Socket_old_socket), "r"(__Dup2Socket_new_socket) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __Dup2Socket__re; \ - }); \ - _Dup2Socket__re; \ -}) - -#define __sendmsg(sock, msg, flags) ({ \ - LONG _sendmsg_sock = (sock); \ - struct msghdr * _sendmsg_msg = (msg); \ - LONG _sendmsg_flags = (flags); \ - LONG _sendmsg__re = \ - ({ \ - register struct Library * const __sendmsg__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __sendmsg__re __asm("d0"); \ - register LONG __sendmsg_sock __asm("d0") = (_sendmsg_sock); \ - register struct msghdr * __sendmsg_msg __asm("a0") = (_sendmsg_msg); \ - register LONG __sendmsg_flags __asm("d1") = (_sendmsg_flags); \ - __asm volatile ("jsr a6@(-270:W)" \ - : "=r"(__sendmsg__re) \ - : "r"(__sendmsg__bn), "r"(__sendmsg_sock), "r"(__sendmsg_msg), "r"(__sendmsg_flags) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __sendmsg__re; \ - }); \ - _sendmsg__re; \ -}) - -#define __recvmsg(sock, msg, flags) ({ \ - LONG _recvmsg_sock = (sock); \ - struct msghdr * _recvmsg_msg = (msg); \ - LONG _recvmsg_flags = (flags); \ - LONG _recvmsg__re = \ - ({ \ - register struct Library * const __recvmsg__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __recvmsg__re __asm("d0"); \ - register LONG __recvmsg_sock __asm("d0") = (_recvmsg_sock); \ - register struct msghdr * __recvmsg_msg __asm("a0") = (_recvmsg_msg); \ - register LONG __recvmsg_flags __asm("d1") = (_recvmsg_flags); \ - __asm volatile ("jsr a6@(-276:W)" \ - : "=r"(__recvmsg__re) \ - : "r"(__recvmsg__bn), "r"(__recvmsg_sock), "r"(__recvmsg_msg), "r"(__recvmsg_flags) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __recvmsg__re; \ - }); \ - _recvmsg__re; \ -}) - -#define __gethostname(name, namelen) ({ \ - STRPTR _gethostname_name = (name); \ - LONG _gethostname_namelen = (namelen); \ - LONG _gethostname__re = \ - ({ \ - register struct Library * const __gethostname__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __gethostname__re __asm("d0"); \ - register STRPTR __gethostname_name __asm("a0") = (_gethostname_name); \ - register LONG __gethostname_namelen __asm("d0") = (_gethostname_namelen); \ - __asm volatile ("jsr a6@(-282:W)" \ - : "=r"(__gethostname__re) \ - : "r"(__gethostname__bn), "r"(__gethostname_name), "r"(__gethostname_namelen) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __gethostname__re; \ - }); \ - _gethostname__re; \ -}) - -#define __gethostid() ({ \ - ULONG _gethostid__re = \ - ({ \ - register struct Library * const __gethostid__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register ULONG __gethostid__re __asm("d0"); \ - __asm volatile ("jsr a6@(-288:W)" \ - : "=r"(__gethostid__re) \ - : "r"(__gethostid__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __gethostid__re; \ - }); \ - _gethostid__re; \ -}) - -#define __SocketBaseTagList(tags) ({ \ - struct TagItem * _SocketBaseTagList_tags = (tags); \ - LONG _SocketBaseTagList__re = \ - ({ \ - register struct Library * const __SocketBaseTagList__bn __asm("a6") = (struct Library *) (__SocketBase);\ - register LONG __SocketBaseTagList__re __asm("d0"); \ - register struct TagItem * __SocketBaseTagList_tags __asm("a0") = (_SocketBaseTagList_tags); \ - __asm volatile ("jsr a6@(-294:W)" \ - : "=r"(__SocketBaseTagList__re) \ - : "r"(__SocketBaseTagList__bn), "r"(__SocketBaseTagList_tags) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __SocketBaseTagList__re; \ - }); \ - _SocketBaseTagList__re; \ -}) - -#endif /* __amigaos4__ */ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#if defined(__SASC) - -LONG __socket(LONG domain,LONG type,LONG protocol); -LONG __bind(LONG sock,struct sockaddr *name,LONG namelen); -LONG __listen(LONG sock,LONG backlog); -LONG __accept(LONG sock,struct sockaddr *addr,LONG *addrlen); -LONG __connect(LONG sock,struct sockaddr *name,LONG namelen); -LONG __sendto(LONG sock,APTR buf,LONG len,LONG flags,struct sockaddr *to,LONG tolen); -LONG __send(LONG sock,APTR buf,LONG len,LONG flags); -LONG __recvfrom(LONG sock,APTR buf,LONG len,LONG flags,struct sockaddr *addr,LONG *addrlen); -LONG __recv(LONG sock,APTR buf,LONG len,LONG flags); -LONG __shutdown(LONG sock,LONG how); -LONG __setsockopt(LONG sock,LONG level,LONG optname,APTR optval,LONG optlen); -LONG __getsockopt(LONG sock,LONG level,LONG optname,APTR optval,LONG *optlen); -LONG __getsockname(LONG sock,struct sockaddr *name,LONG *namelen); -LONG __getpeername(LONG sock,struct sockaddr *name,LONG *namelen); -LONG __IoctlSocket(LONG sock,ULONG req,APTR argp); -LONG __CloseSocket(LONG sock); -LONG __WaitSelect(LONG nfds,APTR read_fds,APTR write_fds,APTR except_fds,struct timeval *timeout,ULONG *signals); -VOID __SetSocketSignals(ULONG int_mask,ULONG io_mask,ULONG urgent_mask); -LONG __getdtablesize(VOID); -LONG __ObtainSocket(LONG id,LONG domain,LONG type,LONG protocol); -LONG __ReleaseSocket(LONG sock,LONG id); -LONG __ReleaseCopyOfSocket(LONG sock,LONG id); -LONG __Errno(VOID); -VOID __SetErrnoPtr(APTR errno_ptr,LONG size); -STRPTR __Inet_NtoA(ULONG ip); -ULONG __inet_addr(STRPTR cp); -ULONG __Inet_LnaOf(ULONG in); -ULONG __Inet_NetOf(ULONG in); -ULONG __Inet_MakeAddr(ULONG net,ULONG host); -ULONG __inet_network(STRPTR cp); -struct hostent *__gethostbyname(STRPTR name); -struct hostent *__gethostbyaddr(STRPTR addr,LONG len,LONG type); -struct netent *__getnetbyname(STRPTR name); -struct netent *__getnetbyaddr(LONG net,LONG type); -struct servent *__getservbyname(STRPTR name,STRPTR proto); -struct servent *__getservbyport(LONG port,STRPTR proto); -struct protoent *__getprotobyname(STRPTR name); -struct protoent *__getprotobynumber(LONG proto); -VOID __vsyslog(LONG pri,STRPTR msg,APTR args); -LONG __Dup2Socket(LONG old_socket,LONG new_socket); -LONG __sendmsg(LONG sock,struct msghdr *msg,LONG flags); -LONG __recvmsg(LONG sock,struct msghdr *msg,LONG flags); -LONG __gethostname(STRPTR name,LONG namelen); -ULONG __gethostid(VOID); -LONG __SocketBaseTagList(struct TagItem *tags); - -#pragma libcall __SocketBase __socket 01e 21003 -#pragma libcall __SocketBase __bind 024 18003 -#pragma libcall __SocketBase __listen 02a 1002 -#pragma libcall __SocketBase __accept 030 98003 -#pragma libcall __SocketBase __connect 036 18003 -#pragma libcall __SocketBase __sendto 03c 39218006 -#pragma libcall __SocketBase __send 042 218004 -#pragma libcall __SocketBase __recvfrom 048 a9218006 -#pragma libcall __SocketBase __recv 04e 218004 -#pragma libcall __SocketBase __shutdown 054 1002 -#pragma libcall __SocketBase __setsockopt 05a 3821005 -#pragma libcall __SocketBase __getsockopt 060 9821005 -#pragma libcall __SocketBase __getsockname 066 98003 -#pragma libcall __SocketBase __getpeername 06c 98003 -#pragma libcall __SocketBase __IoctlSocket 072 81003 -#pragma libcall __SocketBase __CloseSocket 078 001 -#pragma libcall __SocketBase __WaitSelect 07e 1ba98006 -#pragma libcall __SocketBase __SetSocketSignals 084 21003 -#pragma libcall __SocketBase __getdtablesize 08a 00 -#pragma libcall __SocketBase __ObtainSocket 090 321004 -#pragma libcall __SocketBase __ReleaseSocket 096 1002 -#pragma libcall __SocketBase __ReleaseCopyOfSocket 09c 1002 -#pragma libcall __SocketBase __Errno 0a2 00 -#pragma libcall __SocketBase __SetErrnoPtr 0a8 0802 -#pragma libcall __SocketBase __Inet_NtoA 0ae 001 -#pragma libcall __SocketBase __inet_addr 0b4 801 -#pragma libcall __SocketBase __Inet_LnaOf 0ba 001 -#pragma libcall __SocketBase __Inet_NetOf 0c0 001 -#pragma libcall __SocketBase __Inet_MakeAddr 0c6 1002 -#pragma libcall __SocketBase __inet_network 0cc 801 -#pragma libcall __SocketBase __gethostbyname 0d2 801 -#pragma libcall __SocketBase __gethostbyaddr 0d8 10803 -#pragma libcall __SocketBase __getnetbyname 0de 801 -#pragma libcall __SocketBase __getnetbyaddr 0e4 1002 -#pragma libcall __SocketBase __getservbyname 0ea 9802 -#pragma libcall __SocketBase __getservbyport 0f0 8002 -#pragma libcall __SocketBase __getprotobyname 0f6 801 -#pragma libcall __SocketBase __getprotobynumber 0fc 001 -#pragma libcall __SocketBase __vsyslog 102 98003 -#pragma libcall __SocketBase __Dup2Socket 108 1002 -#pragma libcall __SocketBase __sendmsg 10e 18003 -#pragma libcall __SocketBase __recvmsg 114 18003 -#pragma libcall __SocketBase __gethostname 11a 0802 -#pragma libcall __SocketBase __gethostid 120 00 -#pragma libcall __SocketBase __SocketBaseTagList 126 801 - -#endif /* __SASC */ - -/****************************************************************************/ - -#endif /* _SOCKET_HEADERS_H */ diff --git a/library/socket_hook_entry.c b/library/socket_hook_entry.c deleted file mode 100644 index 586c9f4..0000000 --- a/library/socket_hook_entry.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * $Id: socket_hook_entry.c,v 1.15 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -int -__socket_hook_entry( - struct fd * fd, - struct file_action_message * fam) -{ - struct FileInfoBlock * fib; - BOOL is_aliased; - int result; - int param; - - assert( fam != NULL && fd != NULL ); - - /* Careful: file_action_close has to monkey with the file descriptor - table and therefore needs to obtain the stdio lock before - it locks this particular descriptor entry. */ - if(fam->fam_Action == file_action_close) - __stdio_lock(); - - __fd_lock(fd); - - switch(fam->fam_Action) - { - case file_action_read: - - SHOWMSG("file_action_read"); - - assert( fam->fam_Data != NULL ); - assert( fam->fam_Size > 0 ); - - SHOWPOINTER(fam->fam_Data); - SHOWVALUE(fam->fam_Size); - - PROFILE_OFF(); - - result = __recv((LONG)fd->fd_DefaultFile,fam->fam_Data,fam->fam_Size,0); - if(result < 0) - fam->fam_Error = __get_errno(); - - PROFILE_ON(); - - break; - - case file_action_write: - - SHOWMSG("file_action_write"); - - assert( fam->fam_Data != NULL ); - assert( fam->fam_Size > 0 ); - - SHOWPOINTER(fam->fam_Data); - SHOWVALUE(fam->fam_Size); - - PROFILE_OFF(); - - result = __send((LONG)fd->fd_DefaultFile,fam->fam_Data,fam->fam_Size,0); - if(result < 0) - fam->fam_Error = __get_errno(); - - PROFILE_ON(); - - break; - - case file_action_close: - - SHOWMSG("file_action_close"); - - result = OK; - - /* If this is an alias, just remove it. */ - is_aliased = __fd_is_aliased(fd); - if(is_aliased) - { - __remove_fd_alias(fd); - } - else - { - /* Are we permitted to close this file? */ - if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_NO_CLOSE)) - { - PROFILE_OFF(); - - result = __CloseSocket((LONG)fd->fd_DefaultFile); - - PROFILE_ON(); - } - } - - __fd_unlock(fd); - - #if defined(__THREAD_SAFE) - { - /* Free the lock semaphore now. */ - if(NOT is_aliased) - __delete_semaphore(fd->fd_Lock); - } - #endif /* __THREAD_SAFE */ - - /* And that's the last for this file descriptor. */ - memset(fd,0,sizeof(*fd)); - - break; - - case file_action_seek: - - SHOWMSG("file_action_seek"); - - result = ERROR; - - fam->fam_Error = ESPIPE; - - break; - - case file_action_set_blocking: - - SHOWMSG("file_action_set_blocking"); - - param = (int)(fam->fam_Arg == 0); - - result = __IoctlSocket(fd->fd_DefaultFile,FIONBIO,¶m); - if(result < 0) - fam->fam_Error = __get_errno(); - - break; - - case file_action_set_async: - - SHOWMSG("file_action_set_async"); - - param = (int)(fam->fam_Arg != 0); - - result = __IoctlSocket(fd->fd_DefaultFile,FIOASYNC,¶m); - if(result < 0) - fam->fam_Error = __get_errno(); - - break; - - case file_action_examine: - - SHOWMSG("file_action_examine"); - - fib = fam->fam_FileInfo; - - memset(fib,0,sizeof(*fib)); - - fib->fib_DirEntryType = ST_SOCKET; - - PROFILE_OFF(); - DateStamp(&fib->fib_Date); - PROFILE_ON(); - - result = OK; - - break; - - default: - - SHOWVALUE(fam->fam_Action); - - result = ERROR; - - fam->fam_Error = EBADF; - - break; - } - - __fd_unlock(fd); - - if(fam->fam_Action == file_action_close) - __stdio_unlock(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_hstrerror.c b/library/socket_hstrerror.c deleted file mode 100644 index f2dbad7..0000000 --- a/library/socket_hstrerror.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * $Id: socket_hstrerror.c,v 1.4 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -const char * -hstrerror(int error_number) -{ - const char * result; - - if(error_number < 1 || error_number > 4) - { - static char error_buffer[80]; - char number[30]; - char *s = number; - int is_negative = 0; - unsigned int n; - int i,len,c; - - /* We convert the error number into in an unsigned - integer, so that numbers such as 0x80000000 - can come out of the conversion. */ - if(error_number < 0) - { - is_negative = 1; - - n = (-error_number); - } - else - { - n = error_number; - } - - /* Convert the error number into a string of digits. */ - len = 0; - - do - { - (*s++) = '0' + (n % 10); - n /= 10; - len++; - } - while(n > 0 && len < (int)sizeof(number)-1); - - /* Add the sign, if necessary. */ - if(is_negative && len < (int)sizeof(number)-1) - { - (*s++) = '-'; - len++; - } - - (*s) = '\0'; - - /* Reverse the string in place. */ - for(i = 0 ; i < len / 2 ; i++) - { - c = number[len-1-i]; - number[len-1-i] = number[i]; - number[i] = c; - } - - strcpy(error_buffer,"Unknown resolver error "); - strcat(error_buffer,number); - - result = error_buffer; - } - else - { - switch(error_number) - { - case 1: /* HOST_NOT_FOUND */ - - result = "Unknown host"; - break; - - case 2: /* TRY_AGAIN */ - - result = "Host name lookup failure; try again"; - break; - - case 3: /* NO_RECOVERY */ - - result = "Unknown server error"; - break; - - default: - case 4: /* NO_ADDRESS */ - - result = "No address associated with name"; - break; - } - } - - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_inet_addr.c b/library/socket_inet_addr.c deleted file mode 100644 index a5f6640..0000000 --- a/library/socket_inet_addr.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * $Id: socket_inet_addr.c,v 1.3 2005-02-03 16:56:15 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -unsigned long -inet_addr(const char *addr) -{ - unsigned long result = 0xFFFFFFFFUL; - - ENTER(); - - SHOWSTRING(addr); - - assert(addr != NULL); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(addr == NULL) - { - SHOWMSG("invalid parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - result = __inet_addr((char *)addr); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_inet_aton.c b/library/socket_inet_aton.c deleted file mode 100644 index 6d7b8db..0000000 --- a/library/socket_inet_aton.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * $Id: socket_inet_aton.c,v 1.3 2005-02-03 16:56:15 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -/* - * Copyright (c) 1983, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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 */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -/* - * Check whether "cp" is a valid ascii representation - * of an Internet address and convert to a binary address. - * Returns 1 if the address is valid, 0 if not. - * This replaces inet_addr, the return value from which - * cannot distinguish between failure and a local broadcast address. - */ -int -inet_aton(const char *cp, struct in_addr *addr) -{ - ULONG val = 0; - int base, n; - char c; - LONG parts[4]; - LONG *pp = parts; - - assert( cp != NULL && addr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(cp == NULL || addr == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - return(0); - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - for (;;) { - /* - * Collect number up to ``.''. - * Values are specified as for C: - * 0x=hex, 0=octal, other=decimal. - */ - val = 0; base = 10; - if (*cp == '0') { - if (*++cp == 'x' || *cp == 'X') - base = 16, cp++; - else - base = 8; - } - while ((c = *cp) != '\0') { - if (isascii(c) && isdigit(c)) { - val = (val * base) + (c - '0'); - cp++; - continue; - } - if (base == 16 && isascii(c) && isxdigit(c)) { - val = (val << 4) + - (c + 10 - (islower(c) ? 'a' : 'A')); - cp++; - continue; - } - break; - } - if (*cp == '.') { - /* - * Internet format: - * a.b.c.d - * a.b.c (with c treated as 16-bits) - * a.b (with b treated as 24 bits) - */ - if (pp >= parts + 3 || val > 0xff) - return (0); - *pp++ = val, cp++; - } else - break; - } - /* - * Check for trailing characters. - */ - if (*cp && (!isascii(*cp) || !isspace(*cp))) - return (0); - /* - * Concoct the address according to - * the number of parts specified. - */ - n = pp - parts + 1; - switch (n) { - - case 1: /* a -- 32 bits */ - break; - - case 2: /* a.b -- 8.24 bits */ - if (val > 0xffffff) - return (0); - val |= parts[0] << 24; - break; - - case 3: /* a.b.c -- 8.8.16 bits */ - if (val > 0xffff) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16); - break; - - case 4: /* a.b.c.d -- 8.8.8.8 bits */ - if (val > 0xff) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); - break; - - default: - - return(0); - } - if (addr) - addr->s_addr = val; - return (1); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_inet_lnaof.c b/library/socket_inet_lnaof.c deleted file mode 100644 index d85ef2f..0000000 --- a/library/socket_inet_lnaof.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id: socket_inet_lnaof.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -unsigned long -inet_lnaof(struct in_addr in) -{ - unsigned long result; - - ENTER(); - - assert(__SocketBase != NULL); - - PROFILE_OFF(); - result = __Inet_LnaOf(in.s_addr); - PROFILE_ON(); - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_inet_makeaddr.c b/library/socket_inet_makeaddr.c deleted file mode 100644 index c2949de..0000000 --- a/library/socket_inet_makeaddr.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id: socket_inet_makeaddr.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -struct in_addr -inet_makeaddr(int net,int host) -{ - struct in_addr result; - - ENTER(); - - assert(__SocketBase != NULL); - - PROFILE_OFF(); - result.s_addr = __Inet_MakeAddr((ULONG)net,(ULONG)host); - PROFILE_ON(); - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result.s_addr); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_inet_netof.c b/library/socket_inet_netof.c deleted file mode 100644 index cf5064c..0000000 --- a/library/socket_inet_netof.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id: socket_inet_netof.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -unsigned long -inet_netof(struct in_addr in) -{ - unsigned long result; - - ENTER(); - - assert(__SocketBase != NULL); - - PROFILE_OFF(); - result = __Inet_NetOf(in.s_addr); - PROFILE_ON(); - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_inet_network.c b/library/socket_inet_network.c deleted file mode 100644 index 4991bf0..0000000 --- a/library/socket_inet_network.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * $Id: socket_inet_network.c,v 1.3 2005-02-03 16:56:15 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -unsigned long -inet_network(const char *cp) -{ - unsigned long result = ~0UL; - - ENTER(); - - assert(cp != NULL); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(cp == NULL) - { - SHOWMSG("invalid cp parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - result = __inet_network((char *)cp); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_inet_ntoa.c b/library/socket_inet_ntoa.c deleted file mode 100644 index 675618f..0000000 --- a/library/socket_inet_ntoa.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: socket_inet_ntoa.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -char * -inet_ntoa(struct in_addr in) -{ - char *result; - - ENTER(); - - SHOWVALUE(in.s_addr); - - assert(__SocketBase != NULL); - - PROFILE_OFF(); - result = __Inet_NtoA(in.s_addr); - PROFILE_ON(); - - SHOWSTRING(result); - - if(__check_abort_enabled) - __check_abort(); - - out: - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_init_exit.c b/library/socket_init_exit.c deleted file mode 100644 index 28aa4bb..0000000 --- a/library/socket_init_exit.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * $Id: socket_init_exit.c,v 1.20 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -#ifndef _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -/* Code value. */ -#define SBTB_CODE 1 -#define SBTS_CODE 0x3FFF - -/* Set a parameter, passing it by value. */ -#ifndef SBTM_SETVAL -#define SBTM_SETVAL(code) (TAG_USER | (((code) & SBTS_CODE) << SBTB_CODE) | 1) -#endif /* SBTM_SETVAL */ - -#define SBTC_BREAKMASK 1 /* Interrupt signal mask */ -#define SBTC_LOGTAGPTR 11 /* Under which name log entries are filed */ -#define SBTC_ERRNOLONGPTR 24 /* Pointer to errno, length == sizeof(errno) */ -#define SBTC_HERRNOLONGPTR 25 /* 'h_errno' pointer (with sizeof(h_errno) == sizeof(long)) */ - -/****************************************************************************/ - -struct DaemonMessage -{ - struct Message dm_Message; - ULONG dm_Pad1; - ULONG dm_Pad2; - LONG dm_ID; - ULONG dm_Pad3; - UBYTE dm_Family; - UBYTE dm_Type; -}; - -/****************************************************************************/ - -struct Library * NOCOMMON __SocketBase; - -/****************************************************************************/ - -#if defined(__amigaos4__) -struct SocketIFace * NOCOMMON __ISocket; -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -int NOCOMMON h_errno; - -/****************************************************************************/ - -SOCKET_DESTRUCTOR(socket_exit) -{ - ENTER(); - - /* Disable ^C checking. */ - if(__SocketBase != NULL) - { - struct TagItem tags[2]; - - tags[0].ti_Tag = SBTM_SETVAL(SBTC_BREAKMASK); - tags[0].ti_Data = 0; - tags[1].ti_Tag = TAG_END; - - PROFILE_OFF(); - __SocketBaseTagList(tags); - PROFILE_ON(); - } - - /* Careful: if this function is ever invoked, it must make sure that - * the socket file descriptors are invalidated. If that - * does not happen, the stdio cleanup function will - * crash (with bells on). - */ - __close_all_files(); - - #if defined(__amigaos4__) - { - if(__ISocket != NULL) - { - DropInterface((struct Interface *)__ISocket); - __ISocket = NULL; - } - } - #endif /* __amigaos4__ */ - - if(__SocketBase != NULL) - { - CloseLibrary(__SocketBase); - __SocketBase = NULL; - } - - LEAVE(); -} - -/****************************************************************************/ - -SOCKET_CONSTRUCTOR(socket_init) -{ - struct TagItem tags[5]; - BOOL success = FALSE; - LONG status; - - ENTER(); - - PROFILE_OFF(); - - /* bsdsocket.library V3 is sufficient for all the tasks we - * may have to perform. - */ - __SocketBase = OpenLibrary("bsdsocket.library",3); - - #if defined(__amigaos4__) - { - if(__SocketBase != NULL) - { - __ISocket = (struct SocketIFace *)GetInterface(__SocketBase, "main", 1, 0); - if (__ISocket == NULL) - { - CloseLibrary(__SocketBase); - __SocketBase = NULL; - } - } - } - #endif /* __amigaos4__ */ - - PROFILE_ON(); - - if(__SocketBase == NULL) - { - SHOWMSG("bsdsocket.library V3 didn't open"); - - __show_error("\"bsdsocket.library\" V3 could not be opened."); - goto out; - } - - /* Wire the library's errno variable to our local errno. */ - tags[0].ti_Tag = SBTM_SETVAL(SBTC_ERRNOLONGPTR); - tags[0].ti_Data = (ULONG)&errno; - - /* Also enable ^C checking if desired. */ - tags[1].ti_Tag = SBTM_SETVAL(SBTC_BREAKMASK); - - if(__check_abort_enabled) - tags[1].ti_Data = SIGBREAKF_CTRL_C; - else - tags[1].ti_Data = 0; - - tags[2].ti_Tag = SBTM_SETVAL(SBTC_LOGTAGPTR); - tags[2].ti_Data = (ULONG)__program_name; - - /* Wire the library's h_errno variable to our local h_errno. */ - tags[3].ti_Tag = SBTM_SETVAL(SBTC_HERRNOLONGPTR); - tags[3].ti_Data = (ULONG)&h_errno; - - tags[4].ti_Tag = TAG_END; - - PROFILE_OFF(); - status = __SocketBaseTagList(tags); - PROFILE_ON(); - - if(status != 0) - { - SHOWMSG("couldn't initialize the library"); - - __show_error("\"bsdsocket.library\" could not be initialized."); - goto out; - } - - /* If this library is built with the Roadshow SDK header files, and - * it should be thread-safe, then we'll try to allow multiple - * concurred processes to share the bsdsocket.library base opened - * above. This only works for Roadshow, though, and has the - * drawback that error reporting through 'errno' and 'h_errno' - * is no longer safe. - */ - #if defined(__THREAD_SAFE) && defined(SBTC_CAN_SHARE_LIBRARY_BASES) - { - if(__SocketBase->lib_Version >= 4) - { - tags[0].ti_Tag = SBTM_SETVAL(SBTC_CAN_SHARE_LIBRARY_BASES); - tags[0].ti_Data = TRUE; - - tags[1].ti_Tag = TAG_END; - - PROFILE_OFF(); - __SocketBaseTagList(tags); - PROFILE_ON(); - } - } - #endif /* __THREAD_SAFE && SBTC_CAN_SHARE_LIBRARY_BASES */ - - /* Check if this program was launched as a server by the Internet - * superserver. - */ - if(Cli() != NULL && NOT __detach) - { - struct DaemonMessage * dm; - - /* The socket the superserver may have launched this program - * with is attached to the exit data entry of the process. - */ - #if defined(__amigaos4__) - { - dm = (struct DaemonMessage *)GetExitData(); - } - #else - { - struct Process * this_process = (struct Process *)FindTask(NULL); - - dm = (struct DaemonMessage *)this_process->pr_ExitData; - } - #endif /* __amigaos4__ */ - - if(TypeOfMem(dm) != 0 && TypeOfMem(((char *)dm) + sizeof(*dm)-1) != 0) - { - struct SignalSemaphore * lock; - int daemon_socket; - struct fd * fd; - int sockfd; - int i; - - SHOWMSG("we have a daemon message; this is a server"); - - /* Try to grab that socket and attach is to the three - * standard I/O streams. - */ - - PROFILE_OFF(); - daemon_socket = __ObtainSocket(dm->dm_ID,dm->dm_Family,dm->dm_Type,0); - PROFILE_ON(); - - if(daemon_socket == -1) - { - __show_error("Network server streams could not be initialized."); - goto out; - } - - SHOWVALUE(daemon_socket); - - /* Shut down the three standard I/O streams. */ - for(i = STDIN_FILENO ; i <= STDERR_FILENO ; i++) - close(i); - - /* The standard I/O streams are no longer attached to a console. */ - __no_standard_io = TRUE; - - /* Put the socket into the three standard I/O streams. */ - for(i = STDIN_FILENO ; i <= STDERR_FILENO ; i++) - { - #if defined(__THREAD_SAFE) - { - lock = __create_semaphore(); - if(lock == NULL) - goto out; - } - #else - { - lock = NULL; - } - #endif /* __THREAD_SAFE */ - - fd = __fd[i]; - - assert( fd != NULL && FLAG_IS_CLEAR(fd->fd_Flags,FDF_IN_USE) ); - - if(i == STDIN_FILENO) - { - sockfd = daemon_socket; - } - else - { - PROFILE_OFF(); - sockfd = __Dup2Socket(daemon_socket,-1); - PROFILE_ON(); - - if(sockfd == -1) - { - SHOWMSG("could not duplicate daemon socket"); - - #if defined(__THREAD_SAFE) - { - __delete_semaphore(lock); - } - #endif /* __THREAD_SAFE */ - - __show_error("Network server streams could not be initialized."); - goto out; - } - } - - __initialize_fd(fd,__socket_hook_entry,(BPTR)sockfd,FDF_IN_USE | FDF_IS_SOCKET | FDF_READ | FDF_WRITE,lock); - } - - /* This program now runs as an internet superserver client (daemon). */ - __is_daemon = TRUE; - } - } - - success = TRUE; - - out: - - SHOWVALUE(success); - LEAVE(); - - if(success) - CONSTRUCTOR_SUCCEED(); - else - CONSTRUCTOR_FAIL(); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_ioctl.c b/library/socket_ioctl.c deleted file mode 100644 index 1344856..0000000 --- a/library/socket_ioctl.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * $Id: socket_ioctl.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDARG_H -#include -#endif /* _STDARG_H */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -int -ioctl(int sockfd,unsigned long request, ... /* char *arg */) -{ - va_list arg; - char * param; - struct fd * fd = NULL; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWVALUE(request); - - assert(__SocketBase != NULL); - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - __fd_lock(fd); - - va_start(arg,request); - param = va_arg(arg,char *); - va_end(arg); - - SHOWPOINTER(param); - - PROFILE_OFF(); - result = __IoctlSocket((LONG)fd->fd_DefaultFile,request,param); - PROFILE_ON(); - - if(result == 0) - { - int * option = (int *)param; - - if(request == FIONBIO) - { - if((*option) != 0) - SET_FLAG(fd->fd_Flags,FDF_NON_BLOCKING); - else - CLEAR_FLAG(fd->fd_Flags,FDF_NON_BLOCKING); - } - else if (request == FIOASYNC) - { - if((*option) != 0) - SET_FLAG(fd->fd_Flags,FDF_ASYNC_IO); - else - CLEAR_FLAG(fd->fd_Flags,FDF_ASYNC_IO); - } - } - - out: - - __fd_unlock(fd); - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_isdaemon.c b/library/socket_isdaemon.c deleted file mode 100644 index 8b53240..0000000 --- a/library/socket_isdaemon.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id: socket_isdaemon.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -BOOL __is_daemon; - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_listen.c b/library/socket_listen.c deleted file mode 100644 index 494dabe..0000000 --- a/library/socket_listen.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * $Id: socket_listen.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -listen(int sockfd,int backlog) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWVALUE(backlog); - - assert(__SocketBase != NULL); - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - PROFILE_OFF(); - result = __listen((LONG)fd->fd_DefaultFile,backlog); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_recv.c b/library/socket_recv.c deleted file mode 100644 index d239a17..0000000 --- a/library/socket_recv.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * $Id: socket_recv.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -recv(int sockfd,void *buff,size_t nbytes,int flags) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWPOINTER(buff); - SHOWVALUE(nbytes); - SHOWVALUE(flags); - - assert( (int)nbytes >= 0 ); - assert( buff != NULL ); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(buff == NULL) - { - SHOWMSG("invalid buffer parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - PROFILE_OFF(); - result = __recv((LONG)fd->fd_DefaultFile,buff,(LONG)nbytes,flags); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_recvfrom.c b/library/socket_recvfrom.c deleted file mode 100644 index 272291c..0000000 --- a/library/socket_recvfrom.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * $Id: socket_recvfrom.c,v 1.6 2005-06-20 07:43:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -recvfrom(int sockfd,void *buff,int len,int flags,struct sockaddr *from,socklen_t *fromlen) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWPOINTER(buff); - SHOWVALUE(len); - SHOWVALUE(flags); - SHOWPOINTER(from); - SHOWPOINTER(fromlen); - - assert( buff != NULL && from != NULL && fromlen != NULL ); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(buff == NULL || from == NULL || fromlen == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - PROFILE_OFF(); - result = __recvfrom((LONG)fd->fd_DefaultFile,buff,len,flags,from,(LONG *)fromlen); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_recvmsg.c b/library/socket_recvmsg.c deleted file mode 100644 index 8a628e8..0000000 --- a/library/socket_recvmsg.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Id: socket_recvmsg.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -recvmsg(int sockfd,struct msghdr *msg,int flags) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWPOINTER(msg); - SHOWVALUE(flags); - - assert( msg != NULL ); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(msg == NULL) - { - SHOWMSG("invalid msg parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - PROFILE_OFF(); - result = __recvmsg((LONG)fd->fd_DefaultFile,msg,flags); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_select.c b/library/socket_select.c deleted file mode 100644 index 5d4b067..0000000 --- a/library/socket_select.c +++ /dev/null @@ -1,1022 +0,0 @@ -/* - * $Id: socket_select.c,v 1.11 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -STATIC VOID -copy_fd_set(fd_set * to,fd_set * from,int num_fds) -{ - ENTER(); - - SHOWPOINTER(to); - SHOWPOINTER(from); - SHOWVALUE(num_fds); - - if(to != NULL && from != NULL && num_fds > 0) - { - size_t num_bytes; - - num_bytes = sizeof(unsigned long) * ((num_fds + 31) / 32); - - SHOWVALUE(num_bytes); - - memmove(to,from,num_bytes); - } - - LEAVE(); -} - -/****************************************************************************/ - -STATIC VOID -zero_fd_set(fd_set * set,int num_fds) -{ - ENTER(); - - SHOWPOINTER(set); - SHOWVALUE(num_fds); - - if(set != NULL && num_fds > 0) - { - size_t num_bytes; - - num_bytes = sizeof(unsigned long) * ((num_fds + 31) / 32); - - SHOWVALUE(num_bytes); - - memset(set,0,num_bytes); - } - - LEAVE(); -} - -/****************************************************************************/ - -STATIC fd_set * -allocate_fd_set(int num_fds,fd_set * duplicate_this_set) -{ - fd_set * result = NULL; - size_t num_bytes; - fd_set * set; - - ENTER(); - - assert( num_fds > 0 ); - - SHOWVALUE(num_fds); - - num_bytes = sizeof(unsigned long) * ((num_fds + 31) / 32); - - SHOWVALUE(num_bytes); - - set = (fd_set *)malloc(num_bytes); - if(set != NULL) - { - if(duplicate_this_set != NULL) - copy_fd_set(set,duplicate_this_set,num_fds); - else - zero_fd_set(set,num_fds); - - result = set; - } - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -STATIC VOID -free_fd_set(fd_set * set) -{ - if(set != NULL) - free(set); -} - -/****************************************************************************/ - -STATIC struct fd * -get_file_descriptor(int file_descriptor) -{ - struct fd * result = NULL; - struct fd * fd; - - __stdio_lock(); - - if(file_descriptor < 0 || file_descriptor >= __num_fd) - goto out; - - assert( __fd != NULL ); - - fd = __fd[file_descriptor]; - - assert( fd != NULL ); - - if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_IN_USE)) - goto out; - - result = fd; - - out: - - __stdio_unlock(); - - return(result); -} - -/****************************************************************************/ - -STATIC VOID -fix_datestamp(struct DateStamp * ds) -{ - const LONG ticks_per_minute = 60 * TICKS_PER_SECOND; - const LONG minutes_per_day = 24 * 60; - - assert( ds != NULL ); - - while(ds->ds_Minute >= minutes_per_day || - ds->ds_Tick >= ticks_per_minute) - { - if(ds->ds_Minute >= minutes_per_day) - { - ds->ds_Days++; - - ds->ds_Minute -= minutes_per_day; - } - - if(ds->ds_Tick >= ticks_per_minute) - { - ds->ds_Minute++; - - ds->ds_Tick -= ticks_per_minute; - } - } -} - -/****************************************************************************/ - -STATIC struct DateStamp * -timeval_to_datestamp(struct DateStamp * ds,const struct timeval * tv) -{ - assert( ds != NULL && tv != NULL ); - - ds->ds_Days = (tv->tv_secs / (24 * 60 * 60)); - ds->ds_Minute = (tv->tv_secs % (24 * 60 * 60)) / 60; - ds->ds_Tick = (tv->tv_secs % 60) * TICKS_PER_SECOND + (TICKS_PER_SECOND * tv->tv_micro) / 1000000; - - fix_datestamp(ds); - - return(ds); -} - -/****************************************************************************/ - -STATIC VOID -add_dates(struct DateStamp * to,const struct DateStamp * from) -{ - assert( to != NULL && from != NULL ); - - to->ds_Tick += from->ds_Tick; - to->ds_Minute += from->ds_Minute; - to->ds_Days += from->ds_Days; - - fix_datestamp(to); -} - -/****************************************************************************/ - -STATIC VOID -map_descriptor_sets( - const fd_set * input_fds, - int num_input_fds, - - fd_set * socket_fds, - int num_socket_fds, - int * total_socket_fd_ptr, - - fd_set * file_fds, - int num_file_fds, - int * total_file_fd_ptr) -{ - ENTER(); - - SHOWPOINTER(input_fds); - SHOWVALUE(num_input_fds); - - SHOWPOINTER(socket_fds); - SHOWVALUE(num_socket_fds); - - SHOWPOINTER(file_fds); - SHOWVALUE(num_file_fds); - - /* This routine maps file descriptor sets - * from one format to another. We map - * socket descriptors and regular file - * descriptor sets. - */ - if(input_fds != NULL && num_input_fds > 0) - { - int total_socket_fd; - int total_file_fd; - struct fd * fd; - int file_fd; - - total_socket_fd = (*total_socket_fd_ptr); - total_file_fd = (*total_file_fd_ptr); - - SHOWVALUE(total_socket_fd); - SHOWVALUE(total_file_fd); - - for(file_fd = 0 ; file_fd < num_input_fds ; file_fd++) - { - if(NOT FD_ISSET(file_fd,input_fds)) - continue; - - D(("descriptor %ld is set",file_fd)); - - fd = get_file_descriptor(file_fd); - if(fd == NULL) - { - SHOWMSG("but no file is attached to it"); - continue; - } - - /* Is this a socket descriptor? */ - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET)) - { - int socket_fd = (int)fd->fd_DefaultFile; - - D(("corresponds to socket #%ld",socket_fd)); - - if(socket_fds != NULL && socket_fd < num_socket_fds) - { - SHOWMSG("setting it"); - - FD_SET(socket_fd,socket_fds); - - if(total_socket_fd < socket_fd+1) - total_socket_fd = socket_fd+1; - } - else - { - SHOWMSG("can't set it, though"); - } - } - else - { - /* We only watch files bound to console streams. */ - if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_IS_INTERACTIVE) || FLAG_IS_SET(fd->fd_Flags,FDF_STDIO)) - { - SHOWMSG("this is a file, or otherwise unsuitable"); - continue; - } - - SHOWMSG("this is an interactive stream"); - - if(file_fds != NULL && file_fd < num_file_fds) - { - SHOWMSG("setting it"); - - FD_SET(file_fd,file_fds); - - if(total_file_fd < file_fd+1) - total_file_fd = file_fd+1; - } - else - { - SHOWMSG("can't set it, though"); - } - } - } - - (*total_socket_fd_ptr) = total_socket_fd; - (*total_file_fd_ptr) = total_file_fd; - - SHOWVALUE(total_socket_fd); - SHOWVALUE(total_file_fd); - } - - LEAVE(); -} - -/****************************************************************************/ - -STATIC VOID -remap_descriptor_sets( - const fd_set * socket_fds, - int num_socket_fds, - - const fd_set * file_fds, - int num_file_fds, - - fd_set * output_fds, - int num_output_fds) -{ - ENTER(); - - SHOWPOINTER(socket_fds); - SHOWVALUE(num_socket_fds); - - SHOWPOINTER(file_fds); - SHOWVALUE(num_file_fds); - - SHOWPOINTER(output_fds); - SHOWVALUE(num_output_fds); - - /* This routine reverses the mapping established - * above. We map the file and socket descriptor - * sets back into the original set. - */ - if(output_fds != NULL && num_output_fds > 0) - { - zero_fd_set(output_fds,num_output_fds); - - if(socket_fds != NULL && num_socket_fds > 0) - { - struct fd * fd; - int output_fd; - int socket_fd; - - SHOWMSG("taking care of the sockets"); - - for(socket_fd = 0 ; socket_fd < num_socket_fds ; socket_fd++) - { - if(NOT FD_ISSET(socket_fd,socket_fds)) - continue; - - for(output_fd = 0 ; output_fd < num_output_fds ; output_fd++) - { - fd = get_file_descriptor(output_fd); - if(fd != NULL && FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET) && (int)fd->fd_DefaultFile == socket_fd) - { - assert( output_fd < num_output_fds ); - assert( FLAG_IS_SET(__fd[output_fd]->fd_Flags,FDF_IS_SOCKET) ); - - D(("setting file %ld for socket #%ld",output_fd,socket_fd)); - - FD_SET(output_fd,output_fds); - } - } - } - } - - if(file_fds != NULL && num_file_fds > 0) - { - int file_fd; - - SHOWMSG("taking care of the files"); - - for(file_fd = 0 ; file_fd < num_file_fds ; file_fd++) - { - if(FD_ISSET(file_fd,file_fds)) - { - int output_fd = file_fd; - - assert( output_fd < num_output_fds ); - assert( FLAG_IS_CLEAR(__fd[output_fd]->fd_Flags,FDF_IS_SOCKET) ); - - D(("setting file %ld",file_fd)); - - FD_SET(output_fd,output_fds); - } - } - } - } - else - { - SHOWMSG("no output necessary"); - } - - LEAVE(); -} - -/****************************************************************************/ - -STATIC VOID -get_num_descriptors_used(int num_fds,int * num_socket_used_ptr,int * num_file_used_ptr) -{ - int num_socket_used = 0; - int num_file_used = 0; - int which_file_fd; - struct fd * fd; - - assert( num_socket_used_ptr != NULL ); - assert( num_file_used_ptr != NULL ); - - SHOWMSG("figuring out which file descriptors are in use"); - - for(which_file_fd = 0 ; which_file_fd < num_fds ; which_file_fd++) - { - fd = get_file_descriptor(which_file_fd); - if(fd != NULL) - { - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET)) - { - int which_socket_fd = (int)fd->fd_DefaultFile; - - if(num_socket_used < which_socket_fd+1) - num_socket_used = which_socket_fd+1; - } - else - { - if(num_file_used < which_file_fd+1) - num_file_used = which_file_fd+1; - } - } - } - - (*num_socket_used_ptr) = num_socket_used; - (*num_file_used_ptr) = num_file_used; -} - -/****************************************************************************/ - -int -select(int num_fds,fd_set *read_fds,fd_set *write_fds,fd_set *except_fds,struct timeval *timeout) -{ - fd_set * backup_socket_read_fds = NULL; - fd_set * backup_socket_write_fds = NULL; - fd_set * backup_socket_except_fds = NULL; - - fd_set * backup_file_read_fds = NULL; - fd_set * backup_file_write_fds = NULL; - - fd_set * socket_read_fds = NULL; - fd_set * socket_write_fds = NULL; - fd_set * socket_except_fds = NULL; - int total_socket_fd; - - fd_set * file_read_fds = NULL; - fd_set * file_write_fds = NULL; - int total_file_fd; - - struct fd * fd; - int result = ERROR; - - int num_socket_used; - int num_file_used; - int i; - - ENTER(); - - SHOWVALUE(num_fds); - SHOWPOINTER(read_fds); - SHOWPOINTER(write_fds); - SHOWPOINTER(except_fds); - SHOWPOINTER(timeout); - - if(timeout != NULL) - { - SHOWVALUE(timeout->tv_secs); - SHOWVALUE(timeout->tv_micro); - } - - assert(__SocketBase != NULL); - - if(__check_abort_enabled) - __check_abort(); - - /* Figure out the number of file and socket descriptors in use. */ - get_num_descriptors_used(num_fds,&num_socket_used,&num_file_used); - - SHOWVALUE(num_socket_used); - SHOWVALUE(num_file_used); - - /* Dynamically allocate the tables to keep track of which descriptor - * is ready for I/O. - */ - if(read_fds != NULL) - { - if(num_socket_used > 0) - { - SHOWMSG("allocating read socket fd_set"); - - socket_read_fds = allocate_fd_set(num_socket_used,NULL); - if(socket_read_fds == NULL) - goto out; - } - - if(num_file_used > 0) - { - SHOWMSG("allocating read file fd_set"); - - file_read_fds = allocate_fd_set(num_file_used,NULL); - if(file_read_fds == NULL) - goto out; - } - } - - if(write_fds != NULL) - { - if(num_socket_used > 0) - { - SHOWMSG("allocating write socket fd_set"); - - socket_write_fds = allocate_fd_set(num_socket_used,NULL); - if(socket_write_fds == NULL) - goto out; - } - - if(num_file_used > 0) - { - SHOWMSG("allocating write file fd_set"); - - file_write_fds = allocate_fd_set(num_file_used,NULL); - if(file_write_fds == NULL) - goto out; - } - } - - if(except_fds != NULL) - { - if(num_socket_used > 0) - { - SHOWMSG("allocating except socket fd_set"); - - socket_except_fds = allocate_fd_set(num_socket_used,NULL); - if(socket_except_fds == NULL) - goto out; - } - } - - total_socket_fd = 0; - total_file_fd = 0; - - SHOWMSG("mapping the fd_sets"); - - /* Translate from the tables the caller provided to us - * to the local copies, which take the files and sockets - * into account. - */ - __stdio_lock(); - - map_descriptor_sets(read_fds, num_fds, socket_read_fds, num_socket_used, &total_socket_fd, file_read_fds, num_file_used, &total_file_fd); - map_descriptor_sets(write_fds, num_fds, socket_write_fds, num_socket_used, &total_socket_fd, file_write_fds, num_file_used, &total_file_fd); - map_descriptor_sets(except_fds, num_fds, socket_except_fds, num_socket_used, &total_socket_fd, NULL, 0, &total_file_fd); - - __stdio_unlock(); - - /* Wait for socket input? */ - if(total_socket_fd > 0) - { - SHOWMSG("we have to deal with sockets"); - - /* Wait for file input, too? */ - if((total_file_fd > 0) && (timeout == NULL || timeout->tv_secs > 0 || timeout->tv_micro > 0)) - { - struct DateStamp stop_when; - struct timeval zero; - ULONG break_mask; - BOOL got_input; - BOOL got_output; - - SHOWMSG("we also have to deal with files"); - - /* We may poll the sockets and files several times in a row. - * The results stored in the tables can tell only a single - * story, though. This is why we need to keep a backup copy - * of each table around, to be used for each iteration of - * the loop in which the sockets and files are checked. - */ - if(read_fds != NULL) - { - if(num_socket_used > 0) - { - SHOWMSG("allocating backup read socket fd_set"); - - backup_socket_read_fds = allocate_fd_set(num_socket_used,socket_read_fds); - if(backup_socket_read_fds == NULL) - goto out; - } - - if(num_file_used > 0) - { - SHOWMSG("allocating backup read file fd_set"); - - backup_file_read_fds = allocate_fd_set(num_file_used,file_read_fds); - if(backup_file_read_fds == NULL) - goto out; - } - } - - if(write_fds != NULL) - { - if(num_socket_used > 0) - { - SHOWMSG("allocating backup write socket fd_set"); - - backup_socket_write_fds = allocate_fd_set(num_socket_used,socket_write_fds); - if(backup_socket_write_fds == NULL) - goto out; - } - - if(num_file_used > 0) - { - SHOWMSG("allocating backup write file fd_set"); - - backup_file_write_fds = allocate_fd_set(num_file_used,file_write_fds); - if(backup_file_write_fds == NULL) - goto out; - } - } - - if(except_fds != NULL) - { - if(num_socket_used > 0) - { - SHOWMSG("allocating backup except socket fd_set"); - - backup_socket_except_fds = allocate_fd_set(num_socket_used,socket_except_fds); - if(backup_socket_except_fds == NULL) - goto out; - } - } - - /* We are going to poll all streams; for the timeout - * feature to work, we absolutely must know when to - * stop polling. - * - * Why aren't we using asynchronous DOS packets? - * The answer is that once a packet is sent, you - * cannot easily abort it. Polling is safer in - * that respect. Yes, I know that ACTION_STACK - * can be used to fake input to a console stream, - * but I'd rather not rely upon it. - */ - if(timeout != NULL) - { - struct DateStamp datestamp_timeout; - - PROFILE_OFF(); - DateStamp(&stop_when); - PROFILE_ON(); - - add_dates(&stop_when,timeval_to_datestamp(&datestamp_timeout,timeout)); - } - else - { - /* No timeout, poll until we are interrupted - * or get input from any of the files. It's - * not really necessary to initialize this - * timeval, but it keeps the compiler happy. - */ - memset(&stop_when,0,sizeof(stop_when)); - } - - while(TRUE) - { - /* Check for break signal. */ - if(__check_abort_enabled) - __check_abort(); - - /* Delay for a tick to avoid busy-waiting. */ - PROFILE_OFF(); - Delay(1); - PROFILE_ON(); - - /* This tells WaitSelect() to poll the sockets for input. */ - zero.tv_secs = 0; - zero.tv_micro = 0; - - /* Signals to stop on; we want to stop when a break signal arrives. */ - if(__check_abort_enabled) - break_mask = SIGBREAKF_CTRL_C; - else - break_mask = 0; - - /* Check for socket input. */ - PROFILE_OFF(); - result = __WaitSelect(total_socket_fd,socket_read_fds,socket_write_fds,socket_except_fds,&zero,&break_mask); - PROFILE_ON(); - - /* Stop if a break signal arrives. */ - if((result < 0 && __get_errno() == EINTR) || FLAG_IS_SET(break_mask,SIGBREAKF_CTRL_C)) - { - SetSignal(SIGBREAKF_CTRL_C,SIGBREAKF_CTRL_C); - __check_abort(); - } - - /* Stop if the return value from WaitSelect() is negative (timeout, abort or serious error). */ - if(result < 0) - break; - - /* Check all files for input. We also poll - * them for input, but each with a little - * delay of about 1 microsecond. We stop - * as soon as we find one file that has - * input in it. - */ - for(i = 0 ; i < total_file_fd ; i++) - { - got_input = got_output = FALSE; - - fd = get_file_descriptor(i); - if(fd != NULL) - { - if(file_read_fds != NULL && FD_ISSET(i,file_read_fds)) - { - if(FLAG_IS_SET(fd->fd_Flags,FDF_READ)) - { - assert( FLAG_IS_CLEAR(fd->fd_Flags,FDF_IS_SOCKET) && FLAG_IS_CLEAR(fd->fd_Flags,FDF_STDIO) ); - - /* Does this one have input? */ - PROFILE_OFF(); - - if(WaitForChar(fd->fd_DefaultFile,1)) - got_input = TRUE; - - PROFILE_ON(); - } - } - - if(file_write_fds != NULL && FD_ISSET(i,file_write_fds)) - { - /* If this is a writable stream, assume that we can - * write to it. ZZZ AmigaDOS needs a method to check - * if the write will block. - */ - if(FLAG_IS_SET(fd->fd_Flags,FDF_WRITE)) - { - assert( FLAG_IS_CLEAR(fd->fd_Flags,FDF_IS_SOCKET) ); - - got_output = TRUE; - } - } - } - - if(got_input || got_output) - { - /* Mark one more descriptor as - * having input/output. - */ - result++; - } - - if(file_read_fds != NULL && NOT got_input) - FD_CLR(i,file_read_fds); - - if(file_write_fds != NULL && NOT got_output) - FD_CLR(i,file_write_fds); - } - - /* Did we get any input? If so, stop polling. */ - if(result > 0) - break; - - /* If a timeout was set, check if we are already - * beyond the point of time when we should have - * stopped polling. - */ - if(timeout != NULL) - { - struct DateStamp now; - - PROFILE_OFF(); - DateStamp(&now); - PROFILE_ON(); - - if(CompareDates(&now,&stop_when) <= 0) - break; - } - - /* No I/O ready yet. Restore the sets and retry... */ - copy_fd_set(socket_read_fds, backup_socket_read_fds, num_socket_used); - copy_fd_set(socket_write_fds, backup_socket_write_fds, num_socket_used); - copy_fd_set(socket_except_fds, backup_socket_except_fds, num_socket_used); - - copy_fd_set(file_read_fds, backup_file_read_fds, num_file_used); - copy_fd_set(file_write_fds, backup_file_write_fds, num_file_used); - } - } - else - { - ULONG break_mask; - - if(__check_abort_enabled) - break_mask = SIGBREAKF_CTRL_C; - else - break_mask = 0; - - PROFILE_OFF(); - result = __WaitSelect(total_socket_fd,socket_read_fds,socket_write_fds,socket_except_fds,timeout,&break_mask); - PROFILE_ON(); - - if((result < 0 && __get_errno() == EINTR) || FLAG_IS_SET(break_mask,SIGBREAKF_CTRL_C)) - { - SetSignal(SIGBREAKF_CTRL_C,SIGBREAKF_CTRL_C); - __check_abort(); - } - } - } - else - { - /* Wait for file input? */ - if((total_file_fd > 0) && (timeout == NULL || timeout->tv_secs > 0 || timeout->tv_micro > 0)) - { - struct DateStamp stop_when; - BOOL got_input; - BOOL got_output; - - SHOWMSG("we have to deal with files"); - - if(num_file_used > 0) - { - if(read_fds != NULL) - { - SHOWMSG("allocating backup file read fd_set"); - - backup_file_read_fds = allocate_fd_set(num_file_used,file_read_fds); - if(backup_file_read_fds == NULL) - goto out; - } - - if(write_fds != NULL) - { - SHOWMSG("allocating backup file write fd_set"); - - backup_file_write_fds = allocate_fd_set(num_file_used,file_write_fds); - if(backup_file_write_fds == NULL) - goto out; - } - } - - if(timeout != NULL) - { - struct DateStamp datestamp_timeout; - - PROFILE_OFF(); - DateStamp(&stop_when); - PROFILE_ON(); - - add_dates(&stop_when,timeval_to_datestamp(&datestamp_timeout,timeout)); - } - else - { - memset(&stop_when,0,sizeof(stop_when)); - } - - while(TRUE) - { - if(__check_abort_enabled) - __check_abort(); - - PROFILE_OFF(); - Delay(1); - PROFILE_ON(); - - result = 0; - - for(i = 0 ; i < total_file_fd ; i++) - { - got_input = got_output = FALSE; - - fd = get_file_descriptor(i); - if(fd != NULL) - { - if(file_read_fds != NULL && FD_ISSET(i,file_read_fds)) - { - if(FLAG_IS_SET(fd->fd_Flags,FDF_READ)) - { - assert( FLAG_IS_CLEAR(fd->fd_Flags,FDF_IS_SOCKET) && FLAG_IS_CLEAR(fd->fd_Flags,FDF_STDIO) ); - - PROFILE_OFF(); - - if(WaitForChar(fd->fd_DefaultFile,1)) - got_input = TRUE; - - PROFILE_ON(); - } - } - - if(file_write_fds != NULL && FD_ISSET(i,file_write_fds)) - { - if(FLAG_IS_SET(fd->fd_Flags,FDF_WRITE)) - { - assert( FLAG_IS_CLEAR(fd->fd_Flags,FDF_IS_SOCKET) ); - - got_output = TRUE; - } - } - } - - if(got_input || got_output) - result++; - - if(file_read_fds != NULL && NOT got_input) - FD_CLR(i,file_read_fds); - - if(file_write_fds != NULL && NOT got_output) - FD_CLR(i,file_write_fds); - } - - if(result > 0) - break; - - if(timeout != NULL) - { - struct DateStamp now; - - PROFILE_OFF(); - DateStamp(&now); - PROFILE_ON(); - - if(CompareDates(&now,&stop_when) <= 0) - break; - } - - copy_fd_set(file_read_fds, backup_file_read_fds, num_file_used); - copy_fd_set(file_write_fds, backup_file_write_fds, num_file_used); - } - } - else - { - SHOWMSG("no files to worry about"); - } - } - - /* The descriptor sets remain unchanged in - * case of error. - */ - if(result >= 0) - { - SHOWMSG("remapping fd_sets"); - - __stdio_lock(); - - remap_descriptor_sets(socket_read_fds, total_socket_fd, file_read_fds, total_file_fd, read_fds, num_fds); - remap_descriptor_sets(socket_write_fds, total_socket_fd, file_write_fds, total_file_fd, write_fds, num_fds); - remap_descriptor_sets(socket_except_fds, total_socket_fd, NULL, 0, except_fds, num_fds); - - __stdio_unlock(); - } - - if(__check_abort_enabled) - __check_abort(); - - out: - - free_fd_set(socket_read_fds); - free_fd_set(socket_write_fds); - free_fd_set(socket_except_fds); - - free_fd_set(file_read_fds); - free_fd_set(file_write_fds); - - free_fd_set(backup_socket_read_fds); - free_fd_set(backup_socket_write_fds); - free_fd_set(backup_socket_except_fds); - - free_fd_set(backup_file_read_fds); - free_fd_set(backup_file_write_fds); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_send.c b/library/socket_send.c deleted file mode 100644 index 0241b55..0000000 --- a/library/socket_send.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * $Id: socket_send.c,v 1.7 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -send(int sockfd,const void *buff,size_t nbytes,int flags) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWPOINTER(buff); - SHOWVALUE(nbytes); - SHOWVALUE(flags); - - assert( (int)nbytes >= 0 ); - assert( buff != NULL ); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(buff == NULL) - { - SHOWMSG("invalid buffer parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - PROFILE_OFF(); - result = __send((LONG)fd->fd_DefaultFile,(void *)buff,(LONG)nbytes,flags); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_sendmsg.c b/library/socket_sendmsg.c deleted file mode 100644 index 634a090..0000000 --- a/library/socket_sendmsg.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Id: socket_sendmsg.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -sendmsg(int sockfd,struct msghdr *msg,int flags) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWPOINTER(msg); - SHOWVALUE(flags); - - assert( msg != NULL ); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(msg == NULL) - { - SHOWMSG("invalid msg parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - PROFILE_OFF(); - result = __sendmsg((LONG)fd->fd_DefaultFile,msg,flags); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_sendto.c b/library/socket_sendto.c deleted file mode 100644 index 06b504b..0000000 --- a/library/socket_sendto.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * $Id: socket_sendto.c,v 1.8 2005-06-20 07:43:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -sendto(int sockfd,const void *buff,int len,int flags,struct sockaddr *to,socklen_t tolen) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWPOINTER(buff); - SHOWVALUE(len); - SHOWVALUE(flags); - SHOWPOINTER(to); - SHOWVALUE(tolen); - - assert( buff != NULL && to != NULL ); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(buff == NULL || to == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - PROFILE_OFF(); - result = __sendto((LONG)fd->fd_DefaultFile,(void *)buff,len,flags,to,tolen); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_setsockopt.c b/library/socket_setsockopt.c deleted file mode 100644 index b822b8c..0000000 --- a/library/socket_setsockopt.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * $Id: socket_setsockopt.c,v 1.8 2005-06-20 07:43:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -setsockopt(int sockfd,int level,int optname,const void *optval,socklen_t optlen) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWVALUE(level); - SHOWVALUE(optname); - SHOWPOINTER(optval); - SHOWVALUE(optlen); - - assert( optval != NULL ); - assert(__SocketBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(optval == NULL) - { - SHOWMSG("invalid optval parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - PROFILE_OFF(); - result = __setsockopt((LONG)fd->fd_DefaultFile,level,optname,(void *)optval,optlen); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_shutdown.c b/library/socket_shutdown.c deleted file mode 100644 index a9ebf65..0000000 --- a/library/socket_shutdown.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * $Id: socket_shutdown.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -shutdown(int sockfd, int how) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(sockfd); - SHOWVALUE(how); - - assert(__SocketBase != NULL); - - assert( sockfd >= 0 && sockfd < __num_fd ); - assert( __fd[sockfd] != NULL ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IN_USE) ); - assert( FLAG_IS_SET(__fd[sockfd]->fd_Flags,FDF_IS_SOCKET) ); - - fd = __get_file_descriptor_socket(sockfd); - if(fd == NULL) - goto out; - - PROFILE_OFF(); - result = __shutdown((LONG)fd->fd_DefaultFile,how); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/socket_socket.c b/library/socket_socket.c deleted file mode 100644 index 858252b..0000000 --- a/library/socket_socket.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * $Id: socket_socket.c,v 1.9 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(SOCKET_SUPPORT) - -/****************************************************************************/ - -#ifndef _SOCKET_HEADERS_H -#include "socket_headers.h" -#endif /* _SOCKET_HEADERS_H */ - -/****************************************************************************/ - -int -socket(int domain,int type,int protocol) -{ - struct SignalSemaphore * lock = NULL; - int result = ERROR; - struct fd * fd; - int fd_slot_number; - LONG socket_fd; - - ENTER(); - - SHOWVALUE(domain); - SHOWVALUE(type); - SHOWVALUE(protocol); - - __stdio_lock(); - - fd_slot_number = __find_vacant_fd_entry(); - if(fd_slot_number < 0) - { - if(__grow_fd_table(0) < 0) - { - SHOWMSG("couldn't find a vacant fd slot and no memory to create one"); - goto out; - } - - fd_slot_number = __find_vacant_fd_entry(); - assert( fd_slot_number >= 0 ); - } - - #if defined(__THREAD_SAFE) - { - lock = __create_semaphore(); - if(lock == NULL) - { - __set_errno(ENOMEM); - goto out; - } - } - #endif /* __THREAD_SAFE */ - - PROFILE_OFF(); - socket_fd = __socket(domain,type,protocol); - PROFILE_ON(); - - if(socket_fd < 0) - { - SHOWMSG("could not create socket"); - goto out; - } - - fd = __fd[fd_slot_number]; - - __initialize_fd(fd,__socket_hook_entry,(BPTR)socket_fd,FDF_IN_USE | FDF_IS_SOCKET | FDF_READ | FDF_WRITE,lock); - - lock = NULL; - - result = fd_slot_number; - - out: - - __stdio_unlock(); - - #if defined(__THREAD_SAFE) - { - __delete_semaphore(lock); - } - #endif /* __THREAD_SAFE */ - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* SOCKET_SUPPORT */ diff --git a/library/stack.lib_rev.c b/library/stack.lib_rev.c deleted file mode 100644 index 7ee04bf..0000000 --- a/library/stack.lib_rev.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * $Id: stack.lib_rev.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 "stack.lib_rev.h" - -/****************************************************************************/ - -char __stack_lib_version[] = VERSTAG; diff --git a/library/stack.lib_rev.h b/library/stack.lib_rev.h deleted file mode 100644 index d1481cc..0000000 --- a/library/stack.lib_rev.h +++ /dev/null @@ -1,6 +0,0 @@ -#define VERSION 1 -#define REVISION 193 -#define DATE "4.6.2005" -#define VERS "stack.lib 1.193" -#define VSTRING "stack.lib 1.193 (4.6.2005)\r\n" -#define VERSTAG "\0$VER: stack.lib 1.193 (4.6.2005)" diff --git a/library/stack.lib_rev.rev b/library/stack.lib_rev.rev deleted file mode 100644 index 2455a46..0000000 --- a/library/stack.lib_rev.rev +++ /dev/null @@ -1 +0,0 @@ -193 diff --git a/library/startup.c b/library/startup.c deleted file mode 100644 index 2d56905..0000000 --- a/library/startup.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id: startup.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -/****************************************************************************/ - -extern int _main(void); - -/****************************************************************************/ - -int -startup(void) -{ - int result; - - result = _main(); - - return(result); -} diff --git a/library/stat_chmod.c b/library/stat_chmod.c deleted file mode 100644 index 684dc29..0000000 --- a/library/stat_chmod.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * $Id: stat_chmod.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STAT_HEADERS_H -#include "stat_headers.h" -#endif /* _STAT_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -chmod(const char * path_name, mode_t mode) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info path_name_nti; - #endif /* UNIX_PATH_SEMANTICS */ - ULONG protection; - LONG status; - int result = ERROR; - - ENTER(); - - SHOWSTRING(path_name); - SHOWVALUE(mode); - - assert( path_name != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(path_name == NULL) - { - SHOWMSG("invalid path parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0) - goto out; - - if(path_name_nti.is_root) - { - __set_errno(EACCES); - goto out; - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - protection = 0; - - if(FLAG_IS_SET(mode,S_IRUSR)) - SET_FLAG(protection,FIBF_READ); - - if(FLAG_IS_SET(mode,S_IWUSR)) - { - SET_FLAG(protection,FIBF_WRITE); - SET_FLAG(protection,FIBF_DELETE); - } - - if(FLAG_IS_SET(mode,S_IXUSR)) - SET_FLAG(protection,FIBF_EXECUTE); - - if(FLAG_IS_SET(mode,S_IRGRP)) - SET_FLAG(protection,FIBF_GRP_READ); - - if(FLAG_IS_SET(mode,S_IWGRP)) - { - SET_FLAG(protection,FIBF_GRP_WRITE); - SET_FLAG(protection,FIBF_GRP_DELETE); - } - - if(FLAG_IS_SET(mode,S_IXGRP)) - SET_FLAG(protection,FIBF_GRP_EXECUTE); - - if(FLAG_IS_SET(mode,S_IROTH)) - SET_FLAG(protection,FIBF_OTR_READ); - - if(FLAG_IS_SET(mode,S_IWOTH)) - { - SET_FLAG(protection,FIBF_OTR_WRITE); - SET_FLAG(protection,FIBF_OTR_DELETE); - } - - if(FLAG_IS_SET(mode,S_IXOTH)) - SET_FLAG(protection,FIBF_OTR_EXECUTE); - - SHOWSTRING(path_name); - SHOWVALUE(protection); - - PROFILE_OFF(); - status = SetProtection((STRPTR)path_name,(LONG)(protection ^ (FIBF_READ|FIBF_WRITE|FIBF_EXECUTE|FIBF_DELETE))); - PROFILE_ON(); - - if(status == DOSFALSE) - { - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/stat_convertfileinfo.c b/library/stat_convertfileinfo.c deleted file mode 100644 index ba1e92c..0000000 --- a/library/stat_convertfileinfo.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * $Id: stat_convertfileinfo.c,v 1.7 2005-04-02 13:25:53 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STAT_HEADERS_H -#include "stat_headers.h" -#endif /* _STAT_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -#ifndef _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -void -__convert_file_info_to_stat( - const struct MsgPort * file_system, - const struct FileInfoBlock * fib, - struct stat * st) -{ - time_t mtime; - mode_t mode; - ULONG flags; - - ENTER(); - - assert( fib != NULL && st != NULL ); - - SHOWVALUE(fib->fib_DiskKey); - SHOWVALUE(fib->fib_DirEntryType); - SHOWSTRING(fib->fib_FileName); - SHOWVALUE(fib->fib_Protection); - SHOWVALUE(fib->fib_EntryType); - SHOWVALUE(fib->fib_Size); - SHOWVALUE(fib->fib_NumBlocks); - SHOWVALUE(fib->fib_Date.ds_Days); - SHOWVALUE(fib->fib_Date.ds_Minute); - SHOWVALUE(fib->fib_Date.ds_Tick); - SHOWSTRING(fib->fib_Comment); - SHOWVALUE(fib->fib_OwnerUID); - SHOWVALUE(fib->fib_OwnerGID); - - memset(st,0,sizeof(*st)); - - flags = fib->fib_Protection ^ (FIBF_READ|FIBF_WRITE|FIBF_EXECUTE|FIBF_DELETE); - - if(fib->fib_DirEntryType == ST_PIPEFILE) - mode = S_IFIFO; - else if (fib->fib_DirEntryType == ST_SOCKET) - mode = S_IFSOCK; - else if (fib->fib_DirEntryType == ST_CONSOLE) - mode = S_IFCHR; - else if (fib->fib_DirEntryType < 0) - mode = S_IFREG; - else - mode = S_IFDIR; - - if(FLAG_IS_SET(flags,FIBF_READ)) - SET_FLAG(mode,S_IRUSR); - - if(FLAG_IS_SET(flags,FIBF_WRITE) && FLAG_IS_SET(flags,FIBF_DELETE)) - SET_FLAG(mode,S_IWUSR); - - if(FLAG_IS_SET(flags,FIBF_EXECUTE)) - SET_FLAG(mode,S_IXUSR); - - if(FLAG_IS_SET(flags,FIBF_GRP_READ)) - SET_FLAG(mode,S_IRGRP); - - if(FLAG_IS_SET(flags,FIBF_GRP_WRITE) && FLAG_IS_SET(flags,FIBF_GRP_DELETE)) - SET_FLAG(mode,S_IWGRP); - - if(FLAG_IS_SET(flags,FIBF_GRP_EXECUTE)) - SET_FLAG(mode,S_IXGRP); - - if(FLAG_IS_SET(flags,FIBF_OTR_READ)) - SET_FLAG(mode,S_IROTH); - - if(FLAG_IS_SET(flags,FIBF_OTR_WRITE) && FLAG_IS_SET(flags,FIBF_OTR_DELETE)) - SET_FLAG(mode,S_IWOTH); - - if(FLAG_IS_SET(flags,FIBF_OTR_EXECUTE)) - SET_FLAG(mode,S_IXOTH); - - mtime = __convert_datestamp_to_time(&fib->fib_Date); - - if(fib->fib_DirEntryType < 0) - { - st->st_nlink = 1; - st->st_size = fib->fib_Size; - } - else - { - st->st_nlink = 2; - } - - st->st_ino = fib->fib_DiskKey; - st->st_dev = (dev_t)file_system; - st->st_mode = mode; - st->st_mtime = mtime; - st->st_atime = mtime; - st->st_ctime = mtime; - st->st_uid = fib->fib_OwnerUID; - st->st_gid = fib->fib_OwnerGID; - st->st_blksize = 512; - st->st_blocks = (st->st_size + st->st_blksize-1) / st->st_blksize; - - SHOWVALUE(st->st_nlink); - SHOWVALUE(st->st_size); - SHOWVALUE(st->st_ino); - SHOWVALUE(st->st_dev); - SHOWVALUE(st->st_mode); - SHOWVALUE(st->st_mtime); - SHOWVALUE(st->st_atime); - SHOWVALUE(st->st_ctime); - SHOWVALUE(st->st_uid); - SHOWVALUE(st->st_gid); - SHOWVALUE(st->st_blksize); - SHOWVALUE(st->st_blocks); - - LEAVE(); -} diff --git a/library/stat_fchmod.c b/library/stat_fchmod.c deleted file mode 100644 index f97e21d..0000000 --- a/library/stat_fchmod.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * $Id: stat_fchmod.c,v 1.10 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STAT_HEADERS_H -#include "stat_headers.h" -#endif /* _STAT_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -fchmod(int file_descriptor, mode_t mode) -{ - D_S(struct FileInfoBlock,fib); - ULONG protection; - BPTR parent_dir = ZERO; - BPTR old_current_dir = ZERO; - BOOL current_dir_changed = FALSE; - int result = ERROR; - struct fd * fd = NULL; - LONG success; - - ENTER(); - - SHOWVALUE(file_descriptor); - SHOWVALUE(mode); - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - if(__check_abort_enabled) - __check_abort(); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - __fd_lock(fd); - - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET)) - { - __set_errno(EINVAL); - goto out; - } - - if(FLAG_IS_SET(fd->fd_Flags,FDF_STDIO)) - { - __set_errno(EBADF); - goto out; - } - - protection = 0; - - if(FLAG_IS_SET(mode,S_IRUSR)) - SET_FLAG(protection,FIBF_READ); - - if(FLAG_IS_SET(mode,S_IWUSR)) - { - SET_FLAG(protection,FIBF_WRITE); - SET_FLAG(protection,FIBF_DELETE); - } - - if(FLAG_IS_SET(mode,S_IXUSR)) - SET_FLAG(protection,FIBF_EXECUTE); - - if(FLAG_IS_SET(mode,S_IRGRP)) - SET_FLAG(protection,FIBF_GRP_READ); - - if(FLAG_IS_SET(mode,S_IWGRP)) - { - SET_FLAG(protection,FIBF_GRP_WRITE); - SET_FLAG(protection,FIBF_GRP_DELETE); - } - - if(FLAG_IS_SET(mode,S_IXGRP)) - SET_FLAG(protection,FIBF_GRP_EXECUTE); - - if(FLAG_IS_SET(mode,S_IROTH)) - SET_FLAG(protection,FIBF_OTR_READ); - - if(FLAG_IS_SET(mode,S_IWOTH)) - { - SET_FLAG(protection,FIBF_OTR_WRITE); - SET_FLAG(protection,FIBF_OTR_DELETE); - } - - if(FLAG_IS_SET(mode,S_IXOTH)) - SET_FLAG(protection,FIBF_OTR_EXECUTE); - - PROFILE_OFF(); - parent_dir = __safe_parent_of_file_handle(fd->fd_DefaultFile); - PROFILE_ON(); - - if(parent_dir == ZERO) - { - SHOWMSG("couldn't find parent directory"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - PROFILE_OFF(); - success = __safe_examine_file_handle(fd->fd_DefaultFile,fib); - PROFILE_ON(); - - if(NO success) - { - SHOWMSG("could not obtain file name"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - old_current_dir = CurrentDir(parent_dir); - current_dir_changed = TRUE; - - PROFILE_OFF(); - success = SetProtection(fib->fib_FileName,protection ^ (FIBF_READ|FIBF_WRITE|FIBF_EXECUTE|FIBF_DELETE)); - PROFILE_ON(); - - if(NO success) - { - SHOWMSG("could not change protection bits"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - result = OK; - - out: - - __fd_unlock(fd); - - if(current_dir_changed) - CurrentDir(old_current_dir); - - UnLock(parent_dir); - - RETURN(result); - return(result); -} diff --git a/library/stat_fstat.c b/library/stat_fstat.c deleted file mode 100644 index 6eaccba..0000000 --- a/library/stat_fstat.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * $Id: stat_fstat.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STAT_HEADERS_H -#include "stat_headers.h" -#endif /* _STAT_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -fstat(int file_descriptor, struct stat * buffer) -{ - struct file_action_message fam; - D_S(struct FileInfoBlock,fib); - int result = ERROR; - struct fd * fd; - - ENTER(); - - SHOWVALUE(file_descriptor); - SHOWPOINTER(buffer); - - assert( buffer != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(buffer == NULL) - { - SHOWMSG("invalid buffer parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - SHOWMSG("calling the hook"); - - fam.fam_Action = file_action_examine; - fam.fam_FileInfo = fib; - fam.fam_FileSystem = NULL; - - assert( fd->fd_Action != NULL ); - - if((*fd->fd_Action)(fd,&fam) < 0) - { - __set_errno(fam.fam_Error); - goto out; - } - - __convert_file_info_to_stat(fam.fam_FileSystem,fib,buffer); - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/stat_headers.h b/library/stat_headers.h deleted file mode 100644 index 4b2cf44..0000000 --- a/library/stat_headers.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * $Id: stat_headers.h,v 1.5 2005-03-18 12:38:23 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STAT_HEADERS_H -#define _STAT_HEADERS_H - -/****************************************************************************/ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_H */ - -/****************************************************************************/ - -extern mode_t NOCOMMON __current_umask; - -/****************************************************************************/ - -extern void __convert_file_info_to_stat(const struct MsgPort * file_system,const struct FileInfoBlock * fib,struct stat * st); - -/****************************************************************************/ - -#endif /* _STAT_HEADERS_H */ diff --git a/library/stat_lstat.c b/library/stat_lstat.c deleted file mode 100644 index 2a7f375..0000000 --- a/library/stat_lstat.c +++ /dev/null @@ -1,302 +0,0 @@ -/* - * $Id: stat_lstat.c,v 1.11 2005-06-21 15:01:08 tfrieden Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STAT_HEADERS_H -#include "stat_headers.h" -#endif /* _STAT_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -#ifndef _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* - * lstat_lock(): An implementation of Lock() which remembers whether or - * not it resolved soft links. - * - * Unfortunately is is limited to 255 character names. - */ - -static BPTR -lstat_lock(const char *name,const int mode,int * link_length) -{ - D_S(struct bcpl_name,bname); - const size_t name_size = sizeof(bname->name); - char * new_name = NULL; - struct DevProc * dvp = NULL; - BPTR lock = ZERO; - size_t name_len; - LONG error; - - assert( name != NULL && link_length != NULL ); - - name_len = strlen(name); - if(name_len >= name_size) - { - SetIoErr(ERROR_LINE_TOO_LONG); - goto out; - } - - /* Convert the name into a BCPL string. */ - bname->name[0] = name_len; - memmove(&bname->name[1],name,name_len); - - while(TRUE) - { - /* Get a handle on the device, volume or assignment name in the path. */ - dvp = GetDeviceProc((STRPTR)name,dvp); - if(dvp == NULL) - goto out; - - /* Try to obtain a lock on the object. */ - lock = DoPkt(dvp->dvp_Port,ACTION_LOCATE_OBJECT,dvp->dvp_Lock,MKBADDR(bname),mode,0,0); - if(lock != ZERO) - break; - - error = IoErr(); - - if(error == ERROR_OBJECT_NOT_FOUND) - { - /* If this is part of a multi-volume assignment, try the next part. */ - if(FLAG_IS_SET(dvp->dvp_Flags,DVPF_ASSIGN)) - continue; - - /* Not much we can do here... */ - break; - } - else if (error == ERROR_IS_SOFT_LINK) - { - LONG result; - - /* For soft link resolution we need a temporary buffer to - let the file system store the resolved path name in. */ - new_name = malloc(name_size); - if(new_name == NULL) - { - SetIoErr(ERROR_NO_FREE_STORE); - goto out; - } - - /* Now ask the file system to resolve the entire path. */ - result = ReadLink(dvp->dvp_Port,dvp->dvp_Lock,(STRPTR)name,(STRPTR)new_name,name_size); - - if(result < 0) - { - /* This will return either -1 (resolution error) or -2 - (buffer too small). We regard both as trouble. */ - SetIoErr(ERROR_INVALID_COMPONENT_NAME); - goto out; - } - - assert( result > 0 ); - - /* Remember the length of the link name. */ - (*link_length) = result; - - /* Finished for now. */ - break; - } - else - { - /* Some other error; ask if the user wants to have another go at it. */ - if(ErrorReport(error,REPORT_LOCK,dvp->dvp_Lock,dvp->dvp_Port) != 0) - break; - } - - /* Retry the lookup. */ - FreeDeviceProc(dvp); - dvp = NULL; - } - - out: - - error = IoErr(); - - if(new_name != NULL) - free(new_name); - - FreeDeviceProc(dvp); - - SetIoErr(error); - - return(lock); -} - -int -lstat(const char * path_name, struct stat * st) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info path_name_nti; - #endif /* UNIX_PATH_SEMANTICS */ - D_S(struct FileInfoBlock,fib); - struct FileLock * fl; - int result = ERROR; - LONG status; - BPTR file_lock = ZERO; - int link_length = -1; - - ENTER(); - - SHOWSTRING(path_name); - SHOWPOINTER(st); - - assert( path_name != NULL && st != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(path_name == NULL || st == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0) - goto out; - - /* The pseudo root directory is a very special case indeed. - We make up some pseudo data for it. */ - if(path_name_nti.is_root) - { - time_t mtime; - - SHOWMSG("setting up the root directory info"); - - memset(st,0,sizeof(*st)); - - time(&mtime); - - st->st_mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; - st->st_mtime = mtime; - st->st_atime = mtime; - st->st_ctime = mtime; - st->st_nlink = 2; - st->st_blksize = 512; - - result = OK; - - goto out; - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - D(("trying to get a lock on '%s'",path_name)); - - PROFILE_OFF(); - file_lock = lstat_lock(path_name,SHARED_LOCK,&link_length); - PROFILE_ON(); - - if(file_lock == ZERO && link_length < 0) - { - SHOWMSG("that didn't work"); - - __set_errno(__translate_access_io_error_to_errno(IoErr())); - goto out; - } - - if(link_length > 0) - { - time_t mtime; - - /* Build a dummy stat for the link. */ - - SHOWMSG("Creating stat info for link."); - - memset(st,0,sizeof(*st)); - - time(&mtime); - - st->st_mode = S_IFLNK | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; - st->st_dev = (ULONG)DeviceProc((STRPTR)path_name); - st->st_size = link_length; - st->st_mtime = mtime; - st->st_atime = mtime; - st->st_ctime = mtime; - st->st_nlink = 1; - } - else - { - PROFILE_OFF(); - status = Examine(file_lock,fib); - PROFILE_ON(); - - if(status == DOSFALSE) - { - SHOWMSG("couldn't examine it"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - fl = BADDR(file_lock); - - __convert_file_info_to_stat(fl->fl_Task,fib,st); - } - - result = OK; - - out: - - PROFILE_OFF(); - UnLock(file_lock); - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/stat_mkdir.c b/library/stat_mkdir.c deleted file mode 100644 index 66cf6f2..0000000 --- a/library/stat_mkdir.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * $Id: stat_mkdir.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STAT_HEADERS_H -#include "stat_headers.h" -#endif /* _STAT_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -mkdir(const char * path_name, mode_t mode) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info path_name_nti; - #endif /* UNIX_PATH_SEMANTICS */ - ULONG protection; - int result = ERROR; - BPTR dir_lock; - - ENTER(); - - SHOWSTRING(path_name); - SHOWVALUE(mode); - - assert( path_name != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(path_name == NULL) - { - SHOWMSG("invalid path name parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0) - goto out; - - if(path_name_nti.is_root) - { - __set_errno(EACCES); - goto out; - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - D(("trying to create '%s'",path_name)); - - PROFILE_OFF(); - dir_lock = CreateDir((STRPTR)path_name); - PROFILE_ON(); - - if(dir_lock == ZERO) - { - SHOWMSG("that didn't work"); - - __set_errno(__translate_access_io_error_to_errno(IoErr())); - goto out; - } - - PROFILE_OFF(); - UnLock(dir_lock); - PROFILE_ON(); - - protection = 0; - - if(FLAG_IS_SET(mode,S_IRUSR)) - SET_FLAG(protection,FIBF_READ); - - if(FLAG_IS_SET(mode,S_IWUSR)) - { - SET_FLAG(protection,FIBF_WRITE); - SET_FLAG(protection,FIBF_DELETE); - } - - if(FLAG_IS_SET(mode,S_IXUSR)) - SET_FLAG(protection,FIBF_EXECUTE); - - if(FLAG_IS_SET(mode,S_IRGRP)) - SET_FLAG(protection,FIBF_GRP_READ); - - if(FLAG_IS_SET(mode,S_IWGRP)) - { - SET_FLAG(protection,FIBF_GRP_WRITE); - SET_FLAG(protection,FIBF_GRP_DELETE); - } - - if(FLAG_IS_SET(mode,S_IXGRP)) - SET_FLAG(protection,FIBF_GRP_EXECUTE); - - if(FLAG_IS_SET(mode,S_IROTH)) - SET_FLAG(protection,FIBF_OTR_READ); - - if(FLAG_IS_SET(mode,S_IWOTH)) - { - SET_FLAG(protection,FIBF_OTR_WRITE); - SET_FLAG(protection,FIBF_OTR_DELETE); - } - - if(FLAG_IS_SET(mode,S_IXOTH)) - SET_FLAG(protection,FIBF_OTR_EXECUTE); - - SHOWSTRING(path_name); - SHOWVALUE(protection); - - PROFILE_OFF(); - SetProtection((STRPTR)path_name,(LONG)(protection ^ (FIBF_READ|FIBF_WRITE|FIBF_EXECUTE|FIBF_DELETE))); - PROFILE_ON(); - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/stat_rmdir.c b/library/stat_rmdir.c deleted file mode 100644 index cb0ff56..0000000 --- a/library/stat_rmdir.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * $Id: stat_rmdir.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STAT_HEADERS_H -#include "stat_headers.h" -#endif /* _STAT_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -rmdir(const char * path_name) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info path_name_nti; - #endif /* UNIX_PATH_SEMANTICS */ - D_S(struct FileInfoBlock,fib); - BPTR dir_lock = ZERO; - int result = ERROR; - LONG status; - - 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 path name parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0) - goto out; - - if(path_name_nti.is_root) - { - __set_errno(EACCES); - goto out; - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - D(("trying to get a lock on '%s'",path_name)); - - PROFILE_OFF(); - dir_lock = Lock((STRPTR)path_name,SHARED_LOCK); - PROFILE_ON(); - - if(dir_lock == ZERO) - { - SHOWMSG("that didn't work"); - - __set_errno(__translate_access_io_error_to_errno(IoErr())); - goto out; - } - - PROFILE_OFF(); - status = Examine(dir_lock,fib); - PROFILE_ON(); - - if(status == DOSFALSE) - { - SHOWMSG("couldn't examine it"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - if(fib->fib_DirEntryType < 0) - { - SHOWMSG("this is not a directory"); - - __set_errno(ENOTDIR); - goto out; - } - - PROFILE_OFF(); - UnLock(dir_lock); - PROFILE_ON(); - - dir_lock = ZERO; - - SHOWMSG("trying to delete it"); - - PROFILE_OFF(); - status = DeleteFile((STRPTR)path_name); - PROFILE_ON(); - - if(status == DOSFALSE) - { - SHOWMSG("that didn't work"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - result = OK; - - out: - - PROFILE_OFF(); - UnLock(dir_lock); - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/stat_stat.c b/library/stat_stat.c deleted file mode 100644 index fb83c1b..0000000 --- a/library/stat_stat.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * $Id: stat_stat.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STAT_HEADERS_H -#include "stat_headers.h" -#endif /* _STAT_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -#ifndef _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -stat(const char * path_name, struct stat * st) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info path_name_nti; - #endif /* UNIX_PATH_SEMANTICS */ - D_S(struct FileInfoBlock,fib); - struct FileLock * fl; - int result = ERROR; - LONG status; - BPTR file_lock = ZERO; - - ENTER(); - - SHOWSTRING(path_name); - SHOWPOINTER(st); - - assert( path_name != NULL && st != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(path_name == NULL || st == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0) - goto out; - - /* The pseudo root directory is a very special case indeed. - * We make up some pseudo data for it. - */ - if(path_name_nti.is_root) - { - struct DateStamp ds; - time_t mtime; - - SHOWMSG("seting up the root directory info"); - - memset(st,0,sizeof(*st)); - - PROFILE_OFF(); - DateStamp(&ds); - PROFILE_ON(); - - mtime = __convert_datestamp_to_time(&ds); - - st->st_mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; - st->st_mtime = mtime; - st->st_atime = mtime; - st->st_ctime = mtime; - st->st_nlink = 2; - st->st_blksize = 512; - - result = OK; - - goto out; - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - D(("trying to get a lock on '%s'",path_name)); - - PROFILE_OFF(); - file_lock = Lock((STRPTR)path_name,SHARED_LOCK); - PROFILE_ON(); - - if(file_lock == ZERO) - { - SHOWMSG("that didn't work"); - - __set_errno(__translate_access_io_error_to_errno(IoErr())); - goto out; - } - - PROFILE_OFF(); - status = Examine(file_lock,fib); - PROFILE_ON(); - - if(status == DOSFALSE) - { - SHOWMSG("couldn't examine it"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - fl = BADDR(file_lock); - - __convert_file_info_to_stat(fl->fl_Task,fib,st); - - result = OK; - - out: - - PROFILE_OFF(); - UnLock(file_lock); - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/stat_umask.c b/library/stat_umask.c deleted file mode 100644 index 6a69a0e..0000000 --- a/library/stat_umask.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * $Id: stat_umask.c,v 1.6 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STAT_HEADERS_H -#include "stat_headers.h" -#endif /* _STAT_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -mode_t NOCOMMON __current_umask = S_IWGRP | S_IWOTH; - -/****************************************************************************/ - -#if defined(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -mode_t -umask(mode_t new_mask) -{ - mode_t result; - - ENTER(); - - SHOWVALUE(new_mask); - - assert(__UserGroupBase != NULL); - - PROFILE_OFF(); - result = __getumask(); - PROFILE_ON(); - - __current_umask = new_mask & (S_IRWXU | S_IRWXG | S_IRWXO); - - __umask(__current_umask); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -mode_t -umask(mode_t new_mask) -{ - mode_t result; - - ENTER(); - - SHOWVALUE(new_mask); - - result = __current_umask; - - __current_umask = new_mask & (S_IRWXU | S_IRWXG | S_IRWXO); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/stdio_asprintf.c b/library/stdio_asprintf.c deleted file mode 100644 index bc58379..0000000 --- a/library/stdio_asprintf.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * $Id: stdio_asprintf.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -asprintf(char **ret, const char *format, ...) -{ - int result = EOF; - va_list arg; - - ENTER(); - - SHOWPOINTER(ret); - SHOWSTRING(format); - - assert( ret != NULL && format != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(ret == NULL || format == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - va_start(arg,format); - result = vasprintf(ret,format,arg); - va_end(arg); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_clearerr.c b/library/stdio_clearerr.c deleted file mode 100644 index 78abfd3..0000000 --- a/library/stdio_clearerr.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * $Id: stdio_clearerr.c,v 1.4 2005-02-27 18:09:10 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#undef clearerr - -/****************************************************************************/ - -void -clearerr(FILE *stream) -{ - struct iob * file = (struct iob *)stream; - - ENTER(); - - SHOWPOINTER(stream); - - assert( stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - - flockfile(stream); - - CLEAR_FLAG(file->iob_Flags,IOBF_ERROR); - CLEAR_FLAG(file->iob_Flags,IOBF_EOF_REACHED); - - funlockfile(stream); - - out: - - LEAVE(); -} diff --git a/library/stdio_ctermid.c b/library/stdio_ctermid.c deleted file mode 100755 index 9b07d39..0000000 --- a/library/stdio_ctermid.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id: stdio_ctermid.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -char * -ctermid(char *buf) -{ - static char cname[] = "CONSOLE:"; - - if(buf != NULL) - strcpy(buf,cname); - else - buf = cname; - - return(buf); -} diff --git a/library/stdio_dropiobreadbuffer.c b/library/stdio_dropiobreadbuffer.c deleted file mode 100644 index bdea43e..0000000 --- a/library/stdio_dropiobreadbuffer.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * $Id: stdio_dropiobreadbuffer.c,v 1.8 2005-04-24 09:53:11 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -/* This would otherwise generate far too much (useless) debug output. */ -#ifdef DEBUG -#undef DEBUG -#endif /* DEBUG */ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -__drop_iob_read_buffer(struct iob * file) -{ - int result = OK; - - ENTER(); - - SHOWPOINTER(file); - - assert( file != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - if(FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE)) - { - CLEAR_FLAG(file->iob_Flags,IOBF_EOF_REACHED); - - if(__iob_read_buffer_is_valid(file)) - { - LONG num_unread_bytes; - - num_unread_bytes = __iob_num_unread_bytes(file); - - D(("%ld bytes are to be dropped",num_unread_bytes)); - - if(num_unread_bytes > 0) - { - struct file_action_message fam; - LONG position; - - SHOWMSG("calling the action function"); - - fam.fam_Action = file_action_seek; - fam.fam_Offset = -num_unread_bytes; - fam.fam_Mode = SEEK_CUR; - - assert( file->iob_Action != NULL ); - - /* Note that a return value of -1 (= SEEK_ERROR) may be a - valid file position in files larger than 2 GBytes. Just - to be sure, we therefore also check the secondary error - to verify that what could be a file position is really - an error indication. */ - position = (*file->iob_Action)(file,&fam); - if(position == SEEK_ERROR && fam.fam_Error != OK) - { - SHOWMSG("that didn't work"); - - result = ERROR; - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(fam.fam_Error); - - goto out; - } - - /* If this is a valid file position, clear 'errno' so that - it cannot be mistaken for an error. */ - if(position < 0) - __set_errno(OK); - } - - file->iob_BufferReadBytes = 0; - file->iob_BufferPosition = 0; - } - } - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_duplicate_fd.c b/library/stdio_duplicate_fd.c deleted file mode 100644 index 46cbb8c..0000000 --- a/library/stdio_duplicate_fd.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * $Id: stdio_duplicate_fd.c,v 1.4 2005-02-28 13:22:53 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -void -__duplicate_fd(struct fd * duplicate_fd,struct fd * original_fd) -{ - assert( duplicate_fd != NULL && original_fd != NULL ); - - __fd_lock(original_fd); - - /* Initialize the duplicate to match the original. */ - __initialize_fd(duplicate_fd,original_fd->fd_Action,original_fd->fd_DefaultFile,original_fd->fd_Flags,original_fd->fd_Lock); - - /* Figure out where the linked list of file descriptors associated - with this one starts. */ - if(original_fd->fd_Original != NULL) - duplicate_fd->fd_Original = original_fd->fd_Original; - else - duplicate_fd->fd_Original = original_fd; - - /* Add the duplicate at the beginning of the list. */ - duplicate_fd->fd_NextLink = duplicate_fd->fd_Original->fd_NextLink; - duplicate_fd->fd_Original->fd_NextLink = duplicate_fd; - - __fd_unlock(original_fd); -} diff --git a/library/stdio_examine_fh.c b/library/stdio_examine_fh.c deleted file mode 100644 index bea3505..0000000 --- a/library/stdio_examine_fh.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * $Id: stdio_examine_fh.c,v 1.1 2005-02-18 18:53:16 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -/* This is used in place of ExamineFH() in order to work around a bug in - * dos.library V40 and below: a "NIL:" file handle will crash the - * ExamineFH() function. - */ -LONG -__safe_examine_file_handle(BPTR file_handle,struct FileInfoBlock *fib) -{ - LONG result = DOSFALSE; - - assert( fib != NULL ); - - #ifndef __amigaos4__ - { - struct FileHandle * fh = (struct FileHandle *)BADDR(file_handle); - - if(fh == NULL || fh->fh_Type == NULL) - { - SetIoErr(ERROR_OBJECT_WRONG_TYPE); - goto out; - } - } - #endif /* __amigaos4__ */ - - PROFILE_OFF(); - result = ExamineFH(file_handle,fib); - PROFILE_ON(); - - out: - - return(result); -} diff --git a/library/stdio_fclose.c b/library/stdio_fclose.c deleted file mode 100644 index 37c9829..0000000 --- a/library/stdio_fclose.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * $Id: stdio_fclose.c,v 1.11 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -int -fclose(FILE *stream) -{ - struct iob * file = (struct iob *)stream; - struct file_action_message fam; - int result = OK; - - ENTER(); - - SHOWPOINTER(stream); - - assert( stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - SHOWMSG("invalid stream parameter"); - - result = EOF; - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_IN_USE)) - { - SHOWMSG("this file is not even in use"); - - result = EOF; - - __set_errno(EBADF); - goto out; - } - - /* Push back any buffered data to the stream. */ - if(__iob_write_buffer_is_valid(file) && __flush_iob_write_buffer(file) < 0) - result = EOF; - - /* Make sure that the stream is closed. */ - SHOWMSG("calling the action function"); - - fam.fam_Action = file_action_close; - - assert( file->iob_Action != NULL ); - - if((*file->iob_Action)(file,&fam) < 0 && result != EOF) - { - result = EOF; - - __set_errno(fam.fam_Error); - } - - /* Now that the file is closed and we are in fact - * dealing with a temporary file, delete that file. - */ - if(FLAG_IS_SET(file->iob_Flags,IOBF_TEMP)) - { - BPTR old_current_dir; - - SHOWMSG("this is a temporary file; deleting it"); - - assert( file->iob_TempFileName != NULL ); - - PROFILE_OFF(); - - old_current_dir = CurrentDir(file->iob_TempFileLock); - DeleteFile(file->iob_TempFileName); - CurrentDir(old_current_dir); - - UnLock(file->iob_TempFileLock); - - PROFILE_ON(); - - free(file->iob_TempFileName); - } - - /* Get rid of any custom file buffer allocated. */ - if(file->iob_CustomBuffer != NULL) - free(file->iob_CustomBuffer); - - #if defined(__THREAD_SAFE) - { - /* Free the lock semaphore now. */ - __delete_semaphore(file->iob_Lock); - } - #endif /* __THREAD_SAFE */ - - memset(file,0,sizeof(*file)); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_fdhookentry.c b/library/stdio_fdhookentry.c deleted file mode 100644 index 61245b7..0000000 --- a/library/stdio_fdhookentry.c +++ /dev/null @@ -1,652 +0,0 @@ -/* - * $Id: stdio_fdhookentry.c,v 1.30 2005-04-24 09:53:11 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -#ifndef _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -int -__fd_hook_entry( - struct fd * fd, - struct file_action_message * fam) -{ - D_S(struct FileInfoBlock,fib); - BOOL fib_is_valid = FALSE; - struct FileHandle * fh; - off_t current_position; - off_t new_position; - int new_mode; - char * buffer = NULL; - int result = EOF; - BOOL is_aliased; - BPTR file; - - ENTER(); - - assert( fam != NULL && fd != NULL ); - assert( __is_valid_fd(fd) ); - - /* Careful: file_action_close has to monkey with the file descriptor - table and therefore needs to obtain the stdio lock before - it locks this particular descriptor entry. */ - if(fam->fam_Action == file_action_close) - __stdio_lock(); - - __fd_lock(fd); - - #if defined(__THREAD_SAFE) - { - /* Check if this file should be dynamically bound to one of the - three standard I/O streams. */ - if(FLAG_IS_SET(fd->fd_Flags,FDF_STDIO)) - { - switch(fd->fd_DefaultFile) - { - case STDIN_FILENO: - - file = Input(); - break; - - case STDOUT_FILENO: - - file = Output(); - break; - - case STDERR_FILENO: - - #if defined(__amigaos4__) - { - file = ErrorOutput(); - } - #else - { - struct Process * this_process = (struct Process *)FindTask(NULL); - - file = this_process->pr_CES; - } - #endif /* __amigaos4__ */ - - /* The following is rather controversial; if the standard error stream - is unavailable, we default to reuse the standard output stream. This - is problematic if the standard output stream was redirected and should - not be the same as the standard error output stream. */ - if(file == ZERO) - file = Output(); - - break; - - default: - - file = ZERO; - break; - } - } - else - { - file = fd->fd_DefaultFile; - } - } - #else - { - file = fd->fd_DefaultFile; - } - #endif /* __THREAD_SAFE */ - - if(file == ZERO) - { - SHOWMSG("file is closed"); - - fam->fam_Error = EBADF; - goto out; - } - - switch(fam->fam_Action) - { - case file_action_read: - - SHOWMSG("file_action_read"); - - assert( fam->fam_Data != NULL ); - assert( fam->fam_Size > 0 ); - - D(("read %ld bytes from position %ld to 0x%08lx",fam->fam_Size,Seek(file,0,OFFSET_CURRENT),fam->fam_Data)); - - PROFILE_OFF(); - - result = Read(file,fam->fam_Data,fam->fam_Size); - - PROFILE_ON(); - - if(result == -1) - { - D(("read failed ioerr=%ld",IoErr())); - - fam->fam_Error = __translate_io_error_to_errno(IoErr()); - goto out; - } - - if(FLAG_IS_SET(fd->fd_Flags,FDF_CACHE_POSITION)) - fd->fd_Position += (ULONG)result; - - break; - - case file_action_write: - - SHOWMSG("file_action_write"); - - assert( fam->fam_Data != NULL ); - assert( fam->fam_Size > 0 ); - - if(FLAG_IS_SET(fd->fd_Flags,FDF_APPEND)) - { - LONG position; - - SHOWMSG("appending data"); - - PROFILE_OFF(); - - /* Make sure that if we get a value of -1 out of Seek() - to check whether this was an error or a numeric - overflow. */ - position = Seek(file,0,OFFSET_END); - if(position != SEEK_ERROR || IoErr() == OK) - { - if(FLAG_IS_SET(fd->fd_Flags,FDF_CACHE_POSITION)) - fd->fd_Position = Seek(file,0,OFFSET_CURRENT); - } - - PROFILE_ON(); - - if(position == SEEK_ERROR) - { - D(("seek to end of file failed; ioerr=%ld",IoErr())); - - fam->fam_Error = __translate_io_error_to_errno(IoErr()); - goto out; - } - } - - D(("write %ld bytes to position %ld from 0x%08lx",fam->fam_Size,Seek(file,0,OFFSET_CURRENT),fam->fam_Data)); - - PROFILE_OFF(); - - result = Write(file,fam->fam_Data,fam->fam_Size); - - PROFILE_ON(); - - if(result == -1) - { - D(("write failed ioerr=%ld",IoErr())); - - fam->fam_Error = __translate_io_error_to_errno(IoErr()); - goto out; - } - - if(FLAG_IS_SET(fd->fd_Flags,FDF_CACHE_POSITION)) - fd->fd_Position += (ULONG)result; - - break; - - case file_action_close: - - SHOWMSG("file_action_close"); - - /* The following is almost guaranteed not to fail. */ - result = OK; - - /* If this is an alias, just remove it. */ - is_aliased = __fd_is_aliased(fd); - if(is_aliased) - { - __remove_fd_alias(fd); - } - else if (FLAG_IS_CLEAR(fd->fd_Flags,FDF_STDIO)) - { - /* Should we reset this file into line buffered mode? */ - if(FLAG_IS_SET(fd->fd_Flags,FDF_NON_BLOCKING) && FLAG_IS_SET(fd->fd_Flags,FDF_IS_INTERACTIVE)) - SetMode(fd->fd_DefaultFile,DOSFALSE); - - /* Are we allowed to close this file? */ - if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_NO_CLOSE)) - { - BOOL name_and_path_valid = FALSE; - D_S(struct FileInfoBlock,fib); - BPTR parent_dir; - - memset(fib,0,sizeof(*fib)); - - /* Call a cleanup function, such as the one which - * releases locked records. - */ - if(fd->fd_Cleanup != NULL) - (*fd->fd_Cleanup)(fd); - - PROFILE_OFF(); - - parent_dir = __safe_parent_of_file_handle(fd->fd_DefaultFile); - if(parent_dir != ZERO) - { - if(__safe_examine_file_handle(fd->fd_DefaultFile,fib)) - name_and_path_valid = TRUE; - } - - if(CANNOT Close(fd->fd_DefaultFile)) - { - fam->fam_Error = __translate_io_error_to_errno(IoErr()); - - result = EOF; - } - - PROFILE_ON(); - - fd->fd_DefaultFile = ZERO; - - #if defined(UNIX_PATH_SEMANTICS) - { - DECLARE_UTILITYBASE(); - - assert( UtilityBase != NULL ); - - /* Now that we have closed this file, know where it is and what its - * name would be, check if we tried to unlink it earlier. If we did, - * we'll try to finish the job here and now. - */ - if(name_and_path_valid) - { - struct UnlinkNode * node; - struct UnlinkNode * uln_next; - struct UnlinkNode * uln; - BOOL file_deleted = FALSE; - - assert( __unlink_list.mlh_Head != NULL ); - - /* Check all files to be unlinked when this program exits. */ - for(uln = (struct UnlinkNode *)__unlink_list.mlh_Head ; - (uln_next = (struct UnlinkNode *)uln->uln_MinNode.mln_Succ) != NULL ; - uln = uln_next) - { - node = NULL; - - /* If the file name matches, check if the path matches, too. */ - if(Stricmp(FilePart(uln->uln_Name),fib->fib_FileName) == SAME) - { - BPTR old_dir; - BPTR node_lock; - BPTR path_lock = ZERO; - - PROFILE_OFF(); - - /* Try to get a lock on the file first, then move on to - * the directory it is stored in. - */ - old_dir = CurrentDir(uln->uln_Lock); - - node_lock = Lock(uln->uln_Name,SHARED_LOCK); - if(node_lock != ZERO) - { - path_lock = ParentDir(node_lock); - - UnLock(node_lock); - } - - CurrentDir(old_dir); - - /* If we found the file's parent directory, check if it matches - * the parent directory of the file we just closed. - */ - if(path_lock != ZERO) - { - if(SameLock(path_lock,parent_dir) == LOCK_SAME) - node = uln; - - UnLock(path_lock); - } - - PROFILE_ON(); - } - - /* If we found that this file was set up for deletion, - * delete it here and now. - */ - if(node != NULL) - { - if(NOT file_deleted) - { - BPTR old_dir; - - PROFILE_OFF(); - - old_dir = CurrentDir(parent_dir); - - if(DeleteFile(fib->fib_FileName)) - { - file_deleted = TRUE; - name_and_path_valid = FALSE; - } - - CurrentDir(old_dir); - - PROFILE_ON(); - } - - if(file_deleted) - { - Remove((struct Node *)node); - free(node); - } - } - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - if(FLAG_IS_SET(fd->fd_Flags,FDF_CREATED) && name_and_path_valid) - { - ULONG flags; - BPTR old_dir; - - PROFILE_OFF(); - - old_dir = CurrentDir(parent_dir); - - /* ZZZ we probably ought to observe the current umask settings. */ - - flags = fib->fib_Protection ^ (FIBF_READ|FIBF_WRITE|FIBF_EXECUTE|FIBF_DELETE); - - CLEAR_FLAG(flags,FIBF_EXECUTE); - CLEAR_FLAG(flags,FIBF_OTR_EXECUTE); - CLEAR_FLAG(flags,FIBF_GRP_EXECUTE); - - SetProtection(fib->fib_FileName,(LONG)(flags ^ (FIBF_READ|FIBF_WRITE|FIBF_EXECUTE|FIBF_DELETE))); - - CurrentDir(old_dir); - - PROFILE_ON(); - } - - PROFILE_OFF(); - UnLock(parent_dir); - PROFILE_ON(); - } - } - - __fd_unlock(fd); - - #if defined(__THREAD_SAFE) - { - /* Free the lock semaphore now. */ - if(NOT is_aliased) - __delete_semaphore(fd->fd_Lock); - } - #endif /* __THREAD_SAFE */ - - /* And that's the last for this file descriptor. */ - memset(fd,0,sizeof(*fd)); - - break; - - case file_action_seek: - - SHOWMSG("file_action_seek"); - - if(fam->fam_Mode == SEEK_CUR) - new_mode = OFFSET_CURRENT; - else if (fam->fam_Mode == SEEK_SET) - new_mode = OFFSET_BEGINNING; - else - new_mode = OFFSET_END; - - D(("seek to offset %ld, new_mode %ld; current position = %ld",fam->fam_Offset,new_mode,Seek(file,0,OFFSET_CURRENT))); - - if(FLAG_IS_SET(fd->fd_Flags,FDF_CACHE_POSITION)) - { - current_position = (off_t)fd->fd_Position; - } - else - { - LONG position; - - PROFILE_OFF(); - position = Seek(file,0,OFFSET_CURRENT); - PROFILE_ON(); - - /* Note that a return value of -1 (= SEEK_ERROR) may be a - valid file position in files larger than 2 GBytes. Just - to be sure, we therefore also check the secondary error - to verify that what could be a file position is really - an error indication. */ - if(position == SEEK_ERROR && IoErr() != OK) - { - fam->fam_Error = EBADF; - goto out; - } - - current_position = (off_t)position; - } - - new_position = current_position; - - switch(new_mode) - { - case OFFSET_CURRENT: - - new_position += fam->fam_Offset; - break; - - case OFFSET_BEGINNING: - - new_position = fam->fam_Offset; - break; - - case OFFSET_END: - - if(__safe_examine_file_handle(file,fib)) - { - new_position = fib->fib_Size + fam->fam_Offset; - - fib_is_valid = TRUE; - } - - break; - } - - if(new_position != current_position) - { - LONG position; - - PROFILE_OFF(); - position = Seek(file,fam->fam_Offset,new_mode); - PROFILE_ON(); - - /* Same as above: verify that what we got out of - Seek() is really an error and not a valid - file position. */ - if(position == SEEK_ERROR && IoErr() != OK) - { - D(("seek failed, fam->fam_Mode=%ld (%ld), offset=%ld, ioerr=%ld",new_mode,fam->fam_Mode,fam->fam_Offset,IoErr())); - - fam->fam_Error = __translate_io_error_to_errno(IoErr()); - - #if defined(UNIX_PATH_SEMANTICS) - { - /* Check if this operation failed because the file is shorter than - the new file position. First, we need to find out if the file - is really shorter than required. If not, then it must have - been a different error. */ - if((NOT fib_is_valid && CANNOT __safe_examine_file_handle(file,fib)) || (new_position <= (off_t)fib->fib_Size)) - goto out; - - /* Now try to make that file larger. */ - if(__grow_file_size(fd,new_position - (off_t)fib->fib_Size) < 0) - { - fam->fam_Error = __translate_io_error_to_errno(IoErr()); - goto out; - } - } - #else - { - goto out; - } - #endif /* UNIX_PATH_SEMANTICS */ - } - - if(FLAG_IS_SET(fd->fd_Flags,FDF_CACHE_POSITION)) - fd->fd_Position = new_position; - } - - result = new_position; - - break; - - case file_action_set_blocking: - - SHOWMSG("file_action_set_blocking"); - - PROFILE_OFF(); - - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_INTERACTIVE)) - { - LONG mode; - - SHOWMSG("changing the mode"); - - if(fam->fam_Arg != 0) - mode = DOSFALSE; /* buffered mode */ - else - mode = DOSTRUE; /* single character mode */ - - if(CANNOT SetMode(file,mode)) - { - fam->fam_Error = __translate_io_error_to_errno(IoErr()); - goto out; - } - - result = OK; - } - else - { - SHOWMSG("can't do anything here"); - - fam->fam_Error = EBADF; - } - - PROFILE_ON(); - - break; - - case file_action_examine: - - SHOWMSG("file_action_examine"); - - fh = BADDR(file); - - if(CANNOT __safe_examine_file_handle(file,fam->fam_FileInfo)) - { - LONG error; - - /* So that didn't work. Did the file system simply fail to - respond to the request or is something more sinister - at work? */ - error = IoErr(); - if(error != ERROR_ACTION_NOT_KNOWN) - { - SHOWMSG("couldn't examine the file"); - - fam->fam_Error = __translate_io_error_to_errno(error); - goto out; - } - - /* OK, let's have another look at this file. Could it be a - console stream? */ - if(NOT IsInteractive(file)) - { - SHOWMSG("whatever it is, we don't know"); - - fam->fam_Error = ENOSYS; - goto out; - } - - /* Make up some stuff for this stream. */ - memset(fam->fam_FileInfo,0,sizeof(*fam->fam_FileInfo)); - - DateStamp(&fam->fam_FileInfo->fib_Date); - - fam->fam_FileInfo->fib_DirEntryType = ST_CONSOLE; - } - - fam->fam_FileSystem = fh->fh_Type; - - result = OK; - - break; - - default: - - SHOWVALUE(fam->fam_Action); - - fam->fam_Error = EBADF; - break; - } - - out: - - __fd_unlock(fd); - - if(fam->fam_Action == file_action_close) - __stdio_unlock(); - - if(buffer != NULL) - free(buffer); - - SHOWVALUE(result); - - RETURN(result); - return(result); -} diff --git a/library/stdio_feof.c b/library/stdio_feof.c deleted file mode 100644 index 80a17fb..0000000 --- a/library/stdio_feof.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * $Id: stdio_feof.c,v 1.4 2005-02-27 18:09:10 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#undef feof - -/****************************************************************************/ - -int -feof(FILE *stream) -{ - struct iob * file = (struct iob *)stream; - int result; - - ENTER(); - - SHOWPOINTER(stream); - - assert( stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - SHOWMSG("invalid stream parameter"); - - __set_errno(EFAULT); - - result = 0; - - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - - flockfile(stream); - - result = FLAG_IS_SET(file->iob_Flags,IOBF_EOF_REACHED); - - funlockfile(stream); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_ferror.c b/library/stdio_ferror.c deleted file mode 100644 index a4c0694..0000000 --- a/library/stdio_ferror.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * $Id: stdio_ferror.c,v 1.4 2005-02-27 18:09:10 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#undef ferror - -/****************************************************************************/ - -int -ferror(FILE *stream) -{ - struct iob * file = (struct iob *)stream; - int result; - - ENTER(); - - SHOWPOINTER(stream); - - assert( stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - SHOWMSG("invalid stream parameter"); - - __set_errno(EFAULT); - - result = 0; - - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - - flockfile(stream); - - result = FLAG_IS_SET(file->iob_Flags,IOBF_ERROR); - - funlockfile(stream); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_fflush.c b/library/stdio_fflush.c deleted file mode 100644 index fb0c0af..0000000 --- a/library/stdio_fflush.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * $Id: stdio_fflush.c,v 1.10 2005-05-12 14:00:54 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -fflush(FILE *stream) -{ - int result = EOF; - - ENTER(); - - SHOWPOINTER(stream); - - if(__check_abort_enabled) - __check_abort(); - - /* Flush a particular stream? */ - if(stream != NULL) - { - struct iob * file = (struct iob *)stream; - - assert( __is_valid_iob(file) ); - - flockfile(stream); - - if(__iob_write_buffer_is_valid(file) && __flush_iob_write_buffer(file) < 0) - goto out; - } - else - { - int failed_iob = -1; - int i; - - __stdio_lock(); - - /* Flush all streams which still have unwritten data in the buffer. */ - for(i = 0 ; i < __num_iob ; i++) - { - if(__iob[i] != NULL && - FLAG_IS_SET(__iob[i]->iob_Flags,IOBF_IN_USE) && - FLAG_IS_SET(__iob[i]->iob_Flags,IOBF_WRITE) && - __iob_write_buffer_is_valid(__iob[i])) - { - if(__flush_iob_write_buffer(__iob[i]) < 0) - { - failed_iob = i; - break; - } - } - } - - __stdio_unlock(); - - if(failed_iob >= 0) - goto out; - } - - result = OK; - - out: - - if(stream != NULL) - funlockfile(stream); - - RETURN(result); - return(result); -} diff --git a/library/stdio_fgetc.c b/library/stdio_fgetc.c deleted file mode 100644 index b2e1902..0000000 --- a/library/stdio_fgetc.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * $Id: stdio_fgetc.c,v 1.7 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -__fgetc(FILE *stream) -{ - struct iob * file = (struct iob *)stream; - int result = EOF; - - assert( stream != NULL ); - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - if(__iob_read_buffer_is_empty(file)) - { - if(__check_abort_enabled) - __check_abort(); - - if(__fill_iob_read_buffer(file) < 0) - goto out; - - if(__iob_read_buffer_is_empty(file)) - { - SET_FLAG(file->iob_Flags,IOBF_EOF_REACHED); - - goto out; - } - } - - result = file->iob_Buffer[file->iob_BufferPosition++]; - - out: - - return(result); -} - -/****************************************************************************/ - -int -__fgetc_check(FILE * stream) -{ - struct iob * file = (struct iob *)stream; - int result = EOF; - - assert( stream != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_IN_USE)) - { - SHOWMSG("this file is not even in use"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EBADF); - goto out; - } - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_READ)) - { - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EBADF); - goto out; - } - - if(__iob_write_buffer_is_valid(file) && __flush_iob_write_buffer(file) < 0) - goto out; - - result = OK; - - out: - - return(result); -} - -/****************************************************************************/ - -int -fgetc(FILE *stream) -{ - int result = EOF; - - assert( stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stream); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(__fgetc_check(stream) < 0) - goto out; - - result = __getc(stream); - - out: - - funlockfile(stream); - - return(result); -} diff --git a/library/stdio_fgetpos.c b/library/stdio_fgetpos.c deleted file mode 100644 index bb60e10..0000000 --- a/library/stdio_fgetpos.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * $Id: stdio_fgetpos.c,v 1.7 2005-04-24 19:38:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -fgetpos(FILE *stream, fpos_t *pos) -{ - int result = EOF; - long position; - - ENTER(); - - SHOWPOINTER(stream); - SHOWPOINTER(pos); - - assert( stream != NULL && pos != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stream); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL || pos == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - position = ftell(stream); - if(position == SEEK_ERROR && __get_errno() != OK) - { - SHOWMSG("ftell() didn't work."); - - goto out; - } - - (*pos) = (fpos_t)position; - - result = OK; - - out: - - funlockfile(stream); - - RETURN(result); - return(result); -} diff --git a/library/stdio_fgets.c b/library/stdio_fgets.c deleted file mode 100644 index 3ad8eee..0000000 --- a/library/stdio_fgets.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * $Id: stdio_fgets.c,v 1.5 2005-02-27 18:09:10 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -char * -fgets(char *s,int n,FILE *stream) -{ - char * result = s; - int c; - - ENTER(); - - SHOWPOINTER(s); - SHOWVALUE(n); - SHOWPOINTER(stream); - - assert( s != NULL && stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stream); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s == NULL || stream == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - result = NULL; - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(n <= 0) - { - SHOWMSG("no work to be done"); - - result = NULL; - goto out; - } - - /* Take care of the checks and data structure changes that - * need to be handled only once for this stream. - */ - if(__fgetc_check(stream) < 0) - { - result = NULL; - goto out; - } - - /* So that we can tell error and 'end of file' conditions apart. */ - clearerr(stream); - - /* One off for the terminating '\0'. */ - n--; - - while(n-- > 0) - { - c = __getc(stream); - if(c == EOF) - { - if(ferror(stream)) - { - /* Just to be on the safe side. */ - (*s) = '\0'; - - result = NULL; - goto out; - } - - /* Make sure that we return NULL if we really - didn't read anything at all */ - if(s == result) - result = NULL; - - break; - } - - (*s++) = c; - - if(c == '\n') - break; - } - - (*s) = '\0'; - - SHOWSTRING(result); - - out: - - funlockfile(stream); - - RETURN(result); - return(result); -} diff --git a/library/stdio_file_init.c b/library/stdio_file_init.c deleted file mode 100644 index dd62cae..0000000 --- a/library/stdio_file_init.c +++ /dev/null @@ -1,388 +0,0 @@ -/* - * $Id: stdio_file_init.c,v 1.10 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -#ifndef _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -static struct MsgPort * old_console_task; -static BOOL restore_console_task; - -/****************************************************************************/ - -static BOOL restore_streams; - -/****************************************************************************/ - -static BPTR old_output; -static BPTR old_input; - -/****************************************************************************/ - -static BPTR output; -static BPTR input; - -/****************************************************************************/ - -struct WBStartup * NOCOMMON __WBenchMsg; - -/****************************************************************************/ - -FILE_DESTRUCTOR(workbench_exit) -{ - ENTER(); - - PROFILE_OFF(); - - /* Now clean up after the streams set up for Workbench startup... */ - if(restore_console_task) - { - SetConsoleTask((struct MsgPort *)old_console_task); - old_console_task = NULL; - - restore_console_task = FALSE; - } - - if(restore_streams) - { - SelectInput(old_input); - old_input = ZERO; - - SelectOutput(old_output); - old_output = ZERO; - - restore_streams = FALSE; - } - - if(input != ZERO) - { - Close(input); - input = ZERO; - } - - if(output != ZERO) - { - Close(output); - output = ZERO; - } - - PROFILE_ON(); - - LEAVE(); -} - -/****************************************************************************/ - -STATIC int -wb_file_init(void) -{ - int result = ERROR; - - PROFILE_OFF(); - - __original_current_directory = CurrentDir(__WBenchMsg->sm_ArgList[0].wa_Lock); - __current_directory_changed = TRUE; - - if (__stdio_window_specification != NULL) - { - input = Open(__stdio_window_specification,MODE_NEWFILE); - } - else if (__WBenchMsg->sm_ToolWindow != NULL) - { - input = Open(__WBenchMsg->sm_ToolWindow,MODE_NEWFILE); - } - else - { - static const char console_prefix[] = "CON:20/20/600/150/"; - static const char console_suffix[] = " Output/AUTO/CLOSE/WAIT"; - STRPTR window_specifier; - STRPTR tool_name; - size_t len; - - tool_name = FilePart(__WBenchMsg->sm_ArgList[0].wa_Name); - - len = strlen(console_prefix) + strlen(tool_name) + strlen(console_suffix); - - window_specifier = malloc(len+1); - if(window_specifier == NULL) - goto out; - - strcpy(window_specifier,console_prefix); - strcat(window_specifier,tool_name); - strcat(window_specifier,console_suffix); - - input = Open(window_specifier,MODE_NEWFILE); - - free(window_specifier); - } - - if(input == ZERO) - input = Open("NIL:",MODE_NEWFILE); - - if(input != ZERO) - { - struct FileHandle * fh = BADDR(input); - - old_console_task = SetConsoleTask(fh->fh_Type); - - output = Open("CONSOLE:",MODE_NEWFILE); - if(output != ZERO) - restore_console_task = TRUE; - else - SetConsoleTask((struct MsgPort *)old_console_task); - } - - if(output == ZERO) - output = Open("NIL:",MODE_NEWFILE); - - if(input == ZERO || output == ZERO) - goto out; - - old_input = SelectInput(input); - old_output = SelectOutput(output); - - restore_streams = TRUE; - - result = OK; - - out: - - PROFILE_ON(); - - return(result); -} - -/****************************************************************************/ - -FILE_CONSTRUCTOR(stdio_file_init) -{ - struct SignalSemaphore * stdio_lock; - struct SignalSemaphore * fd_lock; - BPTR default_file; - ULONG fd_flags,iob_flags; - BOOL success = FALSE; - char * buffer; - char * aligned_buffer; - int i; - - ENTER(); - - /* If we were invoked from Workbench, set up the standard I/O streams. */ - if(__WBenchMsg != NULL) - { - if(wb_file_init() < 0) - goto out; - } - - /* Now initialize the standard I/O streams (input, output, error). */ - for(i = STDIN_FILENO ; i <= STDERR_FILENO ; i++) - { - PROFILE_OFF(); - - switch(i) - { - case STDIN_FILENO: - - iob_flags = IOBF_IN_USE | IOBF_READ | IOBF_NO_NUL | IOBF_BUFFER_MODE_LINE; - fd_flags = FDF_IN_USE | FDF_READ | FDF_NO_CLOSE; - default_file = Input(); - break; - - case STDOUT_FILENO: - - iob_flags = IOBF_IN_USE | IOBF_WRITE | IOBF_NO_NUL | IOBF_BUFFER_MODE_LINE; - fd_flags = FDF_IN_USE | FDF_WRITE | FDF_NO_CLOSE; - default_file = Output(); - break; - - case STDERR_FILENO: - default: - - iob_flags = IOBF_IN_USE | IOBF_WRITE | IOBF_NO_NUL | IOBF_BUFFER_MODE_NONE; - fd_flags = FDF_IN_USE | FDF_WRITE; - default_file = ZERO; /* NOTE: this is really initialized later; see below... */ - break; - } - - PROFILE_ON(); - - /* Allocate a little more memory than necessary. */ - buffer = malloc(BUFSIZ + (CACHE_LINE_SIZE-1)); - if(buffer == NULL) - goto out; - - #if defined(__THREAD_SAFE) - { - /* Allocate memory for an arbitration mechanism, then - initialize it. */ - stdio_lock = __create_semaphore(); - fd_lock = __create_semaphore(); - - if(stdio_lock == NULL || fd_lock == NULL) - { - __delete_semaphore(stdio_lock); - __delete_semaphore(fd_lock); - - goto out; - } - - /* We ignore the file handle and let the file I/O - code in the fd hook pick up the appropriate - Input/Output/ErrorOutput handle. */ - default_file = i; - - fd_flags |= FDF_NO_CLOSE | FDF_STDIO; - } - #else - { - stdio_lock = NULL; - fd_lock = NULL; - - /* Check if this stream is attached to a console window. */ - if(default_file != ZERO) - { - PROFILE_OFF(); - - if(IsInteractive(default_file)) - SET_FLAG(fd_flags,FDF_IS_INTERACTIVE); - - PROFILE_ON(); - } - } - #endif /* __THREAD_SAFE */ - - /* Align the buffer start address to a cache line boundary. */ - aligned_buffer = (char *)((ULONG)(buffer + (CACHE_LINE_SIZE-1)) & ~(CACHE_LINE_SIZE-1)); - - __initialize_fd(__fd[i],__fd_hook_entry,default_file,fd_flags,fd_lock); - - __initialize_iob(__iob[i],__iob_hook_entry, - buffer, - aligned_buffer,BUFSIZ, - i, - i, - iob_flags, - stdio_lock); - } - - #if NOT defined(__THREAD_SAFE) - { - /* If the program was launched from Workbench, we continue by - duplicating the default output stream for use as the - standard error stream. */ - if(__WBenchMsg != NULL) - { - PROFILE_OFF(); - __fd[STDERR_FILENO]->fd_DefaultFile = Output(); - PROFILE_ON(); - - SET_FLAG(__fd[STDERR_FILENO]->fd_Flags,FDF_NO_CLOSE); - } - else - { - BPTR ces; - - PROFILE_OFF(); - - /* Figure out what the default error output stream is. */ - #if defined(__amigaos4__) - { - ces = ErrorOutput(); - } - #else - { - struct Process * this_process = (struct Process *)FindTask(NULL); - - ces = this_process->pr_CES; - } - #endif /* __amigaos4__ */ - - PROFILE_ON(); - - /* Is the standard error stream configured? If so, use it. - Otherwise, try to duplicate the standard output stream. */ - if(ces != ZERO) - { - __fd[STDERR_FILENO]->fd_DefaultFile = ces; - - SET_FLAG(__fd[STDERR_FILENO]->fd_Flags,FDF_NO_CLOSE); - } - else - { - __fd[STDERR_FILENO]->fd_DefaultFile = Open("CONSOLE:",MODE_NEWFILE); - } - } - - PROFILE_OFF(); - - /* Figure out if the standard error stream is bound to a console. */ - if(FLAG_IS_CLEAR(__fd[STDERR_FILENO]->fd_Flags,FDF_STDIO)) - { - if(IsInteractive(__fd[STDERR_FILENO]->fd_DefaultFile)) - SET_FLAG(__fd[STDERR_FILENO]->fd_Flags,FDF_IS_INTERACTIVE); - } - - PROFILE_ON(); - } - #endif /* __THREAD_SAFE */ - - success = TRUE; - - out: - - SHOWVALUE(success); - LEAVE(); - - if(success) - CONSTRUCTOR_SUCCEED(); - else - CONSTRUCTOR_FAIL(); -} diff --git a/library/stdio_filliobreadbuffer.c b/library/stdio_filliobreadbuffer.c deleted file mode 100644 index d7cc7bf..0000000 --- a/library/stdio_filliobreadbuffer.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * $Id: stdio_filliobreadbuffer.c,v 1.10 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -__fill_iob_read_buffer(struct iob * file) -{ - struct file_action_message fam; - int num_bytes_read; - int result = ERROR; - - ENTER(); - - SHOWPOINTER(file); - - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file != NULL && (file->iob_BufferReadBytes == 0 || file->iob_BufferPosition == file->iob_BufferReadBytes) && file->iob_BufferWriteBytes == 0 ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_READ) ); - assert( file->iob_BufferSize > 0 ); - - /* Flush all line buffered streams before we proceed to fill this buffer. */ - if((file->iob_Flags & IOBF_BUFFER_MODE) == IOBF_BUFFER_MODE_LINE) - { - if(__flush_all_files(IOBF_BUFFER_MODE_LINE) < 0) - goto out; - } - - SHOWMSG("calling the hook"); - - SHOWPOINTER(file->iob_Buffer); - SHOWVALUE(file->iob_BufferSize); - - fam.fam_Action = file_action_read; - fam.fam_Data = file->iob_Buffer; - fam.fam_Size = file->iob_BufferSize; - - assert( file->iob_Action != NULL ); - - num_bytes_read = (*file->iob_Action)(file,&fam); - if(num_bytes_read == EOF) - { - D(("got error %ld",fam.fam_Error)); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(fam.fam_Error); - - goto out; - } - - file->iob_BufferReadBytes = num_bytes_read; - file->iob_BufferPosition = 0; - - SHOWVALUE(file->iob_BufferReadBytes); - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_findvacantfdentry.c b/library/stdio_findvacantfdentry.c deleted file mode 100644 index c0c18a9..0000000 --- a/library/stdio_findvacantfdentry.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * $Id: stdio_findvacantfdentry.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef NDEBUG - -/****************************************************************************/ - -BOOL -__is_valid_fd(struct fd * fd) -{ - BOOL result = FALSE; - - __stdio_lock(); - - if(__fd != NULL && __num_fd > 0) - { - int i; - - for(i = 0 ; i < __num_fd ; i++) - { - if(__fd[i] == fd) - { - result = TRUE; - break; - } - } - } - - __stdio_unlock(); - - return(result); -} - -/****************************************************************************/ - -#endif /* NDEBUG */ - -/****************************************************************************/ - -int -__find_vacant_fd_entry(void) -{ - int result = ERROR; - int i; - - assert( __fd != NULL || __num_fd == 0 ); - - for(i = 0 ; i < __num_fd ; i++) - { - if(FLAG_IS_CLEAR(__fd[i]->fd_Flags,FDF_IN_USE)) - { - result = i; - break; - } - } - - return(result); -} diff --git a/library/stdio_findvacantiobentry.c b/library/stdio_findvacantiobentry.c deleted file mode 100644 index af8601e..0000000 --- a/library/stdio_findvacantiobentry.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * $Id: stdio_findvacantiobentry.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef NDEBUG - -/****************************************************************************/ - -BOOL -__is_valid_iob(struct iob * iob) -{ - BOOL result = FALSE; - - if(iob != NULL && FLAG_IS_SET(iob->iob_Flags,IOBF_INTERNAL)) - { - /* This is used by vsprintf(), etc. */ - result = TRUE; - } - else - { - __stdio_lock(); - - if(__iob != NULL && __num_iob > 0 && 0 <= iob->iob_SlotNumber && iob->iob_SlotNumber < __num_iob && __iob[iob->iob_SlotNumber] == iob) - result = TRUE; - - __stdio_unlock(); - } - - return(result); -} - -/****************************************************************************/ - -#endif /* NDEBUG */ - -/****************************************************************************/ - -int -__find_vacant_iob_entry(void) -{ - int result = ERROR; - int i; - - assert( __iob != NULL || __num_iob == 0 ); - - for(i = 0 ; i < __num_iob ; i++) - { - if(FLAG_IS_CLEAR(__iob[i]->iob_Flags,IOBF_IN_USE)) - { - result = i; - break; - } - } - - return(result); -} diff --git a/library/stdio_flockfile.c b/library/stdio_flockfile.c deleted file mode 100644 index a91a4b3..0000000 --- a/library/stdio_flockfile.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * $Id: stdio_flockfile.c,v 1.3 2005-02-28 13:42:52 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -/****************************************************************************/ - -void -flockfile(FILE *stream) -{ - struct iob * file = (struct iob *)stream; - - ENTER(); - - SHOWPOINTER(stream); - - assert( stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - SHOWMSG("invalid stream parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_IN_USE)) - { - SHOWMSG("this file is not even in use"); - - __set_errno(EBADF); - goto out; - } - - if(file->iob_Lock != NULL) - ObtainSemaphore(file->iob_Lock); - - out: - - LEAVE(); -} - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ diff --git a/library/stdio_flush.c b/library/stdio_flush.c deleted file mode 100644 index 4cc1bb7..0000000 --- a/library/stdio_flush.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * $Id: stdio_flush.c,v 1.4 2005-02-27 18:09:10 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -/* This is roughly equivalent to fflush(), but returns the last character - written to the buffer, or EOF if flushing produced an error. The putc() - macro and the internal __putc() macro need this functionality. This - function is called only if the last character written to the buffer - was a line feed, prompting the buffer contents to be flushed. It should - never be used in place of fflush(). */ -int -__flush(FILE *stream) -{ - struct iob * iob = (struct iob *)stream; - int result = EOF; - int last_c; - - ENTER(); - - SHOWPOINTER(stream); - - assert( stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stream); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - SHOWMSG("invalid stream parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(iob) ); - assert( iob->iob_BufferWriteBytes > 0 ); - assert( iob->iob_BufferSize > 0 ); - - last_c = iob->iob_Buffer[iob->iob_BufferWriteBytes - 1]; - - if(__flush_iob_write_buffer(iob) < 0) - { - /* Remove the last character stored in the buffer, which is - typically a '\n'. */ - iob->iob_BufferWriteBytes--; - goto out; - } - - result = last_c; - - out: - - funlockfile(stream); - - RETURN(result); - return(result); -} diff --git a/library/stdio_flush_all_files.c b/library/stdio_flush_all_files.c deleted file mode 100644 index b26a9b7..0000000 --- a/library/stdio_flush_all_files.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * $Id: stdio_flush_all_files.c,v 1.2 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -__flush_all_files(int buffer_mode) -{ - int result; - int i; - - __stdio_lock(); - - for(i = 0 ; i < __num_iob ; i++) - { - if(__iob[i] != NULL && - FLAG_IS_SET(__iob[i]->iob_Flags,IOBF_IN_USE) && - FLAG_IS_SET(__iob[i]->iob_Flags,IOBF_WRITE) && - (buffer_mode < 0 || (__iob[i]->iob_Flags & IOBF_BUFFER_MODE) == (ULONG)buffer_mode) && - __iob_write_buffer_is_valid(__iob[i])) - { - if(__flush_iob_write_buffer(__iob[i]) < 0) - { - result = ERROR; - goto out; - } - } - } - - result = OK; - - out: - - __stdio_unlock(); - - return(result); -} diff --git a/library/stdio_flushiobwritebuffer.c b/library/stdio_flushiobwritebuffer.c deleted file mode 100644 index 5c69cbe..0000000 --- a/library/stdio_flushiobwritebuffer.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * $Id: stdio_flushiobwritebuffer.c,v 1.7 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -/* This would otherwise generate far too much (useless) debug output. */ -#ifdef DEBUG -#undef DEBUG -#endif /* DEBUG */ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -__flush_iob_write_buffer(struct iob * file) -{ - int result = OK; - - ENTER(); - - SHOWPOINTER(file); - - assert( file != NULL ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - if(__check_abort_enabled) - __check_abort(); - - if(FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) && file->iob_BufferWriteBytes > 0) - { - struct file_action_message fam; - - assert( FLAG_IS_SET(file->iob_Flags,IOBF_WRITE) ); - assert( file->iob_BufferSize > 0 ); - - D(("%ld bytes are to be written",file->iob_BufferWriteBytes)); - - SHOWMSG("calling the hook"); - - fam.fam_Action = file_action_write; - fam.fam_Data = file->iob_Buffer; - fam.fam_Size = file->iob_BufferWriteBytes; - - assert( file->iob_Action != NULL ); - - if((*file->iob_Action)(file,&fam) == EOF) - { - SHOWMSG("that didn't work"); - - result = ERROR; - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(fam.fam_Error); - - goto out; - } - - file->iob_BufferWriteBytes = 0; - } - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_fopen.c b/library/stdio_fopen.c deleted file mode 100644 index e40336d..0000000 --- a/library/stdio_fopen.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * $Id: stdio_fopen.c,v 1.6 2005-03-04 09:07:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -FILE * -fopen(const char *filename, const char *mode) -{ - FILE * result = NULL; - int slot_number; - - ENTER(); - - SHOWSTRING(filename); - SHOWSTRING(mode); - - assert( filename != NULL && mode != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - __stdio_lock(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(filename == NULL || mode == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - slot_number = __find_vacant_iob_entry(); - if(slot_number < 0) - { - if(__grow_iob_table(0) < 0) - { - SHOWMSG("couldn't find a free file table, and no memory for a new one"); - goto out; - } - - slot_number = __find_vacant_iob_entry(); - assert( slot_number >= 0 ); - } - - if(__open_iob(filename,mode,-1,slot_number) < 0) - { - SHOWMSG("couldn't open the file"); - goto out; - } - - result = (FILE *)__iob[slot_number]; - - out: - - __stdio_unlock(); - - RETURN(result); - return(result); -} diff --git a/library/stdio_fprintf.c b/library/stdio_fprintf.c deleted file mode 100644 index 05b1688..0000000 --- a/library/stdio_fprintf.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * $Id: stdio_fprintf.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -fprintf(FILE *stream,const char *format,...) -{ - int result = EOF; - va_list arg; - - ENTER(); - - SHOWPOINTER(stream); - SHOWSTRING(format); - - assert( stream != NULL && format != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL || format == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - va_start(arg,format); - result = vfprintf(stream,format,arg); - va_end(arg); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_fputc.c b/library/stdio_fputc.c deleted file mode 100644 index fd3d111..0000000 --- a/library/stdio_fputc.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * $Id: stdio_fputc.c,v 1.7 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -__fputc_check(FILE *stream) -{ - struct iob * file = (struct iob *)stream; - int result = EOF; - - assert( stream != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_IN_USE)) - { - SHOWMSG("this file is not even in use"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EBADF); - - goto out; - } - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_WRITE)) - { - SHOWMSG("this stream is not write enabled"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EBADF); - - goto out; - } - - if(__iob_read_buffer_is_valid(file) && __drop_iob_read_buffer(file) < 0) - { - SHOWMSG("couldn't get rid of the read buffer."); - goto out; - } - - result = OK; - - out: - - return(result); -} - -/****************************************************************************/ - -int -__fputc(int c,FILE *stream,int buffer_mode) -{ - struct iob * file = (struct iob *)stream; - int result = EOF; - - assert( stream != NULL ); - - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - if(__iob_write_buffer_is_full(file) && __flush_iob_write_buffer(file) < 0) - goto out; - - file->iob_Buffer[file->iob_BufferWriteBytes++] = c; - - if((buffer_mode == IOBF_BUFFER_MODE_NONE || (buffer_mode == IOBF_BUFFER_MODE_LINE && c == '\n')) && __flush_iob_write_buffer(file) < 0) - { - /* Pretend that the last character was not written. */ - file->iob_BufferWriteBytes--; - goto out; - } - - /* Clip everything but the least significant eight bits. This - also takes care of the sign. Thus, a -1 (== EOF) always comes - out as 255. */ - result = (c & 255); - - out: - - return(result); -} - -/****************************************************************************/ - -int -fputc(int c,FILE *stream) -{ - struct iob * file = (struct iob *)stream; - int result = EOF; - - assert( stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - - flockfile(stream); - - if(__fputc_check(stream) < 0) - goto out; - - result = __fputc(c,stream,(file->iob_Flags & IOBF_BUFFER_MODE)); - - out: - - funlockfile(stream); - - return(result); -} diff --git a/library/stdio_fputs.c b/library/stdio_fputs.c deleted file mode 100644 index 7e7f3c4..0000000 --- a/library/stdio_fputs.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * $Id: stdio_fputs.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -fputs(const char *s, FILE *stream) -{ - struct iob * file = (struct iob *)stream; - int result = EOF; - int buffer_mode; - int c; - - ENTER(); - - SHOWSTRING(s); - SHOWPOINTER(stream); - - assert( s != NULL && stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s == NULL || stream == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - flockfile(stream); - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - buffer_mode = (file->iob_Flags & IOBF_BUFFER_MODE); - if(buffer_mode == IOBF_BUFFER_MODE_NONE) - buffer_mode = IOBF_BUFFER_MODE_LINE; - - if(__fputc_check(stream) < 0) - goto out; - - while((c = (*s++)) != '\0') - { - if(__putc(c,stream,buffer_mode) == EOF) - goto out; - } - - result = OK; - - out: - - /* Note: if buffering is disabled for this stream, then we still - may have buffered data around, queued to be printed right now. - This is intended to improve performance as it takes more effort - to write a single character to a file than to write a bunch. */ - if(result == 0 && (file->iob_Flags & IOBF_BUFFER_MODE) == IOBF_BUFFER_MODE_NONE) - { - if(__iob_write_buffer_is_valid(file) && __flush_iob_write_buffer(file) < 0) - { - SHOWMSG("couldn't flush the write buffer"); - result = EOF; - } - } - - funlockfile(stream); - - RETURN(result); - return(result); -} diff --git a/library/stdio_fread.c b/library/stdio_fread.c deleted file mode 100644 index 352e922..0000000 --- a/library/stdio_fread.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * $Id: stdio_fread.c,v 1.6 2005-04-24 19:38:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -size_t -fread(void *ptr,size_t element_size,size_t count,FILE *stream) -{ - struct iob * file = (struct iob *)stream; - size_t result = 0; - - ENTER(); - - SHOWPOINTER(ptr); - SHOWVALUE(element_size); - SHOWVALUE(count); - SHOWPOINTER(stream); - - assert( ptr != NULL && stream != NULL ); - assert( (int)element_size >= 0 && (int)count >= 0 ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stream); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(ptr == NULL || stream == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_IN_USE)) - { - SHOWMSG("this file is not even in use"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EBADF); - - goto out; - } - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_READ)) - { - SHOWMSG("this file is not read-enabled"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EBADF); - - goto out; - } - - if(element_size > 0 && count > 0) - { - size_t total_bytes_read = 0; - size_t total_size; - unsigned char * data = ptr; - int c; - - if(__fgetc_check((FILE *)file) < 0) - goto out; - - total_size = element_size * count; - - SHOWVALUE(total_size); - - while(total_size-- > 0) - { - c = __getc(file); - if(c == EOF) - break; - - (*data++) = c; - - total_bytes_read++; - } - - SHOWVALUE(total_bytes_read); - - result = total_bytes_read / element_size; - } - else - { - SHOWVALUE(element_size); - SHOWVALUE(count); - - SHOWMSG("either element size or count is zero"); - - /* Don't let this appear like an EOF or error. */ - clearerr((FILE *)file); - } - - D(("total number of elements read = %ld",result)); - - out: - - funlockfile(stream); - - RETURN(result); - return(result); -} diff --git a/library/stdio_freopen.c b/library/stdio_freopen.c deleted file mode 100644 index 32e0bb2..0000000 --- a/library/stdio_freopen.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * $Id: stdio_freopen.c,v 1.4 2005-02-28 10:07:30 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -FILE * -freopen(const char *filename, const char *mode, FILE *stream) -{ - struct iob * file = (struct iob *)stream; - FILE * result = NULL; - int slot_number; - - ENTER(); - - SHOWSTRING(filename); - SHOWSTRING(mode); - SHOWPOINTER(stream); - - assert( filename != NULL && mode != NULL && stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(filename == NULL || mode == NULL || stream == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - /* We need to remember this; it'll go away when we close - the file. */ - slot_number = file->iob_SlotNumber; - - fclose(stream); - - if(__open_iob(filename, mode, -1, slot_number) < 0) - { - SHOWMSG("couldn't reopen the file"); - goto out; - } - - result = (FILE *)file; - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_fscanf.c b/library/stdio_fscanf.c deleted file mode 100644 index 42b1dfa..0000000 --- a/library/stdio_fscanf.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * $Id: stdio_fscanf.c,v 1.6 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -fscanf(FILE *stream, const char *format, ...) -{ - int result = EOF; - va_list arg; - - ENTER(); - - SHOWPOINTER(stream); - SHOWSTRING(format); - - assert(stream != NULL && format != NULL); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL || format == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - va_start(arg,format); - result = vfscanf(stream,format,arg); - va_end(arg); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_fseek.c b/library/stdio_fseek.c deleted file mode 100644 index e854aeb..0000000 --- a/library/stdio_fseek.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * $Id: stdio_fseek.c,v 1.9 2005-04-24 09:53:12 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -fseek(FILE *stream, long int offset, int wherefrom) -{ - struct iob * file = (struct iob *)stream; - int result = SEEK_ERROR; - - ENTER(); - - SHOWPOINTER(stream); - SHOWVALUE(offset); - SHOWVALUE(wherefrom); - - assert(stream != NULL); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stream); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - SHOWMSG("invalid stream parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_IN_USE)) - { - SHOWMSG("this file is not even in use"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EBADF); - - goto out; - } - - if(wherefrom < SEEK_SET || wherefrom > SEEK_END) - { - SHOWMSG("invalid wherefrom parameter"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EBADF); - - goto out; - } - - /* Try to turn the absolute position into a relative seek - * within the buffer, if possible. - */ - if(wherefrom == SEEK_SET && __iob_read_buffer_is_valid(file)) - { - long int current_position; - - current_position = ftell(stream); - if(current_position != SEEK_ERROR || __get_errno() == OK) - { - offset -= current_position; - - wherefrom = SEEK_CUR; - } - } - - /* We have to clear the EOF condition */ - CLEAR_FLAG(file->iob_Flags,IOBF_EOF_REACHED); - - if(wherefrom != SEEK_CUR || offset != 0) - { - BOOL buffer_position_adjusted = FALSE; - - /* Try to adjust the buffer position rather than adjusting - * the file position itself, which is very costly. - */ - if(wherefrom == SEEK_CUR && __iob_read_buffer_is_valid(file)) - { - /* Try to adjust the buffer read position. This also - * affects the number of bytes that can still be read. - */ - if ((offset < 0 && (-offset) <= file->iob_BufferPosition) || - (offset > 0 && offset <= __iob_num_unread_bytes(file))) - { - file->iob_BufferPosition += offset; - - buffer_position_adjusted = TRUE; - } - } - - if(NOT buffer_position_adjusted) - { - struct file_action_message fam; - LONG position; - - /* Oh dear, no luck. So we have to get rid of the - * current buffer contents and start with a clean - * slate. - */ - if(__iob_write_buffer_is_valid(file) && __flush_iob_write_buffer(file) < 0) - { - SHOWMSG("couldn't flush write buffer"); - - goto out; - } - - if(__iob_read_buffer_is_valid(file) && __drop_iob_read_buffer(file) < 0) - { - SHOWMSG("couldn't drop read buffer"); - - goto out; - } - - SHOWMSG("calling the hook"); - - SHOWPOINTER(&fam); - - fam.fam_Action = file_action_seek; - fam.fam_Offset = offset; - fam.fam_Mode = wherefrom; - - SHOWVALUE(fam.fam_Offset); - SHOWVALUE(fam.fam_Mode); - - assert( file->iob_Action != NULL ); - - /* Note that a return value of -1 (= SEEK_ERROR) may be a - valid file position in files larger than 2 GBytes. Just - to be sure, we therefore also check the secondary error - to verify that what could be a file position is really - an error indication. */ - position = (*file->iob_Action)(file,&fam); - if(position == SEEK_ERROR && fam.fam_Error != OK) - { - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(fam.fam_Error); - - goto out; - } - - /* If this is a valid file position, clear 'errno' so that - it cannot be mistaken for an error. */ - if(position < 0) - __set_errno(OK); - } - } - - result = OK; - - out: - - funlockfile(stream); - - RETURN(result); - return(result); -} diff --git a/library/stdio_fseeko.c b/library/stdio_fseeko.c deleted file mode 100644 index d7cdd80..0000000 --- a/library/stdio_fseeko.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * $Id: stdio_fseeko.c,v 1.1 2005-06-18 07:23:16 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* fseeko() is technically equivalent to fseek(), except that the - "offset" parameter is of type "off_t" rather than "long int". - In this implementation, "off_t" has the same range as the - "long int" type, so this matters little. */ -int -fseeko(FILE *stream, off_t offset, int wherefrom) -{ - int result; - - result = fseek(stream,(long int)offset,wherefrom); - - return(result); -} diff --git a/library/stdio_fsetpos.c b/library/stdio_fsetpos.c deleted file mode 100644 index 4eaf87e..0000000 --- a/library/stdio_fsetpos.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * $Id: stdio_fsetpos.c,v 1.7 2005-04-24 09:53:12 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -fsetpos(FILE *stream, fpos_t *pos) -{ - int result = EOF; - - ENTER(); - - SHOWPOINTER(stream); - SHOWPOINTER(pos); - - assert( stream != NULL && pos != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stream); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL || pos == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(fseek(stream,(long int)(*pos),SEEK_SET) == SEEK_ERROR && __get_errno() != OK) - { - SHOWMSG("fseek failed"); - goto out; - } - - result = OK; - - out: - - funlockfile(stream); - - RETURN(result); - return(result); -} diff --git a/library/stdio_ftell.c b/library/stdio_ftell.c deleted file mode 100644 index 19ef4e1..0000000 --- a/library/stdio_ftell.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * $Id: stdio_ftell.c,v 1.9 2005-04-24 09:53:12 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -long int -ftell(FILE *stream) -{ - struct iob * file = (struct iob *)stream; - struct file_action_message fam; - long int result = ERROR; - int position; - - assert( stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stream); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_IN_USE)) - { - SHOWMSG("this file is not even in use"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EBADF); - - goto out; - } - - SHOWMSG("calling the hook"); - - SHOWPOINTER(&fam); - - fam.fam_Action = file_action_seek; - fam.fam_Offset = 0; - fam.fam_Mode = SEEK_CUR; - - SHOWVALUE(fam.fam_Offset); - SHOWVALUE(fam.fam_Mode); - - assert( file->iob_Action != NULL ); - - /* Note that a return value of -1 (= SEEK_ERROR) may be a - valid file position in files larger than 2 GBytes. Just - to be sure, we therefore also check the secondary error - to verify that what could be a file position is really - an error indication. */ - position = (*file->iob_Action)(file,&fam); - if(position == SEEK_ERROR && fam.fam_Error != OK) - { - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(fam.fam_Error); - - goto out; - } - - /* If this is a valid file position, clear 'errno' so that - it cannot be mistaken for an error. */ - if(position < 0) - __set_errno(OK); - - if(__iob_read_buffer_is_valid(file)) - { - /* Subtract the number of bytes still in the buffer which have - * not been read before. - */ - position -= __iob_num_unread_bytes(file); - } - else if (__iob_write_buffer_is_valid(file)) - { - /* Add the number of bytes still stored in the buffer which have - * not been written to disk yet. - */ - position += __iob_num_unwritten_bytes(file); - } - - result = position; - - out: - - funlockfile(stream); - - return(result); -} diff --git a/library/stdio_ftello.c b/library/stdio_ftello.c deleted file mode 100755 index 2db3eda..0000000 --- a/library/stdio_ftello.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * $Id: stdio_ftello.c,v 1.1 2005-06-18 07:23:16 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* ftello() is technically equivalent to ftell(), except that - the return value is of type "off_t" rather than "long int". - In this implementation, "off_t" has the same range as the - "long int" type, so this matters little. */ -off_t -ftello(FILE *stream) -{ - off_t result; - - result = (off_t)ftell(stream); - - return(result); -} diff --git a/library/stdio_ftrylockfile.c b/library/stdio_ftrylockfile.c deleted file mode 100644 index 8c46e9a..0000000 --- a/library/stdio_ftrylockfile.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Id: stdio_ftrylockfile.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -/****************************************************************************/ - -int -ftrylockfile(FILE *stream) -{ - struct iob * file = (struct iob *)stream; - int result = ERROR; - - ENTER(); - - SHOWPOINTER(stream); - - assert( stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - SHOWMSG("invalid stream parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_IN_USE)) - { - SHOWMSG("this file is not even in use"); - - __set_errno(EBADF); - goto out; - } - - if(file->iob_Lock != NULL && CANNOT AttemptSemaphore(file->iob_Lock)) - goto out; - - result = OK; - - out: - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ diff --git a/library/stdio_funlockfile.c b/library/stdio_funlockfile.c deleted file mode 100644 index 5ff8c69..0000000 --- a/library/stdio_funlockfile.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * $Id: stdio_funlockfile.c,v 1.3 2005-02-28 13:42:52 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -/****************************************************************************/ - -void -funlockfile(FILE *stream) -{ - struct iob * file = (struct iob *)stream; - - ENTER(); - - SHOWPOINTER(stream); - - assert( stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - SHOWMSG("invalid stream parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_IN_USE)) - { - SHOWMSG("this file is not even in use"); - - __set_errno(EBADF); - goto out; - } - - if(file->iob_Lock != NULL) - ReleaseSemaphore(file->iob_Lock); - - out: - - LEAVE(); -} - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ diff --git a/library/stdio_fwrite.c b/library/stdio_fwrite.c deleted file mode 100644 index a943b18..0000000 --- a/library/stdio_fwrite.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * $Id: stdio_fwrite.c,v 1.9 2005-04-24 19:38:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -size_t -fwrite(const void *ptr,size_t element_size,size_t count,FILE *stream) -{ - struct iob * file = (struct iob *)stream; - size_t result = 0; - - ENTER(); - - SHOWPOINTER(ptr); - SHOWVALUE(element_size); - SHOWVALUE(count); - SHOWPOINTER(stream); - - assert( ptr != NULL && stream != NULL ); - assert( (int)element_size >= 0 && (int)count >= 0 ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stream); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(ptr == NULL || stream == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_IN_USE)) - { - SHOWMSG("this file is not even in use"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EBADF); - - goto out; - } - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_WRITE)) - { - SHOWMSG("this stream is not write-enabled"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EBADF); - - goto out; - } - - if(element_size > 0 && count > 0) - { - unsigned char * data = (unsigned char *)ptr; - unsigned char c; - int buffer_mode; - size_t total_bytes_written = 0; - size_t total_size; - - total_size = element_size * count; - - if(__fputc_check((FILE *)file) < 0) - goto out; - - buffer_mode = (file->iob_Flags & IOBF_BUFFER_MODE); - if(buffer_mode == IOBF_BUFFER_MODE_NONE) - { - struct fd * fd = __fd[file->iob_Descriptor]; - - __fd_lock(fd); - - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_INTERACTIVE)) - buffer_mode = IOBF_BUFFER_MODE_LINE; - - __fd_unlock(fd); - } - - if(buffer_mode == IOBF_BUFFER_MODE_LINE) - { - while(total_size-- > 0) - { - c = (*data++); - - if(__putc_line_buffered(c,(FILE *)file) < 0) - goto out; - - total_bytes_written++; - } - } - else - { - while(total_size-- > 0) - { - c = (*data++); - - if(__putc_fully_buffered(c,(FILE *)file) < 0) - goto out; - - total_bytes_written++; - } - } - - if((file->iob_Flags & IOBF_BUFFER_MODE) == IOBF_BUFFER_MODE_NONE) - { - if(__iob_write_buffer_is_valid(file) && __flush_iob_write_buffer(file) < 0) - goto out; - } - - result = total_bytes_written / element_size; - } - else - { - /* Don't let this appear like an EOF or error. */ - clearerr((FILE *)file); - } - - out: - - funlockfile(stream); - - RETURN(result); - return(result); -} diff --git a/library/stdio_get_file_descriptor.c b/library/stdio_get_file_descriptor.c deleted file mode 100644 index cd7c74f..0000000 --- a/library/stdio_get_file_descriptor.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * $Id: stdio_get_file_descriptor.c,v 1.4 2005-04-01 18:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -enum resolution_mode_t -{ - resolution_mode_exact, /* Return the descriptor exactly as it is. */ - resolution_mode_alias /* Resolve the descriptor's alias, if necessary. */ -}; - -/****************************************************************************/ - -STATIC struct fd * -get_file_descriptor(int file_descriptor,enum resolution_mode_t resolution_mode) -{ - struct fd * result = NULL; - struct fd * fd; - - __stdio_lock(); - - if(file_descriptor < 0 || file_descriptor >= __num_fd) - { - SHOWMSG("invalid file descriptor"); - goto out; - } - - fd = __fd[file_descriptor]; - if(fd == NULL) - { - SHOWMSG("invalid file descriptor"); - goto out; - } - - if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_IN_USE)) - { - SHOWMSG("this descriptor is not even in use"); - goto out; - } - - /* Move up to the original file, if this is an alias. */ - if(resolution_mode == resolution_mode_alias && fd->fd_Original != NULL) - fd = fd->fd_Original; - - result = fd; - - out: - - __stdio_unlock(); - - return(result); -} - -/****************************************************************************/ - -struct fd * -__get_file_descriptor(int file_descriptor) -{ - struct fd * result; - - result = get_file_descriptor(file_descriptor,resolution_mode_alias); - - return(result); -} - -/****************************************************************************/ - -struct fd * -__get_file_descriptor_dont_resolve(int file_descriptor) -{ - struct fd * result; - - result = get_file_descriptor(file_descriptor,resolution_mode_exact); - - return(result); -} diff --git a/library/stdio_getc.c b/library/stdio_getc.c deleted file mode 100644 index d17a433..0000000 --- a/library/stdio_getc.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: stdio_getc.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#undef getc - -/****************************************************************************/ - -int -getc(FILE *stream) -{ - int result = EOF; - - assert( stream != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = fgetc(stream); - - out: - - return(result); -} diff --git a/library/stdio_getc_unlocked.c b/library/stdio_getc_unlocked.c deleted file mode 100644 index b4af8bb..0000000 --- a/library/stdio_getc_unlocked.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: stdio_getc_unlocked.c,v 1.2 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#undef getc_unlocked - -/****************************************************************************/ - -int -getc_unlocked(FILE *stream) -{ - int result = EOF; - - assert( stream != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = __getc_unlocked(stream); - - out: - - return(result); -} diff --git a/library/stdio_getchar.c b/library/stdio_getchar.c deleted file mode 100644 index 25f8aa0..0000000 --- a/library/stdio_getchar.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: stdio_getchar.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#undef getchar - -/****************************************************************************/ - -int -getchar(void) -{ - int result; - - result = fgetc(stdin); - - return(result); -} diff --git a/library/stdio_getchar_unlocked.c b/library/stdio_getchar_unlocked.c deleted file mode 100644 index 786402c..0000000 --- a/library/stdio_getchar_unlocked.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: stdio_getchar_unlocked.c,v 1.2 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#undef getchar_unlocked - -/****************************************************************************/ - -int -getchar_unlocked(void) -{ - int result = EOF; - - assert( stdin != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stdin == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = __getc_unlocked(stdin); - - out: - - return(result); -} diff --git a/library/stdio_gets.c b/library/stdio_gets.c deleted file mode 100644 index 70e39ab..0000000 --- a/library/stdio_gets.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * $Id: stdio_gets.c,v 1.5 2005-02-27 18:09:10 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -char * -gets(char *s) -{ - char * result = s; - int c; - - ENTER(); - - SHOWPOINTER(s); - - assert( s != NULL && stdin != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stdin); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s == NULL || stdin == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - - result = NULL; - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* Take care of the checks and data structure changes that - * need to be handled only once for this stream. - */ - if(__fgetc_check(stdin) < 0) - { - result = NULL; - goto out; - } - - /* So that we can tell error and 'end of file' conditions apart. */ - clearerr(stdin); - - while(TRUE) - { - c = __getc(stdin); - if(c == EOF) - { - if(ferror(stdin)) - { - /* Just to be on the safe side. */ - (*s) = '\0'; - - result = NULL; - goto out; - } - - /* Make sure that we return NULL if we really - didn't read anything at all */ - if(s == result) - result = NULL; - - break; - } - - if(c == '\n') - break; - - (*s++) = c; - } - - (*s) = '\0'; - - SHOWSTRING(result); - - out: - - funlockfile(stdin); - - RETURN(result); - return(result); -} diff --git a/library/stdio_grow_file.c b/library/stdio_grow_file.c deleted file mode 100644 index 0444b69..0000000 --- a/library/stdio_grow_file.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * $Id: stdio_grow_file.c,v 1.5 2005-04-24 09:53:12 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* Seek to the end of a file, then add a certain number of 0 bytes. Note that - this function will change the current file position! */ -int -__grow_file_size(struct fd * fd,int num_bytes) -{ - unsigned char * aligned_buffer; - unsigned char * buffer; - struct FileHandle * fh; - D_S(struct InfoData,id); - LONG block_size; - int bytes_written; - int buffer_size; - int size; - LONG seek_position; - off_t position; - off_t current_position; - int alignment_skip; - int result = ERROR; - - assert( fd != NULL ); - - D(("we have to grow the file by %ld bytes",num_bytes)); - - block_size = 0; - - PROFILE_OFF(); - - assert( FLAG_IS_CLEAR(fd->fd_Flags,FDF_STDIO) ); - - fh = BADDR(fd->fd_DefaultFile); - if(fh != NULL && fh->fh_Type != NULL && DoPkt(fh->fh_Type,ACTION_DISK_INFO,MKBADDR(id),0,0,0,0)) - block_size = id->id_BytesPerBlock; - - PROFILE_ON(); - - if(block_size < 512) - block_size = 512; - - /* We have to fill up the file with zero bytes. - * That data comes from a local buffer. How - * large can we make it? - */ - buffer_size = 8 * block_size; - if(buffer_size > num_bytes) - buffer_size = num_bytes; - - /* Allocate a little more memory than required to allow for - * the buffer to be aligned to a cache line boundary. - */ - buffer = malloc((size_t)buffer_size + (CACHE_LINE_SIZE-1)); - if(buffer == NULL) - { - SHOWMSG("not enough memory for write buffer"); - - SetIoErr(ERROR_NO_FREE_STORE); - goto out; - } - - /* Align the buffer to a cache line boundary. */ - aligned_buffer = (unsigned char *)(((ULONG)(buffer + (CACHE_LINE_SIZE-1))) & ~(CACHE_LINE_SIZE-1)); - - memset(aligned_buffer,0,(size_t)buffer_size); - - PROFILE_OFF(); - seek_position = Seek(fd->fd_DefaultFile,0,OFFSET_END); - PROFILE_ON(); - - if(seek_position == SEEK_ERROR && IoErr() != OK) - { - SHOWMSG("could not move to the end of the file"); - goto out; - } - - position = (off_t)seek_position; - - PROFILE_OFF(); - seek_position = Seek(fd->fd_DefaultFile,0,OFFSET_CURRENT); - PROFILE_ON(); - - current_position = (off_t)seek_position; - - /* Try to make the first write access align the file position - * to a block offset. Subsequent writes will then access the - * file at positions that are multiples of the block size. - */ - if(num_bytes > block_size && (current_position % block_size) != 0) - alignment_skip = block_size - (current_position % block_size); - else - alignment_skip = 0; - - while(num_bytes > 0) - { - if(__check_abort_enabled) - __check_abort(); - - size = buffer_size; - if(size > num_bytes) - size = num_bytes; - - /* If possible, even out the block offset. */ - if(alignment_skip > 0 && size > alignment_skip) - size = alignment_skip; - - alignment_skip = 0; - - PROFILE_OFF(); - bytes_written = Write(fd->fd_DefaultFile,aligned_buffer,size); - PROFILE_ON(); - - if(bytes_written != size) - goto out; - - num_bytes -= size; - } - - SHOWMSG("all done."); - - result = OK; - - out: - - if(buffer != NULL) - free(buffer); - - return(result); -} diff --git a/library/stdio_growfdtable.c b/library/stdio_growfdtable.c deleted file mode 100644 index 31208d0..0000000 --- a/library/stdio_growfdtable.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * $Id: stdio_growfdtable.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -int -__grow_fd_table(int max_fd) -{ - const int granularity = 10; - int new_num_fd; - int result = ERROR; - - if(max_fd == 0) - new_num_fd = __num_fd + granularity; - else - new_num_fd = max_fd; - - if(new_num_fd > __num_fd) - { - struct fd ** new_fd; - int i; - - new_fd = malloc(sizeof(*new_fd) * new_num_fd); - if(new_fd == NULL) - { - SHOWMSG("not enough memory for new file descriptor table"); - - __set_errno(ENOMEM); - goto out; - } - - for(i = __num_fd ; i < new_num_fd ; i++) - { - new_fd[i] = malloc(sizeof(*new_fd[i])); - if(new_fd[i] == NULL) - { - int j; - - SHOWMSG("not enough memory for new file descriptor table entry"); - - for(j = __num_fd ; j < i ; j++) - free(new_fd[j]); - - free(new_fd); - - __set_errno(ENOMEM); - goto out; - } - - memset(new_fd[i],0,sizeof(*new_fd[i])); - } - - if(__fd != NULL) - { - for(i = 0 ; i < __num_fd ; i++) - new_fd[i] = __fd[i]; - - free(__fd); - } - - __fd = new_fd; - __num_fd = new_num_fd; - } - - result = OK; - - out: - - return(result); -} diff --git a/library/stdio_growiobtable.c b/library/stdio_growiobtable.c deleted file mode 100644 index 0aab01d..0000000 --- a/library/stdio_growiobtable.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * $Id: stdio_growiobtable.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -int -__grow_iob_table(int max_iob) -{ - const int granularity = 10; - int new_num_iob; - int result = ERROR; - - if(max_iob == 0) - new_num_iob = __num_iob + granularity; - else - new_num_iob = max_iob; - - if(new_num_iob > __num_iob) - { - struct iob ** new_iob; - int i; - - new_iob = malloc(sizeof(*new_iob) * new_num_iob); - if(new_iob == NULL) - { - SHOWMSG("not enough memory for file table"); - - __set_errno(ENOMEM); - goto out; - } - - for(i = __num_iob ; i < new_num_iob ; i++) - { - new_iob[i] = malloc(sizeof(*new_iob[i])); - if(new_iob[i] == NULL) - { - int j; - - SHOWMSG("not enough memory for file table entry"); - - for(j = __num_iob ; j < i ; j++) - free(new_iob[j]); - - free(new_iob); - - __set_errno(ENOMEM); - goto out; - } - - memset(new_iob[i],0,sizeof(*new_iob[i])); - } - - if(__iob != NULL) - { - for(i = 0 ; i < __num_iob ; i++) - new_iob[i] = __iob[i]; - - free(__iob); - } - - __iob = new_iob; - __num_iob = new_num_iob; - } - - result = OK; - - out: - - return(result); -} diff --git a/library/stdio_headers.h b/library/stdio_headers.h deleted file mode 100644 index 43412d1..0000000 --- a/library/stdio_headers.h +++ /dev/null @@ -1,527 +0,0 @@ -/* - * $Id: stdio_headers.h,v 1.24 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#define _STDIO_HEADERS_H - -/****************************************************************************/ - -#ifndef EXEC_LIBRARIES_H -#include -#endif /* EXEC_LIBRARIES_H */ - -#ifndef EXEC_MEMORY_H -#include -#endif /* EXEC_MEMORY_H */ - -#ifndef DEVICES_TIMER_H -#include -#endif /* DEVICES_TIMER_H */ - -#ifndef DOS_DOSEXTENS_H -#include -#endif /* DOS_DOSEXTENS_H */ - -#ifndef DOS_DOSTAGS_H -#include -#endif /* DOS_DOSTAGS_H */ - -#ifndef DOS_DOSASL_H -#include -#endif /* DOS_DOSASL_H */ - -#ifndef DOS_RECORD_H -#include -#endif /* DOS_RECORD_H */ - -#ifndef LIBRARIES_LOCALE_H -#include -#endif /* LIBRARIES_LOCALE_H */ - -#ifndef UTILITY_HOOKS_H -#include -#endif /* UTILITY_HOOKS_H */ - -/****************************************************************************/ - -#ifndef CLIB_ALIB_PROTOS_H -#include -#endif /* CLIB_ALIB_PROTOS_H */ - -/****************************************************************************/ - -#ifndef PROTO_EXEC_H -#include -#endif /* PROTO_EXEC_H */ - -#ifndef PROTO_DOS_H -#include -#endif /* PROTO_DOS_H */ - -/****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include - -/****************************************************************************/ - -#include -#include -#include -#include -#include -#include - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) -#include -#endif /* FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _MATH_FP_SUPPORT_H -#include "math_fp_support.h" -#endif /* _MATH_FP_SUPPORT_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_H */ - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_H */ - -#ifndef _DEBUG_H -#include "debug.h" -#endif /* _DEBUG_H */ - -/****************************************************************************/ - -/* Forward declarations for below... */ -struct fd; -struct iob; - -/****************************************************************************/ - -/* CPU cache line size; used for alignment purposes with some data structures. - This should be determined dynamically rather than preset here. For the - 68040/68060 the cache line size is 16 bytes, for the PowerPC G4 it's - 32 bytes and 128 bytes (gross!) for the PowerPC G5. */ -#if defined(__PPC__) -#define CACHE_LINE_SIZE 32UL -#else -#define CACHE_LINE_SIZE 16UL -#endif /* __PPC__ */ - -/****************************************************************************/ - -/* The directory entry type a socket is identified with (in a FileInfoBlock). */ -#define ST_SOCKET (31082002) - -/* The same for a console stream. */ -#define ST_CONSOLE (20050402) - -/****************************************************************************/ - -/* Operations that can be performed by the file action function. */ -enum file_action_t -{ - file_action_read, - file_action_write, - file_action_seek, - file_action_close, - file_action_set_blocking, - file_action_set_async, - file_action_examine -}; - -/****************************************************************************/ - -/* A message sent to a file action function. */ -struct file_action_message -{ - enum file_action_t fam_Action; /* What to do */ - char * fam_Data; /* Where to read/write the data */ - int fam_Size; /* How much data to write */ - - long int fam_Offset; /* The seek offset */ - int fam_Mode; /* The seek mode */ - - int fam_Arg; /* Whether or not this file should - be set non-blocking or use - asynchronous I/O */ - - struct FileInfoBlock * fam_FileInfo; - struct MsgPort * fam_FileSystem; - - int fam_Error; /* Error code, if any... */ -}; - -/****************************************************************************/ - -/* The file action function for buffered files. */ -typedef int (*file_action_iob_t)(struct iob * iob,struct file_action_message * fam); - -/****************************************************************************/ - -/* The three file buffering modes supported. */ -#define IOBF_BUFFER_MODE_FULL _IOFBF /* Buffer is flushed when it fills up */ -#define IOBF_BUFFER_MODE_LINE _IOLBF /* Buffer is flushed when it fills up - or when a line end character is sent - to it */ -#define IOBF_BUFFER_MODE_NONE _IONBF /* The buffer is never used */ - -/****************************************************************************/ - -/* CAREFUL: these mask/flag definitions must match the public definitions - in or there will be trouble! */ - -#define IOBF_BUFFER_MODE 3 /* This is actually a mask which covers - the first two bits, both of which - contain the buffering mode to use. */ -#define IOBF_EOF_REACHED (1<<2) /* If this flag is set, then the end of - the file was reached while reading - from it. */ -#define IOBF_READ (1<<3) /* If this flag is set then data can - be read from this file. */ -#define IOBF_WRITE (1<<4) /* If this flag is set then data can be - written to this file. */ -#define IOBF_IN_USE (1<<5) /* If this flag is set then this file - is not available for allocation */ -#define IOBF_ERROR (1<<6) /* An error was generated by an I/O - operation. */ -#define IOBF_TEMP (1<<7) /* If this flag is set then the file will - be deleted after it has been closed */ -#define IOBF_NO_NUL (1<<8) /* Don't NUL-terminate strings written to - this stream. */ -#define IOBF_INTERNAL (1<<9) /* Not a regular file, but a buffered - file handle made up on the spot in - vsprintf(), etc. */ - -/****************************************************************************/ - -/* Each file handle is represented by the following structure. Note that this - must match the layout of the public 'FILE' structure in or - things will take a turn for the worse! */ -struct iob -{ - ULONG iob_Flags; /* Properties and options - associated with this file */ - - UBYTE * iob_Buffer; /* Points to the file buffer */ - LONG iob_BufferSize; /* Size of the buffer in bytes */ - LONG iob_BufferPosition; /* Current read position - in the buffer (grows when any - data is read from the buffer) */ - LONG iob_BufferReadBytes; /* Number of bytes available for - reading (shrinks when any data - is read from the buffer) */ - LONG iob_BufferWriteBytes; /* Number of bytes written to the - buffer which still need to be - flushed to disk (grows when any - data is written to the buffer) */ - - /************************************************************************/ - /* Public portion ends here */ - /************************************************************************/ - - file_action_iob_t iob_Action; /* The function to invoke for file - operations, such as read, - write and seek. */ - - int iob_SlotNumber; /* Points back to the iob table - entry number. */ - - int iob_Descriptor; /* Associated file descriptor */ - - STRPTR iob_String; /* Alternative source of data; - a pointer to a string */ - LONG iob_StringSize; /* Number of bytes that may be - stored in the string */ - LONG iob_StringPosition; /* Current read/write position - in the string */ - LONG iob_StringLength; /* Number of characters stored - in the string */ - - char * iob_File; /* For access tracking with the - memory allocator. */ - int iob_Line; - - APTR iob_CustomBuffer; /* A custom buffer allocated - by setvbuf() */ - - char * iob_TempFileName; /* If this is a temporary - file, this is its name */ - BPTR iob_TempFileLock; /* The directory in which this - temporary file is stored */ - - UBYTE iob_SingleByte; /* Fall-back buffer for 'unbuffered' - files */ - - struct SignalSemaphore * iob_Lock; /* For thread locking */ -}; - -/****************************************************************************/ - -#define __getc(f) \ - ((((struct iob *)(f))->iob_BufferPosition < ((struct iob *)(f))->iob_BufferReadBytes) ? \ - ((struct iob *)(f))->iob_Buffer[((struct iob *)(f))->iob_BufferPosition++] : \ - __fgetc((FILE *)(f))) - -#define __putc(c,f,m) \ - (((((struct iob *)(f))->iob_BufferWriteBytes < ((struct iob *)(f))->iob_BufferSize)) ? \ - (((struct iob *)(f))->iob_Buffer[((struct iob *)(f))->iob_BufferWriteBytes++] = (c), \ - (((m) == IOBF_BUFFER_MODE_LINE && \ - ((struct iob *)(f))->iob_Buffer[((struct iob *)(f))->iob_BufferWriteBytes-1] == '\n') ? \ - __flush(f) : \ - (((struct iob *)(f))->iob_Buffer[((struct iob *)(f))->iob_BufferWriteBytes-1]))) : \ - __fputc((c),(f),(m))) - -#define __putc_fully_buffered(c,f) \ - (((((struct iob *)(f))->iob_BufferWriteBytes < ((struct iob *)(f))->iob_BufferSize)) ? \ - (((struct iob *)(f))->iob_Buffer[((struct iob *)(f))->iob_BufferWriteBytes++] = (c)) : \ - __fputc((c),(f),IOBF_BUFFER_MODE_FULL)) - -#define __putc_line_buffered(c,f) \ - (((((struct iob *)(f))->iob_BufferWriteBytes < ((struct iob *)(f))->iob_BufferSize)) ? \ - (((struct iob *)(f))->iob_Buffer[((struct iob *)(f))->iob_BufferWriteBytes++] = (c), \ - (((c) == '\n') ? \ - __flush(f) : \ - ((c)))) : \ - __fputc((c),(f),IOBF_BUFFER_MODE_LINE)) - -/****************************************************************************/ - -#define FDF_READ (1UL<<0) /* Data can be read from this file */ -#define FDF_WRITE (1UL<<1) /* Data can be written to this file */ -#define FDF_APPEND (1UL<<2) /* Before any data is written to it, - the file position must be set to the - end of the file */ -#define FDF_NO_CLOSE (1UL<<3) /* Never close this file */ -#define FDF_NON_BLOCKING (1UL<<4) /* File was switched into non-blocking - mode (console streams only) */ -#define FDF_IS_SOCKET (1UL<<5) /* This is not a disk file but a socket */ -#define FDF_IS_LOCKED (1UL<<6) /* This file has an advisory record lock set */ -#define FDF_IN_USE (1UL<<7) /* This file is in use */ -#define FDF_CREATED (1UL<<8) /* This file was newly created and may need - to have its protection bits updated after - it has been closed */ -#define FDF_CACHE_POSITION (1UL<<9) /* Cache the file position. */ -#define FDF_ASYNC_IO (1UL<<10) /* File was switched into asynchronous I/O - mode (sockets only). */ -#define FDF_IS_INTERACTIVE (1UL<<11) /* File is attached to a console window or - something like it. */ -#define FDF_STDIO (1UL<<12) /* File is to be attached to one of the - standard input/output/error streams. */ -#define FDF_TERMIOS (1UL<<13) /* File is under termios control. - FDF_IS_INTERACTIVE should also be set. */ -/****************************************************************************/ - -/* The file action function for unbuffered files. */ -typedef int (*file_action_fd_t)(struct fd * fd,struct file_action_message * fam); - -/****************************************************************************/ - -/* Function to be called before a file descriptor is "closed". */ -typedef void (*fd_cleanup_t)(struct fd * fd); - -/****************************************************************************/ - -struct fd -{ - file_action_fd_t fd_Action; /* Function to invoke to perform actions */ - ULONG fd_Flags; /* File properties */ - struct fd * fd_Original; /* NULL if this is not a dup()ed file - descriptor; points to original - descriptor if non-NULL */ - struct fd * fd_NextLink; /* Points to next duplicate of this - file descriptor; NULL for none */ - BPTR fd_DefaultFile; /* A dos.library file handle */ - ULONG fd_Position; /* Cached file position (seek offset). */ - fd_cleanup_t fd_Cleanup; /* Cleanup function, if any. */ - - struct SignalSemaphore * fd_Lock; /* For thread locking */ - - void * fd_Aux; /* Auxilliary data for "special" files, - e.g. termios support. */ -}; - -/****************************************************************************/ - -/* Files and directories to be unlinked when the program exits. */ -struct UnlinkNode -{ - struct MinNode uln_MinNode; - - BPTR uln_Lock; /* Lock on the directory to which the - name is relative */ - STRPTR uln_Name; /* The name of the file to remove */ -}; - -/****************************************************************************/ - -struct bcpl_name -{ - unsigned char name[256]; -}; - -/****************************************************************************/ - -extern struct WBStartup * NOCOMMON __WBenchMsg; - -/****************************************************************************/ - -/* The file handle table. */ -extern struct iob ** NOCOMMON __iob; -extern int NOCOMMON __num_iob; - -/****************************************************************************/ - -/* The file descriptor table. */ -extern struct fd ** NOCOMMON __fd; -extern int NOCOMMON __num_fd; - -/****************************************************************************/ - -extern char * NOCOMMON __file_lock_semaphore_name; - -/****************************************************************************/ - -extern BOOL NOCOMMON __no_standard_io; - -/****************************************************************************/ - -/*extern int __iob_write_buffer_is_full(struct iob * file);*/ - -#define __iob_write_buffer_is_full(file) \ - (((struct iob *)file)->iob_BufferSize > 0 && \ - ((struct iob *)file)->iob_BufferWriteBytes == ((struct iob *)file)->iob_BufferSize) - -/****************************************************************************/ - -#define __iob_write_buffer_is_valid(file) \ - (((struct iob *)file)->iob_BufferWriteBytes > 0) - -/****************************************************************************/ - -#define __iob_num_unwritten_bytes(file) \ - (((struct iob *)file)->iob_BufferWriteBytes) - -/****************************************************************************/ - -/*extern int __iob_read_buffer_is_empty(struct iob * file);*/ - -#define __iob_read_buffer_is_empty(file) \ - (((struct iob *)file)->iob_BufferReadBytes == 0 || \ - ((struct iob *)file)->iob_BufferPosition == ((struct iob *)file)->iob_BufferReadBytes) - -/****************************************************************************/ - -#define __iob_num_unread_bytes(file) \ - ((((struct iob *)file)->iob_BufferReadBytes > 0 && \ - ((struct iob *)file)->iob_BufferPosition < ((struct iob *)file)->iob_BufferReadBytes) \ - ? (((struct iob *)file)->iob_BufferReadBytes - ((struct iob *)file)->iob_BufferPosition) \ - : 0) - -/****************************************************************************/ - -#define __iob_read_buffer_is_valid(file) \ - (((struct iob *)file)->iob_BufferReadBytes > 0) - -/****************************************************************************/ - -#define __fd_is_aliased(fd) \ - ((fd)->fd_Original != NULL || (fd)->fd_NextLink != NULL) - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -/****************************************************************************/ - -extern void __stdio_lock(void); -extern void __stdio_unlock(void); -extern void __stdio_lock_exit(void); -extern int __stdio_lock_init(void); - -/****************************************************************************/ - -extern void __fd_lock(struct fd *fd); -extern void __fd_unlock(struct fd *fd); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#define __stdio_lock() ((void)0) -#define __stdio_unlock() ((void)0) -#define __stdio_lock_exit() ((void)0) -#define __stdio_lock_init() (0) - -/****************************************************************************/ - -#define __fd_lock(fd) ((void)0) -#define __fd_unlock(fd) ((void)0) - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ - -/****************************************************************************/ - -#ifndef _STDIO_PROTOS_H -#include "stdio_protos.h" -#endif /* _STDIO_PROTOS_H */ - -/****************************************************************************/ - -#endif /* _STDIO_HEADERS_H */ diff --git a/library/stdio_init_exit.c b/library/stdio_init_exit.c deleted file mode 100644 index bfcad18..0000000 --- a/library/stdio_init_exit.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * $Id: stdio_init_exit.c,v 1.32 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -#ifndef _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -/* The file handle table. */ -struct iob ** NOCOMMON __iob; -int NOCOMMON __num_iob; - -/****************************************************************************/ - -/* The file descriptor table. */ -struct fd ** NOCOMMON __fd; -int NOCOMMON __num_fd; - -/****************************************************************************/ - -void -__close_all_files(void) -{ - int i; - - ENTER(); - - __stdio_lock(); - - if(__num_iob > 0) - { - for(i = 0 ; i < __num_iob ; i++) - { - if(FLAG_IS_SET(__iob[i]->iob_Flags,IOBF_IN_USE)) - fclose((FILE *)__iob[i]); - } - - __num_iob = 0; - } - - if(__num_fd > 0) - { - for(i = 0 ; i < __num_fd ; i++) - { - if(FLAG_IS_SET(__fd[i]->fd_Flags,FDF_IN_USE)) - close(i); - } - - __num_fd = 0; - } - - __stdio_unlock(); - - LEAVE(); -} - -/****************************************************************************/ - -STDIO_DESTRUCTOR(stdio_exit) -{ - ENTER(); - - __close_all_files(); - - __stdio_lock_exit(); - - LEAVE(); -} - -/****************************************************************************/ - -STDIO_CONSTRUCTOR(stdio_init) -{ - const int num_standard_files = (STDERR_FILENO - STDIN_FILENO + 1); - - BOOL success = FALSE; - - ENTER(); - - if(__stdio_lock_init() < 0) - goto out; - - if(__grow_iob_table(num_standard_files) < 0) - goto out; - - if(__grow_fd_table(num_standard_files) < 0) - goto out; - - success = TRUE; - - out: - - SHOWVALUE(success); - LEAVE(); - - if(success) - CONSTRUCTOR_SUCCEED(); - else - CONSTRUCTOR_FAIL(); -} diff --git a/library/stdio_initializefd.c b/library/stdio_initializefd.c deleted file mode 100644 index 043177d..0000000 --- a/library/stdio_initializefd.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * $Id: stdio_initializefd.c,v 1.5 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -void -__initialize_fd( - struct fd * fd, - file_action_fd_t action_function, - BPTR default_file, - ULONG flags, - struct SignalSemaphore * lock) -{ - assert( fd != NULL && action_function != NULL ); - - memset(fd,0,sizeof(*fd)); - - fd->fd_DefaultFile = default_file; - fd->fd_Flags = flags; - fd->fd_Action = action_function; - fd->fd_Lock = lock; - fd->fd_Aux = NULL; -} diff --git a/library/stdio_initializeiob.c b/library/stdio_initializeiob.c deleted file mode 100644 index 95bd4a5..0000000 --- a/library/stdio_initializeiob.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * $Id: stdio_initializeiob.c,v 1.4 2005-02-27 18:09:10 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -void -__initialize_iob( - struct iob * iob, - file_action_iob_t action_function, - STRPTR custom_buffer, - STRPTR buffer, - int buffer_size, - int file_descriptor, - int slot_number, - ULONG flags, - struct SignalSemaphore * lock) -{ - assert( iob != NULL && action_function != NULL ); - - memset(iob,0,sizeof(*iob)); - - iob->iob_CustomBuffer = custom_buffer; - iob->iob_Buffer = buffer; - iob->iob_BufferSize = buffer_size; - iob->iob_Descriptor = file_descriptor; - iob->iob_SlotNumber = slot_number; - iob->iob_Flags = flags; - iob->iob_Action = action_function; - iob->iob_Lock = lock; -} diff --git a/library/stdio_iobhookentry.c b/library/stdio_iobhookentry.c deleted file mode 100644 index f914723..0000000 --- a/library/stdio_iobhookentry.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * $Id: stdio_iobhookentry.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -__iob_hook_entry( - struct iob * file_iob, - struct file_action_message * fam) -{ - struct fd * fd; - int result; - - assert( fam != NULL && file_iob != NULL ); - - switch(fam->fam_Action) - { - case file_action_read: - case file_action_write: - case file_action_seek: - case file_action_close: - - assert( file_iob->iob_Descriptor >= 0 && file_iob->iob_Descriptor < __num_fd ); - assert( __fd[file_iob->iob_Descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_iob->iob_Descriptor]->fd_Flags,FDF_IN_USE) ); - - /* When closing, we want to affect this very file descriptor - and not the original one associated with an alias of it. */ - if(fam->fam_Action == file_action_close) - fd = __get_file_descriptor_dont_resolve(file_iob->iob_Descriptor); - else - fd = __get_file_descriptor(file_iob->iob_Descriptor); - - if(fd == NULL) - { - fam->fam_Error = EBADF; - - result = EOF; - - break; - } - - assert( fd->fd_Action != NULL ); - - result = (*fd->fd_Action)(fd,fam); - - break; - - default: - - SHOWVALUE(fam->fam_Action); - - fam->fam_Error = EBADF; - - result = EOF; - - break; - } - - RETURN(result); - return(result); -} diff --git a/library/stdio_lock.c b/library/stdio_lock.c deleted file mode 100644 index 1829ffb..0000000 --- a/library/stdio_lock.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * $Id: stdio_lock.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -/****************************************************************************/ - -static struct SignalSemaphore * stdio_lock; - -/****************************************************************************/ - -void -__stdio_lock(void) -{ - assert( stdio_lock != NULL ); - - if(stdio_lock != NULL) - ObtainSemaphore(stdio_lock); -} - -/****************************************************************************/ - -void -__stdio_unlock(void) -{ - assert( stdio_lock != NULL ); - - if(stdio_lock != NULL) - ReleaseSemaphore(stdio_lock); -} - -/****************************************************************************/ - -void -__stdio_lock_exit(void) -{ - __delete_semaphore(stdio_lock); - stdio_lock = NULL; -} - -/****************************************************************************/ - -int -__stdio_lock_init(void) -{ - int result = ERROR; - - stdio_lock = __create_semaphore(); - if(stdio_lock == NULL) - goto out; - - result = OK; - - out: - - return(result); -} - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ diff --git a/library/stdio_locksemaphorename.c b/library/stdio_locksemaphorename.c deleted file mode 100644 index 847be69..0000000 --- a/library/stdio_locksemaphorename.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: stdio_locksemaphorename.c,v 1.3 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -char * NOCOMMON __file_lock_semaphore_name = "Advisory File Locking"; diff --git a/library/stdio_nostdio.c b/library/stdio_nostdio.c deleted file mode 100644 index 8ce10d0..0000000 --- a/library/stdio_nostdio.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: stdio_nostdio.c,v 1.3 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -BOOL NOCOMMON __no_standard_io; diff --git a/library/stdio_openiob.c b/library/stdio_openiob.c deleted file mode 100644 index 6c38201..0000000 --- a/library/stdio_openiob.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * $Id: stdio_openiob.c,v 1.13 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -int -__open_iob(const char *filename, const char *mode, int file_descriptor, int slot_number) -{ - struct SignalSemaphore * lock; - ULONG file_flags; - int result = ERROR; - int open_mode; - struct fd * fd = NULL; - STRPTR buffer = NULL; - STRPTR aligned_buffer; - struct iob * file; - - ENTER(); - - SHOWSTRING(filename); - SHOWSTRING(mode); - SHOWVALUE(slot_number); - - if(__check_abort_enabled) - __check_abort(); - - __stdio_lock(); - - assert( mode != NULL && 0 <= slot_number && slot_number < __num_iob ); - - file = __iob[slot_number]; - - assert( FLAG_IS_CLEAR(file->iob_Flags,IOBF_IN_USE) ); - - /* Figure out if the file descriptor provided is any use. */ - if(file_descriptor >= 0) - { - assert( file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - } - - /* The first character selects the access mode: read, write or append. */ - switch(mode[0]) - { - case 'r': - - SHOWMSG("read mode"); - - open_mode = O_RDONLY; - break; - - case 'w': - - SHOWMSG("write mode"); - - open_mode = O_WRONLY | O_CREAT | O_TRUNC; - break; - - case 'a': - - SHOWMSG("append mode"); - - open_mode = O_WRONLY | O_CREAT | O_APPEND; - break; - - default: - - D(("unsupported file open mode '%lc'",mode[0])); - - __set_errno(EINVAL); - goto out; - } - - /* If the second or third character is a '+', switch to read/write mode. */ - if((mode[1] == '+') || (mode[1] != '\0' && mode[2] == '+')) - { - SHOWMSG("read/write access"); - - CLEAR_FLAG(open_mode,O_RDONLY); - CLEAR_FLAG(open_mode,O_WRONLY); - - SET_FLAG(open_mode,O_RDWR); - } - - SHOWMSG("allocating file buffer"); - - /* Allocate a little more memory than necessary. */ - buffer = malloc(BUFSIZ + (CACHE_LINE_SIZE-1)); - if(buffer == NULL) - { - SHOWMSG("that didn't work"); - - __set_errno(ENOBUFS); - goto out; - } - - /* Align the buffer start address to a cache line boundary. */ - aligned_buffer = (char *)((ULONG)(buffer + (CACHE_LINE_SIZE-1)) & ~(CACHE_LINE_SIZE-1)); - - if(file_descriptor < 0) - { - assert( filename != NULL ); - - file_descriptor = open(filename,open_mode); - if(file_descriptor < 0) - { - SHOWMSG("couldn't open the file"); - goto out; - } - } - else - { - /* Update the append flag. */ - if(FLAG_IS_SET(open_mode,O_APPEND)) - SET_FLAG(fd->fd_Flags,FDF_APPEND); - else - CLEAR_FLAG(fd->fd_Flags,FDF_APPEND); - } - - #if defined(__THREAD_SAFE) - { - /* Allocate memory for an arbitration mechanism, then - initialize it. */ - lock = __create_semaphore(); - if(lock == NULL) - goto out; - } - #else - { - lock = NULL; - } - #endif /* __THREAD_SAFE */ - - /* Figure out the buffered file access mode by looking at the open mode. */ - file_flags = IOBF_IN_USE | IOBF_NO_NUL; - - if(FLAG_IS_SET(open_mode,O_RDONLY) || FLAG_IS_SET(open_mode,O_RDWR)) - SET_FLAG(file_flags,IOBF_READ); - - if(FLAG_IS_SET(open_mode,O_WRONLY) || FLAG_IS_SET(open_mode,O_RDWR)) - SET_FLAG(file_flags,IOBF_WRITE); - - __initialize_iob(file,__iob_hook_entry, - buffer, - aligned_buffer,BUFSIZ, - file_descriptor, - slot_number, - file_flags, - lock); - - buffer = NULL; - - result = OK; - - out: - - if(buffer != NULL) - free(buffer); - - __stdio_unlock(); - - RETURN(result); - return(result); -} diff --git a/library/stdio_parent_of_fh.c b/library/stdio_parent_of_fh.c deleted file mode 100644 index 07e2800..0000000 --- a/library/stdio_parent_of_fh.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * $Id: stdio_parent_of_fh.c,v 1.1 2005-02-18 18:53:16 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -/* This is used in place of ParentOfFH() in order to work around a bug in - * dos.library V40 and below: a "NIL:" file handle will crash the - * ParentOfFH() function. - */ -BPTR -__safe_parent_of_file_handle(BPTR file_handle) -{ - BPTR result = ZERO; - - #ifndef __amigaos4__ - { - struct FileHandle * fh = (struct FileHandle *)BADDR(file_handle); - - if(fh == NULL || fh->fh_Type == NULL) - { - SetIoErr(ERROR_OBJECT_WRONG_TYPE); - goto out; - } - } - #endif /* __amigaos4__ */ - - PROFILE_OFF(); - result = ParentOfFH(file_handle); - PROFILE_ON(); - - out: - - return(result); -} diff --git a/library/stdio_perror.c b/library/stdio_perror.c deleted file mode 100644 index e4b3606..0000000 --- a/library/stdio_perror.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * $Id: stdio_perror.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -void -perror(const char * s) -{ - char * error_message; - int error = __get_errno(); - - if(s != NULL) - fprintf(stderr,"%s: ",s); - - error_message = strerror(error); - - if(error_message != NULL) - fprintf(stderr,"%s",error_message); - else - fprintf(stderr,"error %d",error); - - fprintf(stderr,"\n"); -} diff --git a/library/stdio_popen.c b/library/stdio_popen.c deleted file mode 100644 index 61f47a6..0000000 --- a/library/stdio_popen.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * $Id: stdio_popen.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -pclose(FILE *stream) -{ - int result = ERROR; - - ENTER(); - - SHOWPOINTER(stream); - - assert(stream != NULL); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - SHOWMSG("invalid stream parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - fclose(stream); - - /* ZZZ we actually could catch the program's termination code - * by passing an exit function address to SystemTags() below. - */ - result = OK; - - out: - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -FILE * -popen(const char *command, const char *type) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info command_nti; - #endif /* UNIX_PATH_SEMANTICS */ - char * command_copy = NULL; - BPTR input = ZERO; - BPTR output = ZERO; - char pipe_file_name[40]; - FILE * result = NULL; - LONG status; - unsigned long task_address; - time_t now; - int i; - - ENTER(); - - SHOWSTRING(command); - SHOWSTRING(type); - - assert(command != NULL && type != NULL); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(command == NULL || type == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* The first character selects the access mode: read or write. We don't - support anything else. */ - switch(type[0]) - { - case 'r': - - SHOWMSG("read mode"); - break; - - case 'w': - - SHOWMSG("write mode"); - break; - - default: - - D(("unsupported access mode '%lc'",type[0])); - - __set_errno(EINVAL); - goto out; - } - - /* The current PIPE: device only supports unidirectional connections. */ - if((type[1] == '+') || (type[1] != '\0' && type[2] == '+')) - { - D(("unsupported access mode '%s'",type)); - - __set_errno(EINVAL); - goto out; - } - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - char just_the_command_name[MAXPATHLEN+1]; - BOOL quotes_needed = FALSE; - char * command_name; - size_t command_len; - BOOL have_quote; - size_t len; - - /* We may need to replace the path specified for the command, - so let's figure out first how long the command name, - including everything, really is. */ - len = strlen(command); - command_len = len; - - have_quote = FALSE; - for(i = 0 ; i < (int)len ; i++) - { - if(command[i] == '\"') - { - quotes_needed = TRUE; - - have_quote ^= TRUE; - } - - if((command[i] == ' ' || command[i] == '\t') && NOT have_quote) - { - command_len = i; - break; - } - } - - /* This may be too long for proper translation... */ - if(command_len > MAXPATHLEN) - { - __set_errno(ENAMETOOLONG); - - result = NULL; - goto out; - } - - /* Grab the command name itself, then have it translated. */ - command_name = just_the_command_name; - for(i = 0; (size_t)i < command_len; i++) - { - if(command[i] != '\"') - (*command_name++) = command[i]; - } - - (*command_name) = '\0'; - - command_name = just_the_command_name; - - if(__translate_unix_to_amiga_path_name((const char **)&command_name,&command_nti) != 0) - { - result = NULL; - goto out; - } - - /* Now put it all together again */ - command_copy = malloc(1 + strlen(command_name) + 1 + strlen(&command[command_len]) + 1); - if(command_copy == NULL) - { - __set_errno(ENOMEM); - - result = NULL; - goto out; - } - - if(quotes_needed) - { - command_copy[0] = '\"'; - strcpy(&command_copy[1],command_name); - strcat(command_copy,"\""); - } - else - { - strcpy(command_copy,command_name); - } - - strcat(command_copy,&command[command_len]); - - command = command_copy; - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - /* Build a (hopefully) unique name for the pipe stream to open. We - construct it from the current process address, converted into - an octal number, followed by the current time (in seconds), - converted into another octal number. */ - strcpy(pipe_file_name,"PIPE:"); - - task_address = (unsigned long)FindTask(NULL); - - for(i = strlen(pipe_file_name) ; task_address != 0 && i < (int)sizeof(pipe_file_name)-1 ; i++) - { - pipe_file_name[i] = '0' + (task_address % 8); - task_address = task_address / 8; - } - - pipe_file_name[i++] = '.'; - - time(&now); - - for( ; now != 0 && i < (int)sizeof(pipe_file_name)-1 ; i++) - { - pipe_file_name[i] = '0' + (now % 8); - now = now / 8; - } - - pipe_file_name[i] = '\0'; - - SHOWSTRING(pipe_file_name); - - PROFILE_OFF(); - - /* Now open the input and output streams for the program to launch. */ - if(type[0] == 'r') - { - /* Read mode: we want to read the output of the program; the program - should read from "NIL:". */ - input = Open("NIL:",MODE_NEWFILE); - if(input != ZERO) - output = Open(pipe_file_name,MODE_NEWFILE); - } - else - { - /* Write mode: we want to send data to the program; the program - should write to "NIL:". */ - input = Open(pipe_file_name,MODE_NEWFILE); - if(input != ZERO) - output = Open("NIL:",MODE_NEWFILE); - } - - PROFILE_ON(); - - /* Check if both I/O streams could be opened. */ - if(input == ZERO || output == ZERO) - { - SHOWMSG("couldn't open the streams"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - PROFILE_OFF(); - - /* Now try to launch the program. */ - status = SystemTags((STRPTR)command, - SYS_Input, input, - SYS_Output, output, - SYS_Asynch, TRUE, - SYS_UserShell, TRUE, - TAG_END); - - PROFILE_ON(); - - /* If launching the program returned -1 then it could not be started. - We'll need to close the I/O streams we opened above. */ - if(status == -1) - { - SHOWMSG("SystemTagList() failed"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - /* OK, the program is running. Once it terminates, it will automatically - shut down the streams we opened for it. */ - input = output = ZERO; - - /* Now try to open the pipe we will use to exchange data with the program. */ - result = fopen(pipe_file_name,type); - - out: - - if(command_copy != NULL) - free(command_copy); - - PROFILE_OFF(); - - if(input != ZERO) - Close(input); - - if(output != ZERO) - Close(output); - - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/stdio_printf.c b/library/stdio_printf.c deleted file mode 100644 index c532fdb..0000000 --- a/library/stdio_printf.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * $Id: stdio_printf.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -printf(const char *format, ...) -{ - int result = EOF; - va_list arg; - - ENTER(); - - SHOWSTRING(format); - - assert( format != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(format == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - va_start(arg,format); - result = vfprintf(stdout,format,arg); - va_end(arg); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_protos.h b/library/stdio_protos.h deleted file mode 100644 index 524116f..0000000 --- a/library/stdio_protos.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * $Id: stdio_protos.h,v 1.18 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_PROTOS_H -#define _STDIO_PROTOS_H - -/****************************************************************************/ - -#ifndef UTILITY_HOOKS_H -#include -#endif /* UTILITY_HOOKS_H */ - -/****************************************************************************/ - -#ifndef _STDIO_H -#include -#endif /* _STDIO_H */ - -/****************************************************************************/ - -#ifndef _MATH_FP_SUPPORT_H -#include "math_fp_support.h" -#endif /* _MATH_FP_SUPPORT_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#ifndef _STDIO_HEADERS_H - -/* Forward declarations */ -struct file_action_message; -struct iob; -struct fd; - -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -/* stdio_init_exit.c */ -void __close_all_files(void); - -/****************************************************************************/ - -/* stdio_translateioerror.c */ -extern int __translate_io_error_to_errno(LONG io_error); -extern int __translate_access_io_error_to_errno(LONG io_error); - -/****************************************************************************/ - -/* stdio_get_file_descriptor.c */ -extern struct fd * __get_file_descriptor(int file_descriptor); -extern struct fd * __get_file_descriptor_dont_resolve(int file_descriptor); - -/****************************************************************************/ - -/* stdio_iobhookentry.c */ -extern int __iob_hook_entry(struct iob * iob,struct file_action_message * fam); - -/****************************************************************************/ - -/* stdio_fdhookentry.c */ -extern int __fd_hook_entry(struct fd * fd,struct file_action_message * fam); - -/****************************************************************************/ - -/* stdio_initializefd.c */ -extern void __initialize_fd(struct fd * fd,file_action_fd_t action_function,BPTR default_file,ULONG flags,struct SignalSemaphore * lock); - -/****************************************************************************/ - -/* stdio_findvacantfdentry.c */ -extern BOOL __is_valid_fd(struct fd * fd); -extern int __find_vacant_fd_entry(void); - -/****************************************************************************/ - -/* stdio_initializeiob.c */ -extern void __initialize_iob(struct iob * iob,file_action_iob_t action_function,STRPTR custom_buffer,STRPTR buffer,int buffer_size,int file_descriptor,int slot_number,ULONG flags,struct SignalSemaphore * lock); - -/****************************************************************************/ - -/* stdio_findvacantiobentry.c */ -extern BOOL __is_valid_iob(struct iob * iob); -extern int __find_vacant_iob_entry(void); - -/****************************************************************************/ - -/* stdio_growfdtable.c */ -extern int __grow_fd_table(int max_fd); - -/****************************************************************************/ - -/* stdio_growiobtable.c */ -extern int __grow_iob_table(int max_fd); - -/****************************************************************************/ - -/* stdio_openiob.c */ -extern int __open_iob(const char *filename, const char *mode, int file_descriptor, int slot_number); - -/****************************************************************************/ - -/* stdio_filliobreadbuffer.c */ -extern int __fill_iob_read_buffer(struct iob * file); - -/****************************************************************************/ - -/* stdio_dropiobreadbuffer.c */ -extern int __drop_iob_read_buffer(struct iob * file); - -/****************************************************************************/ - -/* stdio_flushiobwritebuffer.c */ -extern int __flush_iob_write_buffer(struct iob * file); - -/****************************************************************************/ - -/* stdio_fgetc.c */ -extern int __fgetc_check(FILE * stream); -extern int __fgetc(FILE *stream); - -/****************************************************************************/ - -/* stdio_fputc.c */ -extern int __fputc_check(FILE *stream); -extern int __fputc(int c,FILE *stream,int buffer_mode); - -/****************************************************************************/ - -/* stdio_sscanf_hook_entry.c */ -extern int __sscanf_hook_entry(struct iob *string,struct file_action_message *fam); - -/****************************************************************************/ - -/* stdio_vasprintf_hook_entry.c */ -extern int __vasprintf_hook_entry(struct iob *string,struct file_action_message *fam); - -/****************************************************************************/ - -/* stdio_vsprintf_hook_entry.c */ -extern int __vsprintf_hook_entry(struct iob *string,struct file_action_message *fam); - -/****************************************************************************/ - -/* stdio_vsnprintf_hook_entry.c */ -extern int __vsnprintf_hook_entry(struct iob *string,struct file_action_message *fam); - -/****************************************************************************/ - -/* stdio_duplicate_fd.c */ -extern void __duplicate_fd(struct fd * duplicate_fd,struct fd * original_fd); - -/****************************************************************************/ - -/* stdio_examine_fh.c */ -extern LONG __safe_examine_file_handle(BPTR file_handle,struct FileInfoBlock *fib); - -/****************************************************************************/ - -/* stdio_parent_of_fh.c */ -extern BPTR __safe_parent_of_file_handle(BPTR file_handle); - -/****************************************************************************/ - -/* stdio_grow_file.c */ -extern int __grow_file_size(struct fd * fd,int num_bytes); - -/****************************************************************************/ - -/* unistd_sync_fd.c */ -extern int __sync_fd(struct fd * fd,int mode); - -/****************************************************************************/ - -/* stdio_record_locking.c */ -extern int __handle_record_locking(int cmd,struct flock * l,struct fd * fd,int * error_ptr); - -/****************************************************************************/ - -/* stdio_remove_fd_alias.c */ -extern void __remove_fd_alias(struct fd * fd); - -/****************************************************************************/ - -/* stdio_file_init.c */ -extern int __stdio_file_init(void); - -/****************************************************************************/ - -/* stdio_flush_all_files.c */ -extern int __flush_all_files(int buffer_mode); - -/****************************************************************************/ - -#endif /* _STDIO_PROTOS_H */ diff --git a/library/stdio_putc.c b/library/stdio_putc.c deleted file mode 100644 index f2a1a1e..0000000 --- a/library/stdio_putc.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: stdio_putc.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#undef putc - -/****************************************************************************/ - -int -putc(int c,FILE *stream) -{ - int result = EOF; - - assert( stream != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = fputc(c,stream); - - out: - - return(result); -} diff --git a/library/stdio_putc_unlocked.c b/library/stdio_putc_unlocked.c deleted file mode 100644 index bbf23aa..0000000 --- a/library/stdio_putc_unlocked.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: stdio_putc_unlocked.c,v 1.2 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#undef putc_unlocked - -/****************************************************************************/ - -int -putc_unlocked(int c,FILE *stream) -{ - int result = EOF; - - assert( stream != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = __putc_unlocked(c,stream); - - out: - - return(result); -} diff --git a/library/stdio_putchar.c b/library/stdio_putchar.c deleted file mode 100644 index d31f874..0000000 --- a/library/stdio_putchar.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: stdio_putchar.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#undef putchar - -/****************************************************************************/ - -int -putchar(int c) -{ - int result; - - result = fputc(c,stdout); - - return(result); -} diff --git a/library/stdio_putchar_unlocked.c b/library/stdio_putchar_unlocked.c deleted file mode 100644 index 8d90b02..0000000 --- a/library/stdio_putchar_unlocked.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: stdio_putchar_unlocked.c,v 1.2 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#undef putchar_unlocked - -/****************************************************************************/ - -int -putchar_unlocked(int c) -{ - int result = EOF; - - assert( stdout != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stdout == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = __putc_unlocked(c,stdout); - - out: - - return(result); -} diff --git a/library/stdio_puts.c b/library/stdio_puts.c deleted file mode 100644 index b8bf78e..0000000 --- a/library/stdio_puts.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * $Id: stdio_puts.c,v 1.7 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -puts(const char *s) -{ - struct iob * file = (struct iob *)stdout; - int result = EOF; - int buffer_mode; - int c; - - ENTER(); - - SHOWSTRING(s); - - assert( s != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stdout); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - buffer_mode = (file->iob_Flags & IOBF_BUFFER_MODE); - if(buffer_mode == IOBF_BUFFER_MODE_NONE) - buffer_mode = IOBF_BUFFER_MODE_LINE; - - if(__fputc_check(stdout) < 0) - goto out; - - while((c = (*s++)) != '\0') - { - if(__putc(c,stdout,buffer_mode) == EOF) - goto out; - } - - if(__putc('\n',stdout,buffer_mode) == EOF) - goto out; - - result = OK; - - out: - - /* Note: if buffering is disabled for this stream, then we still - may have buffered data around, queued to be printed right now. - This is intended to improve performance as it takes more effort - to write a single character to a file than to write a bunch. */ - if(result == 0 && (file->iob_Flags & IOBF_BUFFER_MODE) == IOBF_BUFFER_MODE_NONE) - { - if(__iob_write_buffer_is_valid(file) && __flush_iob_write_buffer(file) < 0) - { - SHOWMSG("couldn't flush the write buffer"); - result = EOF; - } - } - - funlockfile(stdout); - - RETURN(result); - return(result); -} diff --git a/library/stdio_record_locking.c b/library/stdio_record_locking.c deleted file mode 100644 index 50675ca..0000000 --- a/library/stdio_record_locking.c +++ /dev/null @@ -1,1254 +0,0 @@ -/* - * $Id: stdio_record_locking.c,v 1.13 2005-04-25 15:39:56 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -#ifndef _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#if defined(UNIX_PATH_SEMANTICS) - -/****************************************************************************/ - -/* System-wide global data structure all programs which use advisory file record - * locking with this runtime library will use. - */ -struct FileLockSemaphore -{ - struct SignalSemaphore fls_Semaphore; /* Standard signal semaphore part */ - UWORD fls_Size; /* Size of this data structure (may grow) */ - struct MinList fls_LockList; /* List of lock nodes */ -}; - -/* Each file which has regions locked is registered through the following - * data structure. - */ -struct FileLockNode -{ - struct MinNode fln_MinNode; /* Standard node */ - struct MinList fln_LockedRegionList; /* List of locked regions */ - - BPTR fln_FileParentDir; /* Refers to the file's parent directory */ - UBYTE fln_FileName[1]; /* Name of the file; together with the - * parent directory, this should uniquely - * identify the file. - */ -}; - -/* A single locked region, as associated with a file. */ -struct LockedRegionNode -{ - struct MinNode lrn_MinNode; /* Standard node */ - LONG lrn_Start; /* Where the region begins */ - LONG lrn_Stop; /* Where the region ends (inclusive) */ - LONG lrn_Length; /* Original length requested */ - pid_t lrn_Owner; /* Which process owns the region */ - BOOL lrn_Shared; /* Whether or not this region has been locked - * for shared access. - */ -}; - -/****************************************************************************/ - -static struct FileLockSemaphore * FileLockSemaphore; - -/****************************************************************************/ - -STATIC VOID release_file_lock_semaphore(struct FileLockSemaphore *fls); -STATIC struct FileLockSemaphore *obtain_file_lock_semaphore(BOOL shared); -STATIC VOID remove_locked_region_node(struct FileLockSemaphore *fls, struct fd *fd, LONG start, LONG stop, LONG original_length); -STATIC VOID delete_locked_region_node(struct LockedRegionNode *lrn); -STATIC LONG create_locked_region_node(struct LockedRegionNode **result_ptr); -STATIC VOID delete_file_lock_node(struct FileLockNode *fln); -STATIC LONG create_file_lock_node(struct fd *fd, struct FileLockNode **result_ptr); -STATIC LONG find_file_lock_node_by_file_handle(struct FileLockSemaphore *fls, BPTR file_handle, struct FileLockNode **result_ptr); -STATIC LONG find_file_lock_node_by_drawer_and_name(struct FileLockSemaphore *fls, BPTR dir_lock, STRPTR file_name, struct FileLockNode **result_ptr); -STATIC struct LockedRegionNode *find_colliding_region(struct FileLockNode *fln, LONG start, LONG stop, BOOL shared); -STATIC VOID cleanup_locked_records(struct fd * fd); - -/****************************************************************************/ - -STATIC VOID -release_file_lock_semaphore(struct FileLockSemaphore * fls) -{ - ENTER(); - - SHOWPOINTER(fls); - - if(fls != NULL) - ReleaseSemaphore((struct SignalSemaphore *)fls); - - LEAVE(); -} - -/****************************************************************************/ - -STATIC struct FileLockSemaphore * -obtain_file_lock_semaphore(BOOL shared) -{ - struct FileLockSemaphore * result = NULL; - - ENTER(); - - if(FileLockSemaphore == NULL && __file_lock_semaphore_name != NULL && __file_lock_semaphore_name[0] != '\0') - { - struct FileLockSemaphore * fls = NULL; - char * semaphore_name_copy = NULL; - - /* We allocate the new semaphore first, so that we don't spend - any time in Forbid() allocating memory. */ - #if defined(__amigaos4__) - { - semaphore_name_copy = AllocVec(strlen(__file_lock_semaphore_name)+1,MEMF_ANY|MEMF_PUBLIC); - if(semaphore_name_copy != NULL) - { - strcpy(semaphore_name_copy,__file_lock_semaphore_name); - - fls = AllocSysObjectTags(ASOT_SEMAPHORE, - ASOSEM_Size, sizeof(*fls), - ASOSEM_Name, semaphore_name_copy, - ASOSEM_Public, FALSE, /* we want to add it ourselves */ - ASOSEM_Pri, 1, - TAG_END); - } - } - #else - { - fls = AllocVec(sizeof(*fls) + strlen(__file_lock_semaphore_name) + 1,MEMF_ANY|MEMF_PUBLIC); - if(fls != NULL) - { - memset(fls,0,sizeof(*fls)); - - fls->fls_Semaphore.ss_Link.ln_Name = (char *)(fls + 1); - strcpy(fls->fls_Semaphore.ss_Link.ln_Name,__file_lock_semaphore_name); - - fls->fls_Semaphore.ss_Link.ln_Pri = 1; - } - } - #endif /* __amigaos4__ */ - - SHOWMSG("try to find the locking semaphore"); - - Forbid(); - - FileLockSemaphore = (struct FileLockSemaphore *)FindSemaphore((STRPTR)__file_lock_semaphore_name); - if(FileLockSemaphore == NULL) - { - SHOWMSG("didn't find it; we're going to add our own"); - - if(fls != NULL) - { - SHOWMSG("adding our own semaphore"); - - fls->fls_Size = sizeof(*fls); - NewList((struct List *)&fls->fls_LockList); - - AddSemaphore(&fls->fls_Semaphore); - - FileLockSemaphore = fls; - fls = NULL; - - semaphore_name_copy = NULL; - } - else - { - SHOWMSG("not enough memory"); - } - } - - Permit(); - - if(FileLockSemaphore != NULL && FileLockSemaphore->fls_Size < sizeof(*FileLockSemaphore)) - { - SHOWMSG("semaphore found, but it's too short"); - - SHOWVALUE(FileLockSemaphore->fls_Size); - SHOWVALUE(sizeof(*FileLockSemaphore)); - - FileLockSemaphore = NULL; - } - - /* Release the memory allocated for the semaphore, in case - we didn't need it after all. */ - if(fls != NULL) - { - #if defined(__amigaos4__) - { - FreeVec(semaphore_name_copy); - - FreeSysObject(ASOT_SEMAPHORE,fls); - } - #else - { - FreeVec(fls); - } - #endif /* __amigaos4__ */ - } - } - - if(FileLockSemaphore != NULL) - { - SHOWMSG("got a semaphore, using it..."); - - PROFILE_OFF(); - - if(shared) - { - #if defined(__amigaos4__) - { - ObtainSemaphoreShared((struct SignalSemaphore *)FileLockSemaphore); - } - #else - { - if(((struct Library *)SysBase)->lib_Version >= 39) - { - ObtainSemaphoreShared((struct SignalSemaphore *)FileLockSemaphore); - } - else - { - /* Workaround for shared semaphore nesting problem. */ - if(CANNOT AttemptSemaphoreShared((struct SignalSemaphore *)FileLockSemaphore)) - { - if(CANNOT AttemptSemaphore((struct SignalSemaphore *)FileLockSemaphore)) - ObtainSemaphoreShared((struct SignalSemaphore *)FileLockSemaphore); - } - } - } - #endif /* __amigaos4__ */ - } - else - { - ObtainSemaphore((struct SignalSemaphore *)FileLockSemaphore); - } - - PROFILE_ON(); - - result = FileLockSemaphore; - } - else - { - SHOWMSG("didn't get the semaphore"); - } - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -STATIC VOID -remove_locked_region_node(struct FileLockSemaphore * fls,struct fd * fd,LONG start,LONG UNUSED stop,LONG original_length) -{ - ENTER(); - - assert( fls != NULL && fd != NULL ); - - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_LOCKED)) - { - struct FileLockNode * which_lock = NULL; - - SHOWMSG("found a locked file"); - - /* Find the locked file this descriptor - * buffer belongs to. - */ - if(find_file_lock_node_by_file_handle(fls,fd->fd_DefaultFile,&which_lock) == OK) - { - struct LockedRegionNode * lrn; - struct LockedRegionNode * lrn_next; - pid_t this_task = getpid(); - - assert( which_lock != NULL ); - - D(("trying to unlock the region %ld..%ld",start,stop)); - - /* Find the region to unlock and remove it. */ - for(lrn = (struct LockedRegionNode *)which_lock->fln_LockedRegionList.mlh_Head ; - (lrn_next = (struct LockedRegionNode *)lrn->lrn_MinNode.mln_Succ) != NULL ; - lrn = lrn_next) - { - if(lrn->lrn_Owner == this_task && - lrn->lrn_Start == start && - lrn->lrn_Length == original_length) - { - SHOWMSG("unlocking all regions on this file"); - - Remove((struct Node *)lrn); - delete_locked_region_node(lrn); - } - } - - /* Check if there are any locked regions left. - * If not, mark the entire file as unlocked. - */ - if(IsListEmpty((struct List *)&which_lock->fln_LockedRegionList)) - { - SHOWMSG("no more regions are locked; removing the file lock node"); - - Remove((struct Node *)which_lock); - delete_file_lock_node(which_lock); - - /* If this is an alias, move up to the real thing. */ - if(fd->fd_Original != NULL) - fd = fd->fd_Original; - - do - { - CLEAR_FLAG(fd->fd_Flags,FDF_IS_LOCKED); - } - while((fd = fd->fd_NextLink) != NULL); - } - } - } - - LEAVE(); -} - -/****************************************************************************/ - -STATIC VOID -delete_locked_region_node(struct LockedRegionNode * lrn) -{ - ENTER(); - - SHOWPOINTER(lrn); - - FreeVec(lrn); - - LEAVE(); -} - -/****************************************************************************/ - -STATIC LONG -create_locked_region_node(struct LockedRegionNode ** result_ptr) -{ - struct LockedRegionNode * lrn; - LONG error = OK; - - ENTER(); - - assert( result_ptr != NULL ); - - lrn = AllocVec(sizeof(*lrn),MEMF_ANY|MEMF_PUBLIC|MEMF_CLEAR); - if(lrn == NULL) - { - SHOWMSG("not enough memory for locked region node"); - - error = ERROR_NO_FREE_STORE; - goto out; - } - - lrn->lrn_Owner = getpid(); - - out: - - (*result_ptr) = lrn; - - RETURN(error); - return(error); -} - -/****************************************************************************/ - -STATIC VOID -delete_file_lock_node(struct FileLockNode * fln) -{ - ENTER(); - - SHOWPOINTER(fln); - - if(fln != NULL) - { - PROFILE_OFF(); - UnLock(fln->fln_FileParentDir); - PROFILE_ON(); - - FreeVec(fln); - } - - LEAVE(); -} - -/****************************************************************************/ - -STATIC LONG -create_file_lock_node(struct fd * fd,struct FileLockNode ** result_ptr) -{ - struct FileLockNode * result = NULL; - struct FileLockNode * fln = NULL; - D_S(struct FileInfoBlock,fib); - LONG error = OK; - - ENTER(); - - assert( fd != NULL && result_ptr != NULL ); - - /* We store a lock on the file's parent directory - * and the name of the file for later use in - * comparisons. - */ - if(CANNOT __safe_examine_file_handle(fd->fd_DefaultFile,fib)) - { - SHOWMSG("couldn't examine file handle"); - - error = IoErr(); - goto out; - } - - fln = AllocVec(sizeof(*fln) + strlen(fib->fib_FileName),MEMF_ANY|MEMF_PUBLIC); - if(fln == NULL) - { - SHOWMSG("not enough memory for lock node"); - - error = ERROR_NO_FREE_STORE; - goto out; - } - - memset(fln,0,sizeof(*fln)); - - fln->fln_FileParentDir = __safe_parent_of_file_handle(fd->fd_DefaultFile); - if(fln->fln_FileParentDir == ZERO) - { - SHOWMSG("couldn't get parent directory"); - - error = IoErr(); - goto out; - } - - strcpy(fln->fln_FileName,fib->fib_FileName); - - NewList((struct List *)&fln->fln_LockedRegionList); - - result = fln; - fln = NULL; - - out: - - delete_file_lock_node(fln); - - (*result_ptr) = result; - - RETURN(error); - return(error); -} - -/****************************************************************************/ - -STATIC LONG -find_file_lock_node_by_drawer_and_name( - struct FileLockSemaphore * fls, - BPTR dir_lock, - STRPTR file_name, - struct FileLockNode ** result_ptr) -{ - DECLARE_UTILITYBASE(); - struct FileLockNode * result = NULL; - struct FileLockNode * fln; - LONG status; - LONG error; - - ENTER(); - - assert( fls != NULL && dir_lock != ZERO && file_name != NULL && result_ptr != NULL ); - assert( UtilityBase != NULL ); - - #if DEBUG - { - char name[FILENAME_MAX]; - - if(NameFromLock(dir_lock,name,sizeof(name))) - { - if(AddPart(name,file_name,sizeof(name))) - D(("Looking for a lock on file |%s|",name)); - } - } - #endif /* DEBUG */ - - error = ERROR_OBJECT_NOT_FOUND; - - for(fln = (struct FileLockNode *)fls->fls_LockList.mlh_Head ; - fln->fln_MinNode.mln_Succ != NULL ; - fln = (struct FileLockNode *)fln->fln_MinNode.mln_Succ) - { - PROFILE_OFF(); - status = SameLock(fln->fln_FileParentDir,dir_lock); - PROFILE_ON(); - - if(status == LOCK_SAME) - { - if(Stricmp(fln->fln_FileName,file_name) == SAME) - { - error = OK; - - result = fln; - - break; - } - } - } - - if(result != NULL) - SHOWMSG("found one"); - else - SHOWMSG("didn't find one"); - - (*result_ptr) = result; - - RETURN(error); - return(error); -} - -/****************************************************************************/ - -STATIC LONG -find_file_lock_node_by_file_handle( - struct FileLockSemaphore * fls, - BPTR file_handle, - struct FileLockNode ** result_ptr) -{ - D_S(struct FileInfoBlock,this_fib); - BPTR parent_dir = ZERO; - LONG error; - - ENTER(); - - assert( fls != NULL && file_handle != ZERO && result_ptr != NULL ); - - (*result_ptr) = NULL; - - if(CANNOT __safe_examine_file_handle(file_handle,this_fib)) - { - SHOWMSG("couldn't examine file handle"); - - error = IoErr(); - goto out; - } - - /* Determine the file's parent directory and - * name. These will be compared against the - * global file lock data. - */ - parent_dir = __safe_parent_of_file_handle(file_handle); - if(parent_dir == ZERO) - { - SHOWMSG("couldn't get parent directory"); - - error = IoErr(); - goto out; - } - - error = find_file_lock_node_by_drawer_and_name(fls,parent_dir,this_fib->fib_FileName,result_ptr); - if(error != OK) - { - SHOWMSG("couldn't find a lock node for the file"); - goto out; - } - - out: - - PROFILE_OFF(); - UnLock(parent_dir); - PROFILE_ON(); - - RETURN(error); - return(error); -} - -/****************************************************************************/ - -STATIC struct LockedRegionNode * -find_colliding_region(struct FileLockNode * fln,LONG start,LONG stop,BOOL shared) -{ - struct LockedRegionNode * result = NULL; - struct LockedRegionNode * lrn; - pid_t this_task = getpid(); - - ENTER(); - - assert( fln != NULL && start <= stop ); - - SHOWVALUE(start); - SHOWVALUE(stop); - SHOWVALUE(shared); - - /* This routine looks for a locked region that overlaps - * with the specified region. It returns a pointer to the - * region that would collide with the specified region if - * a new lock were to be added. - */ - for(lrn = (struct LockedRegionNode *)fln->fln_LockedRegionList.mlh_Head ; - lrn->lrn_MinNode.mln_Succ != NULL ; - lrn = (struct LockedRegionNode *)lrn->lrn_MinNode.mln_Succ) - { - /* Do the regions overlap? */ - if(lrn->lrn_Start <= stop && start <= lrn->lrn_Stop) - { - /* Two shared regions may always overlap. - * How about the rest? - */ - if(NOT shared || NOT lrn->lrn_Shared) - { - /* The lock owner may add as many exclusive - * or shared locks to the same region as - * necessary. - */ - if(lrn->lrn_Owner == this_task) - { - /*kprintf("lock collision [%ld..%ld] : [%ld..%ld]\n",start,stop,lrn->lrn_Start,lrn->lrn_Stop);*/ - continue; - } - - /* So we found a region that would - * cause a collision. - */ - result = lrn; - break; - } - } - } - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -STATIC VOID -cleanup_locked_records(struct fd * fd) -{ - ENTER(); - - assert( fd != NULL ); - - /* This routine removes all locked regions from a file - * before it is eventually closed. - */ - - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_LOCKED)) - { - struct FileLockSemaphore * fls; - - fls = obtain_file_lock_semaphore(FALSE); - if(fls != NULL) - { - BPTR file_handle = fd->fd_DefaultFile; - struct FileLockNode * which_lock = NULL; - pid_t this_task = getpid(); - LONG error; - - error = find_file_lock_node_by_file_handle(fls,file_handle,&which_lock); - if(error == OK) - { - struct LockedRegionNode * lrn_this; - struct LockedRegionNode * lrn_next; - - assert( which_lock != NULL ); - - SHOWMSG("unlocking all regions on this file"); - - for(lrn_this = (struct LockedRegionNode *)which_lock->fln_LockedRegionList.mlh_Head ; - (lrn_next = (struct LockedRegionNode *)lrn_this->lrn_MinNode.mln_Succ) != NULL ; - lrn_this = lrn_next) - { - if(lrn_this->lrn_Owner == this_task) - { - Remove((struct Node *)lrn_this); - - delete_locked_region_node(lrn_this); - } - } - - if(IsListEmpty((struct List *)&which_lock->fln_LockedRegionList)) - { - SHOWMSG("no more regions are locked; removing the file lock node"); - - Remove((struct Node *)which_lock); - - delete_file_lock_node(which_lock); - } - } - - if(error == OK || error == ERROR_OBJECT_NOT_FOUND) - { - /* If this is an alias, move up to the real thing. */ - if(fd->fd_Original != NULL) - fd = fd->fd_Original; - - do - { - CLEAR_FLAG(fd->fd_Flags,FDF_IS_LOCKED); - } - while((fd = fd->fd_NextLink) != NULL); - } - - release_file_lock_semaphore(fls); - } - } - - LEAVE(); -} - -/****************************************************************************/ - -int -__handle_record_locking(int cmd,struct flock * l,struct fd * fd,int * error_ptr) -{ - struct FileLockSemaphore * fls = NULL; - BPTR file_handle = fd->fd_DefaultFile; - struct LockedRegionNode * lrn = NULL; - struct FileLockNode * fln = NULL; - D_S(struct FileInfoBlock,fib); - BOOL fib_is_valid = FALSE; - BPTR parent_dir = ZERO; - LONG seek_position; - off_t current_position; - int result = ERROR; - off_t original_len; - LONG error = OK; - off_t start = 0; - off_t len = 0; - off_t stop; - - ENTER(); - - /* This routine implements advisory file segment locking - * similar to 4.4BSD, but not quite the same. The functionality - * is a subset, somewhat similar to the functionality offered - * by the AmigaDOS LockRecord() and UnlockRecord() functions. - * This means for example that every unlock request must - * match the size and position of the corresponding locking - * request. - * - * This implementation was chosen because not every Amiga - * filing system implements record locking and Samba - * absolutely requires this functionality to work. - */ - assert( l != NULL && fd != NULL); - assert( F_RDLCK <= l->l_type && l->l_type <= F_WRLCK ); - assert( SEEK_SET <= l->l_whence && l->l_whence <= SEEK_END ); - assert( error_ptr != NULL ); - assert( FLAG_IS_CLEAR(fd->fd_Flags,FDF_STDIO) ); - - /* Remember to unlock any records before closing the file. */ - fd->fd_Cleanup = cleanup_locked_records; - - if((cmd == F_SETLK || cmd == F_SETLKW) && (l->l_type != F_UNLCK)) - { - SHOWMSG("this is a lock request"); - - error = create_file_lock_node(fd,&fln); - if(error != OK) - { - SHOWMSG("could not create lock node"); - goto out; - } - - error = create_locked_region_node(&lrn); - if(error != OK) - { - SHOWMSG("could not create region node"); - goto out; - } - } - else - { - SHOWMSG("this is not a lock request"); - } - - original_len = l->l_len; - - /* Now calculate the position of the first byte to lock and the number - * of bytes to lock. - */ - switch(l->l_whence) - { - case SEEK_SET: - - SHOWMSG("SEEK_SET"); - - start = l->l_start; - - if(l->l_len == 0) - len = LONG_MAX; - else - len = l->l_len; - - SHOWVALUE(start); - SHOWVALUE(len); - - break; - - case SEEK_CUR: - - SHOWMSG("SEEK_CUR"); - - PROFILE_OFF(); - seek_position = Seek(file_handle,0,OFFSET_CURRENT); - PROFILE_ON(); - - if(seek_position == SEEK_ERROR && IoErr() != OK) - { - SHOWMSG("could not obtain current seek position"); - - error = IoErr(); - goto out; - } - - current_position = (off_t)seek_position; - - start = current_position + l->l_start; - - if(l->l_len == 0) - len = LONG_MAX; - else - len = l->l_len; - - SHOWVALUE(start); - SHOWVALUE(len); - - break; - - case SEEK_END: - - SHOWMSG("SEEK_END"); - - if(CANNOT __safe_examine_file_handle(file_handle,fib)) - { - SHOWMSG("could not examine file"); - - error = IoErr(); - goto out; - } - - fib_is_valid = TRUE; - - start = (off_t)fib->fib_Size + l->l_start; - - if(l->l_len == 0) - len = LONG_MAX; - else - len = l->l_len; - - SHOWVALUE(start); - SHOWVALUE(len); - - break; - } - - SHOWVALUE(start); - SHOWVALUE(len); - - if(start < 0) - { - SHOWMSG("invalid start"); - - (*error_ptr) = EINVAL; - goto out; - } - - if(len < 0) - { - start += len; - if(start < 0) - { - SHOWMSG("invalid start"); - - (*error_ptr) = EINVAL; - goto out; - } - - stop = start - len - 1; - if(stop < start) - stop = LONG_MAX; - } - else - { - stop = start - 1 + len; - if(stop < start - 1) /* Check for overflow */ - stop = LONG_MAX; - } - - if(l->l_type == F_UNLCK) - { - SHOWMSG("F_UNLCK"); - - fls = obtain_file_lock_semaphore(FALSE); - if(fls == NULL) - { - SHOWMSG("couldn't obtain file locking semaphore"); - (*error_ptr) = EBADF; - goto out; - } - - D(("unlocking %ld..%ld",start,stop)); - - remove_locked_region_node(fls,fd,start,stop,original_len); - } - else if (cmd == F_SETLKW) - { - struct FileLockNode * existing_fln; - BOOL locked; - BOOL shared; - - SHOWMSG("F_SETLKW"); - - D((" locking %ld..%ld",start,stop)); - - if(NOT fib_is_valid && CANNOT __safe_examine_file_handle(file_handle,fib)) - { - SHOWMSG("couldn't read this file's name"); - - error = IoErr(); - goto out; - } - - parent_dir = __safe_parent_of_file_handle(file_handle); - if(parent_dir == ZERO) - { - SHOWMSG("couldn't get a lock on the file's parent directory"); - - error = IoErr(); - goto out; - } - - shared = (BOOL)(l->l_type == F_RDLCK); - - if(shared) - D(("this is a shared lock; waiting for completion")); - else - D(("this is an exclusive lock; waiting for completion")); - - /* Shared locks require readable files, exclusive locks require - writable files. */ - if((shared && FLAG_IS_CLEAR(fd->fd_Flags,FDF_READ)) || - (NOT shared && FLAG_IS_CLEAR(fd->fd_Flags,FDF_WRITE))) - { - (*error_ptr) = EBADF; - goto out; - } - - lrn->lrn_Start = start; - lrn->lrn_Stop = stop; - lrn->lrn_Length = original_len; - lrn->lrn_Shared = shared; - - /* Retry until we manage to lock the record. */ - locked = FALSE; - - do - { - fls = obtain_file_lock_semaphore(FALSE); - if(fls == NULL) - { - SHOWMSG("couldn't obtain file locking semaphore"); - (*error_ptr) = EBADF; - goto out; - } - - if(find_file_lock_node_by_drawer_and_name(fls,parent_dir,fib->fib_FileName,&existing_fln) == OK) - { - SHOWMSG("that file is already locked by someone"); - - if(find_colliding_region(existing_fln,start,stop,shared) == NULL) - { - SHOWMSG("but the locks don't collide"); - - AddTail((struct List *)&existing_fln->fln_LockedRegionList,(struct Node *)lrn); - lrn = NULL; - - locked = TRUE; - } - else - { - SHOWMSG("and the locks collide"); - } - } - else - { - SHOWMSG("nobody has any locks on this file"); - - AddTail((struct List *)&fls->fls_LockList,(struct Node *)fln); - AddTail((struct List *)&fln->fln_LockedRegionList,(struct Node *)lrn); - - fln = NULL; - lrn = NULL; - - locked = TRUE; - } - - release_file_lock_semaphore(fls); - fls = NULL; - - if(NOT locked) - { - const int rand_max = RAND_MAX / 65536; - int num_random_ticks; - - if(__check_abort_enabled && (SetSignal(0,0) & SIGBREAKF_CTRL_C) != 0) - { - SHOWMSG("lock polling loop stopped"); - - delete_file_lock_node(fln); - fln = NULL; - - delete_locked_region_node(lrn); - lrn = NULL; - - PROFILE_OFF(); - UnLock(parent_dir); - PROFILE_ON(); - - parent_dir = ZERO; - - (*error_ptr) = EINTR; - - if(__check_abort_enabled) - __check_abort(); - - goto out; - } - - /* Wait a little before retrying - * the locking operation. We add - * a little randomness here to - * reduce the likelihood of two - * competing processes trying to - * lock the same file at the - * same time. - */ - - num_random_ticks = ((TICKS_PER_SECOND / 2) * (rand() / 65536)) / rand_max; - - if(num_random_ticks > 0) - { - PROFILE_OFF(); - Delay(num_random_ticks); - PROFILE_ON(); - } - } - } - while(NOT locked); - - SHOWMSG("the file now has a lock set"); - - /* If this is an alias, move up to the real thing. */ - if(fd->fd_Original != NULL) - fd = fd->fd_Original; - - do - { - SET_FLAG(fd->fd_Flags,FDF_IS_LOCKED); - } - while((fd = fd->fd_NextLink) != NULL); - } - else if (cmd == F_SETLK) - { - BOOL shared = (BOOL)(l->l_type == F_RDLCK); - struct FileLockNode * existing_fln = NULL; - - SHOWMSG("F_SETLK"); - - if(shared) - D(("this is a shared lock")); - else - D(("this is an exclusive lock")); - - /* Shared locks require readable files, exclusive locks require - writable files. */ - if((shared && FLAG_IS_CLEAR(fd->fd_Flags,FDF_READ)) || - (NOT shared && FLAG_IS_CLEAR(fd->fd_Flags,FDF_WRITE))) - { - (*error_ptr) = EBADF; - goto out; - } - - lrn->lrn_Start = start; - lrn->lrn_Stop = stop; - lrn->lrn_Length = original_len; - lrn->lrn_Shared = shared; - - fls = obtain_file_lock_semaphore(FALSE); - if(fls == NULL) - { - SHOWMSG("couldn't obtain file locking semaphore"); - (*error_ptr) = EBADF; - goto out; - } - - error = find_file_lock_node_by_file_handle(fls,file_handle,&existing_fln); - if(error == OK) - { - SHOWMSG("that file is already locked by someone else"); - - if(find_colliding_region(existing_fln,start,stop,shared) != NULL) - { - SHOWMSG("and the locks collide"); - - (*error_ptr) = EACCES; - goto out; - } - - SHOWMSG("but the locks don't collide"); - - AddTail((struct List *)&existing_fln->fln_LockedRegionList,(struct Node *)lrn); - lrn = NULL; - } - else - { - if(error != ERROR_OBJECT_NOT_FOUND) - goto out; - - SHOWMSG("nobody has any locks on this file"); - - AddTail((struct List *)&fls->fls_LockList,(struct Node *)fln); - AddTail((struct List *)&fln->fln_LockedRegionList,(struct Node *)lrn); - - fln = NULL; - lrn = NULL; - } - - SHOWMSG("the file now has a lock set"); - - /* If this is an alias, move up to the real thing. */ - if(fd->fd_Original != NULL) - fd = fd->fd_Original; - - do - { - SET_FLAG(fd->fd_Flags,FDF_IS_LOCKED); - } - while((fd = fd->fd_NextLink) != NULL); - } - else if (cmd == F_GETLK) - { - struct FileLockNode * fln_found = NULL; - - SHOWMSG("F_GETLK"); - - fls = obtain_file_lock_semaphore(TRUE); - if(fls == NULL) - { - SHOWMSG("couldn't obtain file locking semaphore"); - (*error_ptr) = EBADF; - goto out; - } - - SHOWMSG("checking for possible lock collision"); - - error = find_file_lock_node_by_file_handle(fls,file_handle,&fln_found); - if(error == OK) - { - BOOL shared = (BOOL)(l->l_type == F_RDLCK); - struct LockedRegionNode * lrn_found; - - SHOWMSG("somebody has locked this file"); - - lrn_found = find_colliding_region(fln_found,start,stop,shared); - if(lrn_found != NULL) - { - SHOWMSG("there is a possible lock collision"); - - l->l_type = (lrn_found->lrn_Shared ? F_RDLCK : F_WRLCK); - l->l_whence = SEEK_SET; - l->l_start = lrn_found->lrn_Start; - l->l_len = lrn_found->lrn_Length; - l->l_pid = lrn_found->lrn_Owner; - - SHOWVALUE(l->l_type); - SHOWVALUE(l->l_whence); - SHOWVALUE(l->l_start); - SHOWVALUE(l->l_len); - SHOWVALUE(l->l_pid); - } - else - { - SHOWMSG("there is no lock collision"); - - l->l_type = F_UNLCK; - } - } - else - { - if(error != ERROR_OBJECT_NOT_FOUND) - goto out; - - SHOWMSG("nobody has locked this file"); - - l->l_type = F_UNLCK; - } - } - - result = OK; - - out: - - delete_file_lock_node(fln); - delete_locked_region_node(lrn); - - release_file_lock_semaphore(fls); - - PROFILE_OFF(); - UnLock(parent_dir); - PROFILE_ON(); - - if(result != 0 && error != OK) - { - SetIoErr(error); - - (*error_ptr) = __translate_io_error_to_errno(error); - } - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* UNIX_PATH_SEMANTICS */ diff --git a/library/stdio_remove.c b/library/stdio_remove.c deleted file mode 100644 index de7ad8d..0000000 --- a/library/stdio_remove.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * $Id: stdio_remove.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -remove(const char *filename) -{ - int result = ERROR; - - ENTER(); - - SHOWSTRING(filename); - - assert( filename != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(filename == NULL) - { - SHOWMSG("invalid path name"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if defined(UNIX_PATH_SEMANTICS) - { - result = unlink(filename); - } - #else - { - LONG status; - - D(("trying to delete '%s'",filename)); - - PROFILE_OFF(); - status = DeleteFile((STRPTR)filename); - PROFILE_ON(); - - if(status == DOSFALSE) - { - __set_errno(__translate_access_io_error_to_errno(IoErr())); - goto out; - } - - result = OK; - } - #endif /* UNIX_PATH_SEMANTICS */ - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_remove_fd_alias.c b/library/stdio_remove_fd_alias.c deleted file mode 100644 index e13deb0..0000000 --- a/library/stdio_remove_fd_alias.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * $Id: stdio_remove_fd_alias.c,v 1.3 2005-04-01 18:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -void -__remove_fd_alias(struct fd * fd) -{ - assert( fd != NULL ); - - __stdio_lock(); - - if(fd->fd_Original != NULL) /* this is an alias */ - { - struct fd * list_fd; - - assert( fd->fd_Original != fd ); - assert( fd->fd_Original->fd_Original == NULL ); - - /* Remove this alias from the list. */ - for(list_fd = fd->fd_Original ; - list_fd != NULL ; - list_fd = list_fd->fd_NextLink) - { - if(list_fd->fd_NextLink == fd) - { - list_fd->fd_NextLink = fd->fd_NextLink; - break; - } - } - } - else if (fd->fd_NextLink != NULL) /* this one has aliases attached; it is the 'original' resource */ - { - struct fd * first_alias; - struct fd * next_alias; - struct fd * list_fd; - - /* The first link now becomes the original resource */ - first_alias = fd->fd_NextLink; - next_alias = first_alias->fd_NextLink; - - /* Structure copy... */ - (*first_alias) = (*fd); - - /* Fix up the linkage. */ - first_alias->fd_NextLink = next_alias; - first_alias->fd_Original = NULL; - - /* The resources are migrated to the first link. */ - for(list_fd = next_alias ; - list_fd != NULL ; - list_fd = list_fd->fd_NextLink) - { - list_fd->fd_Original = first_alias; - } - } - - __stdio_unlock(); -} diff --git a/library/stdio_rename.c b/library/stdio_rename.c deleted file mode 100644 index d359650..0000000 --- a/library/stdio_rename.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * $Id: stdio_rename.c,v 1.8 2005-04-24 09:53:12 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -rename(const char *oldname,const char *newname) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info old_nti; - struct name_translation_info new_nti; - #endif /* UNIX_PATH_SEMANTICS */ - int result = ERROR; - LONG status; - - ENTER(); - - SHOWSTRING(oldname); - SHOWSTRING(newname); - - assert( oldname != NULL && newname != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - PROFILE_OFF(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(oldname == NULL || newname == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name(&oldname,&old_nti) != 0) - goto out; - - if(__translate_unix_to_amiga_path_name(&newname,&new_nti) != 0) - goto out; - - if(old_nti.is_root || new_nti.is_root) - { - __set_errno(EACCES); - goto out; - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - D(("renaming '%s' to '%s'",oldname,newname)); - - status = Rename((STRPTR)oldname,(STRPTR)newname); - - if(status == DOSFALSE) - { - SHOWMSG("that didn't work"); - - #if defined(UNIX_PATH_SEMANTICS) - { - LONG error; - - error = IoErr(); - if(error != ERROR_OBJECT_EXISTS) - { - SHOWMSG("that was some other error"); - - __set_errno(__translate_io_error_to_errno(error)); - goto out; - } - - SHOWMSG("deleting the target file and renaming the source file"); - - /* ZZZ there should be a safer solution for this */ - - if(CANNOT DeleteFile((STRPTR)newname)) - { - SHOWMSG("couldn't delete the file"); - - __set_errno(__translate_io_error_to_errno(error)); - goto out; - } - - if(CANNOT Rename((STRPTR)oldname,(STRPTR)newname)) - { - SHOWMSG("that didn't work"); - - __set_errno(__translate_access_io_error_to_errno(IoErr())); - goto out; - } - } - #else - { - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - #endif /* UNIX_PATH_SEMANTICS */ - } - - result = OK; - - out: - - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/stdio_rewind.c b/library/stdio_rewind.c deleted file mode 100644 index c68343c..0000000 --- a/library/stdio_rewind.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * $Id: stdio_rewind.c,v 1.3 2005-02-27 18:09:11 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -void -rewind(FILE *stream) -{ - assert( stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stream); - - clearerr(stream); - - fseek(stream,0,SEEK_SET); - - funlockfile(stream); -} diff --git a/library/stdio_scanf.c b/library/stdio_scanf.c deleted file mode 100644 index 5921633..0000000 --- a/library/stdio_scanf.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * $Id: stdio_scanf.c,v 1.7 2005-05-07 13:21:49 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -scanf(const char *format, ...) -{ - int result = EOF; - va_list arg; - - ENTER(); - - SHOWSTRING(format); - - assert(format != NULL); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(format == NULL) - { - SHOWMSG("invalid format parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - va_start(arg,format); - result = vscanf(format,arg); - va_end(arg); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_setbuf.c b/library/stdio_setbuf.c deleted file mode 100644 index 25a3cad..0000000 --- a/library/stdio_setbuf.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * $Id: stdio_setbuf.c,v 1.4 2005-02-27 18:09:11 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -void -setbuf(FILE *stream,char *buf) -{ - ENTER(); - - SHOWPOINTER(stream); - SHOWPOINTER(buf); - - assert(stream != NULL); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - SHOWMSG("invalid stream parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(buf == NULL) - setvbuf(stream,NULL,IOBF_BUFFER_MODE_NONE,0); - else - setvbuf(stream,buf,IOBF_BUFFER_MODE_FULL,BUFSIZ); - - out: - - LEAVE(); -} diff --git a/library/stdio_setvbuf.c b/library/stdio_setvbuf.c deleted file mode 100644 index fd04f62..0000000 --- a/library/stdio_setvbuf.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * $Id: stdio_setvbuf.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -int -setvbuf(FILE *stream,char *buf,int bufmode,size_t size) -{ - struct iob * file = (struct iob *)stream; - char *new_buffer = NULL; - int result = EOF; - - ENTER(); - - SHOWPOINTER(stream); - SHOWPOINTER(buf); - SHOWVALUE(bufmode); - SHOWVALUE(size); - - assert( stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stream); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - SHOWMSG("invalid stream parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(bufmode < IOBF_BUFFER_MODE_FULL || - bufmode > IOBF_BUFFER_MODE_NONE) - { - SHOWMSG("invalid buffer mode"); - - __set_errno(EINVAL); - goto out; - } - - if((int)size < 0) - { - SHOWMSG("invalid buffer size"); - - __set_errno(EINVAL); - goto out; - } - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_IN_USE)) - { - SHOWMSG("this file is not even in use"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EBADF); - - goto out; - } - - /* A buffer size of 0 bytes defaults to unbuffered operation. */ - if(size == 0) - bufmode = IOBF_BUFFER_MODE_NONE; - - /* If a certain buffer size is requested but no buffer was provided, - allocate some memory for it. */ - if(size > 0 && buf == NULL) - { - /* Allocate a little more memory than necessary. */ - new_buffer = malloc(size + (CACHE_LINE_SIZE-1)); - if(new_buffer == NULL) - { - __set_errno(ENOBUFS); - goto out; - } - } - - /* Get rid of any buffered data. We're going to replace the buffer. */ - if(__iob_write_buffer_is_valid(file) && __flush_iob_write_buffer(file) < 0) - { - SHOWMSG("could not flush write buffer"); - goto out; - } - - if(__iob_read_buffer_is_valid(file) && __drop_iob_read_buffer(file) < 0) - { - SHOWMSG("could not drop read buffer"); - goto out; - } - - /* Get rid of any buffer specially allocated for this stream. */ - if(file->iob_CustomBuffer != NULL) - { - free(file->iob_CustomBuffer); - file->iob_CustomBuffer = NULL; - } - - if(bufmode == IOBF_BUFFER_MODE_NONE) - { - /* Use the default buffer, which is one byte in size. */ - new_buffer = &file->iob_SingleByte; - size = 1; - } - else - { - /* Replace the old buffer. */ - if(buf != NULL) - { - new_buffer = (UBYTE *)buf; - } - else - { - /* Remember this, so we can release it later. */ - file->iob_CustomBuffer = new_buffer; - - /* Align the buffer start address to a cache line boundary. */ - new_buffer = (char *)((ULONG)(new_buffer + (CACHE_LINE_SIZE-1)) & ~(CACHE_LINE_SIZE-1)); - } - } - - assert( file->iob_BufferPosition == 0 ); - assert( file->iob_BufferReadBytes == 0 ); - assert( file->iob_BufferWriteBytes == 0 ); - - file->iob_Buffer = new_buffer; - file->iob_BufferSize = size; - - file->iob_Flags &= ~IOBF_BUFFER_MODE; - file->iob_Flags |= bufmode; - - new_buffer = NULL; - - result = OK; - - out: - - funlockfile(stream); - - if(new_buffer != NULL) - free(new_buffer); - - RETURN(result); - return(result); -} diff --git a/library/stdio_snprintf.c b/library/stdio_snprintf.c deleted file mode 100644 index 1d4bf73..0000000 --- a/library/stdio_snprintf.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * $Id: stdio_snprintf.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -snprintf(char *s, size_t size, const char *format, ...) -{ - int result = EOF; - va_list arg; - - ENTER(); - - assert( format != NULL ); - - SHOWPOINTER(s); - SHOWVALUE(size); - SHOWSTRING(format); - - assert( size == 0 || s != NULL ); - assert( (int)size >= 0); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if((size > 0 && s == NULL) || format == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - va_start(arg,format); - result = vsnprintf(s,size,format,arg); - va_end(arg); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_sprintf.c b/library/stdio_sprintf.c deleted file mode 100644 index a937900..0000000 --- a/library/stdio_sprintf.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * $Id: stdio_sprintf.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -sprintf(char *s, const char *format, ...) -{ - int result = EOF; - va_list arg; - - ENTER(); - - SHOWPOINTER(s); - SHOWSTRING(format); - - assert( s != NULL && format != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s == NULL || format == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - va_start(arg,format); - result = vsprintf(s,format,arg); - va_end(arg); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_sscanf.c b/library/stdio_sscanf.c deleted file mode 100644 index 0c2d585..0000000 --- a/library/stdio_sscanf.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * $Id: stdio_sscanf.c,v 1.8 2005-05-07 13:21:49 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -sscanf(const char *s,const char *format, ...) -{ - int result = EOF; - va_list arg; - - ENTER(); - - SHOWSTRING(s); - SHOWSTRING(format); - - assert( s != NULL && format != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s == NULL || format == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - va_start(arg,format); - result = vsscanf(s,format,arg); - va_end(arg); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_sscanf_hook_entry.c b/library/stdio_sscanf_hook_entry.c deleted file mode 100644 index e490a4a..0000000 --- a/library/stdio_sscanf_hook_entry.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * $Id: stdio_sscanf_hook_entry.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -__sscanf_hook_entry( - struct iob * string_iob, - struct file_action_message * fam) -{ - int result = EOF; - int num_bytes; - - assert( fam != NULL && string_iob != NULL ); - - if(fam->fam_Action != file_action_read) - { - fam->fam_Error = EBADF; - goto out; - } - - assert( string_iob->iob_StringPosition >= 0 ); - assert( string_iob->iob_StringLength >= 0 ); - - if(string_iob->iob_StringPosition < string_iob->iob_StringLength) - { - int num_bytes_left; - - num_bytes_left = string_iob->iob_StringLength - string_iob->iob_StringPosition; - - num_bytes = fam->fam_Size; - if(num_bytes > num_bytes_left) - num_bytes = num_bytes_left; - - assert( fam->fam_Data != NULL ); - assert( num_bytes >= 0 ); - - memmove(fam->fam_Data,&string_iob->iob_String[string_iob->iob_StringPosition],(size_t)num_bytes); - string_iob->iob_StringPosition += num_bytes; - } - else - { - num_bytes = 0; - } - - result = num_bytes; - - out: - - return(result); -} diff --git a/library/stdio_tmpfile.c b/library/stdio_tmpfile.c deleted file mode 100644 index 6e2f5a5..0000000 --- a/library/stdio_tmpfile.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * $Id: stdio_tmpfile.c,v 1.4 2005-03-18 12:38:23 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -FILE * -tmpfile(void) -{ - BPTR temp_file_lock = ZERO; - char * temp_file_name; - FILE * result = NULL; - struct iob * file; - - ENTER(); - - if(__check_abort_enabled) - __check_abort(); - - temp_file_name = malloc(L_tmpnam); - if(temp_file_name == NULL) - { - SHOWMSG("not enough memory for temp file name"); - goto out; - } - - /* Get a temp_file_lock on the current directory; it will be needed - * later when the temporary file is deleted. - */ - - PROFILE_OFF(); - temp_file_lock = Lock("",SHARED_LOCK); - PROFILE_ON(); - - if(temp_file_lock == ZERO) - { - SHOWMSG("couldn't get a temp_file_lock on the current directory"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - /* Find a new temporary file name. */ - tmpnam(temp_file_name); - - SHOWSTRING(temp_file_name); - - /* Open that file; we're going to need it in a minute. */ - file = (struct iob *)fopen(temp_file_name,"w+"); - if(file == NULL) - { - SHOWMSG("file didn't open"); - goto out; - } - - /* Remember this for later when the temporary file is - * to be deleted. - */ - SET_FLAG(file->iob_Flags,IOBF_TEMP); - - file->iob_TempFileName = temp_file_name; - temp_file_name = NULL; - - file->iob_TempFileLock = temp_file_lock; - temp_file_lock = ZERO; - - result = (FILE *)file; - - out: - - PROFILE_OFF(); - UnLock(temp_file_lock); - PROFILE_ON(); - - if(temp_file_name != NULL) - free(temp_file_name); - - RETURN(result); - return(result); -} diff --git a/library/stdio_tmpnam.c b/library/stdio_tmpnam.c deleted file mode 100644 index 77a741d..0000000 --- a/library/stdio_tmpnam.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * $Id: stdio_tmpnam.c,v 1.4 2005-02-03 16:56:16 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -char * -tmpnam(char *buf) -{ - static char local_buffer[L_tmpnam]; - static unsigned short counter; - APTR old_window_pointer; - unsigned short c; - char * result = NULL; /* ZZZ compiler claims that this assignment is unnecessary. */ - BPTR lock; - int i; - - ENTER(); - - if(__check_abort_enabled) - __check_abort(); - - /* If no user-supplied buffer is available, use the local one. */ - if(buf == NULL) - buf = local_buffer; - - while(TRUE) - { - if(__check_abort_enabled) - __check_abort(); - - c = (counter++); - - /* Build another temporary file name, which begins with the - * letters 'tmp' followed by an octal number. - */ - strcpy(buf,"tmp"); - - for(i = 0 ; i < 10 ; i++) - { - buf[3 + 10 - (i+1)] = '0' + (c % 8); - c = (c / 8); - } - - buf[3 + 10] = '\0'; - - D(("checking if '%s' exists",buf)); - - /* Turn off DOS error requesters. */ - old_window_pointer = __set_process_window((APTR)-1); - - /* Does this object exist already? */ - PROFILE_OFF(); - lock = Lock(buf,SHARED_LOCK); - PROFILE_ON(); - - /* Restore DOS requesters. */ - __set_process_window(old_window_pointer); - - if(lock == ZERO) - { - /* If the object does not exist yet then we - * are finished. - */ - if(IoErr() == ERROR_OBJECT_NOT_FOUND) - result = buf; - else - __set_errno(__translate_io_error_to_errno(IoErr())); - - break; - } - - /* OK, so it exists already. Start over... */ - - PROFILE_OFF(); - UnLock(lock); - PROFILE_ON(); - } - - SHOWSTRING(result); - - RETURN(result); - return(result); -} diff --git a/library/stdio_translateioerror.c b/library/stdio_translateioerror.c deleted file mode 100644 index e9c5311..0000000 --- a/library/stdio_translateioerror.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * $Id: stdio_translateioerror.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -__translate_io_error_to_errno(LONG io_err) -{ - static const struct { LONG io_err; LONG errno; } map_table[] = - { - { ERROR_NO_FREE_STORE, ENOMEM }, - { ERROR_TASK_TABLE_FULL, ENOMEM }, - { ERROR_BAD_TEMPLATE, EINVAL }, - { ERROR_BAD_NUMBER, EINVAL }, - { ERROR_REQUIRED_ARG_MISSING, EINVAL }, - { ERROR_KEY_NEEDS_ARG, EINVAL }, - { ERROR_TOO_MANY_ARGS, EINVAL }, - { ERROR_UNMATCHED_QUOTES, EINVAL }, - { ERROR_LINE_TOO_LONG, ENAMETOOLONG }, - { ERROR_FILE_NOT_OBJECT, ENOEXEC }, - { ERROR_OBJECT_IN_USE, EBUSY }, - { ERROR_OBJECT_EXISTS, EEXIST }, - { ERROR_DIR_NOT_FOUND, ENOENT }, - { ERROR_OBJECT_NOT_FOUND, ENOENT }, - { ERROR_BAD_STREAM_NAME, EINVAL }, - { ERROR_OBJECT_TOO_LARGE, EFBIG }, - { ERROR_ACTION_NOT_KNOWN, ENOSYS }, - { ERROR_INVALID_COMPONENT_NAME, EINVAL }, - { ERROR_INVALID_LOCK, EBADF }, - { ERROR_OBJECT_WRONG_TYPE, EFTYPE }, - { ERROR_DISK_NOT_VALIDATED, EROFS }, - { ERROR_DISK_WRITE_PROTECTED, EROFS }, - { ERROR_RENAME_ACROSS_DEVICES, EXDEV }, - { ERROR_DIRECTORY_NOT_EMPTY, ENOTEMPTY }, - { ERROR_TOO_MANY_LEVELS, ENAMETOOLONG }, - { ERROR_DEVICE_NOT_MOUNTED, ENXIO }, - { ERROR_COMMENT_TOO_BIG, ENAMETOOLONG }, - { ERROR_DISK_FULL, ENOSPC }, - { ERROR_DELETE_PROTECTED, EACCES }, - { ERROR_WRITE_PROTECTED, EACCES }, - { ERROR_READ_PROTECTED, EACCES }, - { ERROR_NOT_A_DOS_DISK, EFTYPE }, - { ERROR_NO_DISK, EACCES }, - { ERROR_IS_SOFT_LINK, EFTYPE }, - { ERROR_BAD_HUNK, ENOEXEC }, - { ERROR_NOT_IMPLEMENTED, ENOSYS }, - { ERROR_LOCK_COLLISION, EACCES }, - { ERROR_BREAK, EINTR }, - { ERROR_NOT_EXECUTABLE, ENOEXEC } - }; - - unsigned int i; - int result; - - result = EIO; - - for(i = 0 ; i < NUM_ENTRIES(map_table) ; i++) - { - if(map_table[i].io_err == io_err) - { - result = map_table[i].errno; - break; - } - } - - return(result); -} - -/****************************************************************************/ - -/* Same as above, except that we translate ERROR_OBJECT_WRONG_TYPE - into ENOTDIR by default. */ -int -__translate_access_io_error_to_errno(LONG io_err) -{ - int result; - - if(io_err == ERROR_OBJECT_WRONG_TYPE) - result = ENOTDIR; - else - result = __translate_io_error_to_errno(io_err); - - return(result); -} diff --git a/library/stdio_ungetc.c b/library/stdio_ungetc.c deleted file mode 100644 index 6b099dd..0000000 --- a/library/stdio_ungetc.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * $Id: stdio_ungetc.c,v 1.6 2005-05-29 09:56:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -ungetc(int c,FILE *stream) -{ - struct iob * file = (struct iob *)stream; - int result = EOF; - - assert( stream != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stream); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL) - { - SHOWMSG("null file pointer!"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(file) ); - assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) ); - assert( file->iob_BufferSize > 0 ); - - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_IN_USE)) - { - SHOWMSG("this file is not even in use"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EBADF); - - goto out; - } - - /* Pushing back characters only works for files that can be read from. */ - if(FLAG_IS_CLEAR(file->iob_Flags,IOBF_READ)) - { - SHOWMSG("can't even read from this file"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EACCES); - - goto out; - } - - /* Pushing back an EOF is forbidden. */ - if(c == EOF) - { - SHOWMSG("cannot push back an EOF"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(EINVAL); - - goto out; - } - - /* Get rid of the write buffer, if it's still around. */ - if(__iob_write_buffer_is_valid(file) > 0 && __flush_iob_write_buffer(file) < 0) - { - SHOWMSG("could not flush write buffer"); - goto out; - } - - /* We need to replace one of the characters in the buffer, which must - * have been read before. The ISO standard requires that it must - * be possible to push back at least one single character. - */ - if(file->iob_BufferPosition == 0) - { - SHOWMSG("no room to push back"); - - SET_FLAG(file->iob_Flags,IOBF_ERROR); - - __set_errno(ENOBUFS); - - goto out; - } - - CLEAR_FLAG(file->iob_Flags,IOBF_EOF_REACHED); - - /* Replace the character just read. */ - file->iob_Buffer[--file->iob_BufferPosition] = c; - - /* Clamp the result to an unsigned 8 bit value. */ - result = (c & 255); - - out: - - funlockfile(stream); - - return(result); -} diff --git a/library/stdio_unlockfile.c b/library/stdio_unlockfile.c deleted file mode 100644 index 6a1fa77..0000000 --- a/library/stdio_unlockfile.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * $Id: stdio_unlockfile.c,v 1.1 2005-02-27 18:09:11 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -__unlockfile(FILE *stream,int c) -{ - funlockfile(stream); - - return(c); -} diff --git a/library/stdio_vasprintf.c b/library/stdio_vasprintf.c deleted file mode 100644 index 4c32823..0000000 --- a/library/stdio_vasprintf.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * $Id: stdio_vasprintf.c,v 1.11 2005-03-19 10:15:56 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#undef vasprintf - -/****************************************************************************/ - -__static int -__vasprintf(const char *file,int line,char **ret,const char *format,va_list arg) -{ - struct iob string_iob; - int result = EOF; - char local_buffer[32]; - - ENTER(); - - SHOWPOINTER(ret); - SHOWSTRING(format); - - assert( ret != NULL && format != NULL && arg != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(ret == NULL || format == NULL || format == arg) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - (*ret) = NULL; - - __initialize_iob(&string_iob,__vasprintf_hook_entry, - NULL, - local_buffer,sizeof(local_buffer), - -1, - -1, - IOBF_IN_USE | IOBF_WRITE | IOBF_BUFFER_MODE_NONE | IOBF_INTERNAL, - NULL); - - string_iob.iob_String = NULL; - string_iob.iob_StringSize = 0; - string_iob.iob_File = (char *)file; - string_iob.iob_Line = line; - - result = vfprintf((FILE *)&string_iob,format,arg); - if(result < 0) - { - SHOWMSG("ouch. that didn't work"); - - if(string_iob.iob_String != NULL) - __free(string_iob.iob_String,string_iob.iob_File,string_iob.iob_Line); - - goto out; - } - - SHOWSTRING(string_iob.iob_String); - - (*ret) = string_iob.iob_String; - - out: - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -int -vasprintf(char **ret,const char *format,va_list arg) -{ - int result; - - result = __vasprintf(NULL,0,ret,format,arg); - - return(result); -} diff --git a/library/stdio_vasprintf_hook_entry.c b/library/stdio_vasprintf_hook_entry.c deleted file mode 100644 index a0c2bea..0000000 --- a/library/stdio_vasprintf_hook_entry.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * $Id: stdio_vasprintf_hook_entry.c,v 1.7 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -int -__vasprintf_hook_entry( - struct iob * string_iob, - struct file_action_message * fam) -{ - int result = EOF; - int num_bytes_left; - int num_bytes; - - assert( fam != NULL && string_iob != NULL ); - assert( fam->fam_Action == file_action_write ); - - if(fam->fam_Action != file_action_write) - { - fam->fam_Error = EBADF; - goto out; - } - - if(string_iob->iob_StringPosition + fam->fam_Size > string_iob->iob_StringSize) - { - const int granularity = 64; - - size_t new_size; - char * buffer; - - new_size = string_iob->iob_StringPosition + fam->fam_Size + granularity; - - buffer = __malloc(new_size,string_iob->iob_File,string_iob->iob_Line); - if(buffer == NULL) - { - fam->fam_Error = ENOBUFS; - goto out; - } - - if(string_iob->iob_String != NULL) - { - memmove(buffer,string_iob->iob_String,(size_t)string_iob->iob_StringSize); - - __free(string_iob->iob_String,string_iob->iob_File,string_iob->iob_Line); - } - - string_iob->iob_String = buffer; - string_iob->iob_StringSize = new_size; - } - - assert( string_iob->iob_StringPosition <= string_iob->iob_StringSize ); - - num_bytes_left = string_iob->iob_StringSize - string_iob->iob_StringPosition; - - num_bytes = fam->fam_Size; - if(num_bytes > num_bytes_left) - num_bytes = num_bytes_left; - - assert( num_bytes >= 0 ); - assert( fam->fam_Data != NULL ); - - memmove(&string_iob->iob_String[string_iob->iob_StringPosition],fam->fam_Data,(size_t)num_bytes); - string_iob->iob_StringPosition += num_bytes; - - result = num_bytes; - - out: - - return(result); -} diff --git a/library/stdio_vfprintf.c b/library/stdio_vfprintf.c deleted file mode 100644 index 286a85a..0000000 --- a/library/stdio_vfprintf.c +++ /dev/null @@ -1,1702 +0,0 @@ -/* - * $Id: stdio_vfprintf.c,v 1.19 2005-06-26 11:57:26 tfrieden Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -/* - * Uncomment this to activate '%lld' support and the like. Better still, - * define this is in the Makefile! - */ -/*#define USE_64_BIT_INTS*/ - -/****************************************************************************/ - -/* Data conversion flags for vfprintf() below. */ -#define FORMATF_LeftJustified (1<<0) /* Output must be left justified */ -#define FORMATF_ProduceSign (1<<1) /* Numbers always begin with a leading - sign character */ -#define FORMATF_ProduceSpace (1<<2) /* Numbers always begin with a '-' - character or a blank space */ -#define FORMATF_AlternateConversion (1<<3) /* Use alternative conversion format */ -#define FORMATF_CapitalLetters (1<<4) /* Output must use upper case characters */ -#define FORMATF_IsNegative (1<<5) /* Number is negative */ -#define FORMATF_HexPrefix (1<<6) /* Prepend '0x' to the output */ -#define FORMATF_ZeroPrefix (1<<7) /* Prepend '0' to the output */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#define max(a,b) ((a) > (b) ? (a) : (b)) - -/****************************************************************************/ - -STATIC int -get_num_leading_digits(__long_double_t v,int radix) -{ - int num_digits; - - SHOWVALUE(radix); - - if(v < radix) - { - num_digits = 1; - } - else - { - /* For some reason log() can crash on GCC 68k... */ - #if (!defined(__GNUC__) || defined(__PPC__)) - { - num_digits = 1 + floor(log(v) / log((double)radix)); - } - #else - { - /* Perform the conversion one digit at a time... */ - num_digits = 0; - - while(floor(v) > 0.0) - { - num_digits++; - - v /= radix; - } - } - #endif /* __GNUC__ && !__PPC__ */ - } - - return(num_digits); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -int -vfprintf(FILE * stream,const char * format, va_list arg) -{ - enum parameter_size_t - { - parameter_size_byte, - parameter_size_long, - parameter_size_short, - parameter_size_size_t, - parameter_size_ptrdiff_t, - parameter_size_long_long, - parameter_size_long_double, - parameter_size_intmax_t, - parameter_size_default - }; - - struct iob * iob = (struct iob *)stream; - int format_flags; - char fill_character; - int minimum_field_width; - int precision; - enum parameter_size_t parameter_size; - char conversion_type; - char buffer[80]; - int buffer_mode; - char *output_buffer; - int output_len; - char *prefix; - char prefix_buffer[8]; - int result = EOF; - int len = 0; - int c; - - #if defined(FLOATING_POINT_SUPPORT) - char * internal_buffer = NULL; - size_t internal_buffer_size = 0; - char trail_string[8]; - int trail_string_len; - int num_trailing_zeroes; - #endif /* FLOATING_POINT_SUPPORT */ - - ENTER(); - - SHOWSTRING(format); - - assert( stream != NULL && format != NULL && arg != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stream); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL || format == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* If no buffering is specified but a buffer was allocated, switch to - line buffering. This is intended to help 'stderr' and others. */ - buffer_mode = (iob->iob_Flags & IOBF_BUFFER_MODE); - if(buffer_mode == IOBF_BUFFER_MODE_NONE) - buffer_mode = IOBF_BUFFER_MODE_LINE; - - assert( FLAG_IS_SET(iob->iob_Flags,IOBF_IN_USE) ); - assert( iob->iob_BufferSize > 0 ); - - if(__fputc_check(stream) < 0) - goto out; - - while((c = (*format++)) != '\0') - { - /* I this isn't a % charater, copy the input to the output. */ - if(c != '%') - { - if(__putc(c,stream,buffer_mode) == EOF) - goto out; - - len++; - - continue; - } - - format_flags = 0; - fill_character = ' '; - - /* Collect the flags: left justification, sign, space, - * alternate format, fill character. - */ - while(TRUE) - { - c = (*format); - - if(c == '-') - { - SHOWMSG("minus"); - - SET_FLAG(format_flags,FORMATF_LeftJustified); - format++; - } - else if (c == '+') - { - SHOWMSG("plus"); - - SET_FLAG(format_flags,FORMATF_ProduceSign); - format++; - } - else if (c == ' ') - { - SHOWMSG("space"); - - SET_FLAG(format_flags,FORMATF_ProduceSpace); - format++; - } - else if (c == '#') - { - SHOWMSG("alternate"); - - SET_FLAG(format_flags,FORMATF_AlternateConversion); - format++; - } - else if (c == '0') - { - SHOWMSG("leading zeroes"); - - fill_character = '0'; - format++; - } - else - { - break; - } - } - - if(c == '\0') - break; - - /* Now for the field width. */ - minimum_field_width = 0; - - while(TRUE) - { - c = (*format); - - if(c == '*') - { - SHOWMSG("use field width (stack)"); - - /* The field width is stored on the stack. */ - - assert(arg != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - minimum_field_width = va_arg(arg,int); - if(minimum_field_width < 0) - minimum_field_width = 0; - - format++; - } - else if ('0' <= c && c <= '9') - { - int next_sum; - int sum = 0; - - SHOWMSG("use field width (string)"); - - /* Process the field width. */ - while(TRUE) - { - c = (*format); - - if('0' <= c && c <= '9') - { - D(("digit = %lc",c)); - - next_sum = (10 * sum) + c - '0'; - if(next_sum < sum) /* overflow? */ - { - SHOWMSG("overflow"); - break; - } - - SHOWVALUE(sum); - - sum = next_sum; - format++; - } - else - { - break; - } - } - - minimum_field_width = sum; - - SHOWVALUE(minimum_field_width); - } - else - { - break; - } - } - - /* End of the format string? */ - if(c == '\0') - break; - - precision = -1; - - /* Was a precision specified? */ - if((*format) == '.') - { - SHOWMSG("precision required"); - - format++; - - c = (*format); - if(c == '*') - { - SHOWMSG("use stack"); - - /* The precision is stored on the stack. */ - assert(arg != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - precision = va_arg(arg,int); - if(precision < 0) - precision = 0; - - format++; - } - else if ('0' <= c && c <= '9') - { - int next_sum; - int sum = 0; - - SHOWMSG("use string"); - - /* Process the precision. */ - while(TRUE) - { - c = (*format); - - if('0' <= c && c <= '9') - { - D(("digit = %lc",c)); - - next_sum = (10 * sum) + c - '0'; - if(next_sum < sum) /* overflow? */ - { - SHOWMSG("overflow"); - break; - } - - SHOWVALUE(sum); - - sum = next_sum; - format++; - } - else - { - break; - } - } - - precision = sum; - } - else - { - /* Anything else results in the precision - * value to be set to 0. - */ - precision = 0; - } - - SHOWVALUE(precision); - } - - /* Now for the size modifier, if any. */ - c = (*format); - - /* End of the format string? */ - if(c == '\0') - break; - - if(c == 'l') - { - SHOWMSG("format size = long"); - - parameter_size = parameter_size_long; - format++; - } - else if (c == 'L') - { - SHOWMSG("format size = long double"); - - parameter_size = parameter_size_long_double; - format++; - } - else if (c == 'h') - { - SHOWMSG("format size = short"); - - parameter_size = parameter_size_short; - format++; - } - else if (c == 'j') - { - SHOWMSG("format size = intmax_t"); - - parameter_size = parameter_size_intmax_t; - format++; - } - else if (c == 't') - { - SHOWMSG("format size = ptrdiff_t"); - - parameter_size = parameter_size_ptrdiff_t; - format++; - } - else if (c == 'z') - { - SHOWMSG("format size = size_t"); - - parameter_size = parameter_size_size_t; - format++; - } - else - { - SHOWMSG("format size = default"); - - /* The default is to assume 32 bit parameters. */ - parameter_size = parameter_size_default; - } - - /* Finally, the conversion_type type. */ - c = (*format); - - /* End of the format string? */ - if(c == '\0') - break; - - /* Check for byte parameters. */ - if(parameter_size == parameter_size_short && c == 'h') - { - SHOWMSG("format size = byte"); - - parameter_size = parameter_size_byte; - - format++; - - /* The conversion_type type follows. */ - c = (*format); - - /* End of the format string? */ - if(c == '\0') - break; - } - - #if defined(USE_64_BIT_INTS) && defined(__GNUC__) - { - /* Check for long long parameters. */ - if(parameter_size == parameter_size_long && c == 'l') - { - parameter_size = parameter_size_long_long; - - format++; - - /* The conversion_type type follows. */ - c = (*format); - - /* End of the format string? */ - if(c == '\0') - break; - } - } - #endif /* __GNUC__ */ - - #if defined(FLOATING_POINT_SUPPORT) - { - trail_string[0] = '\0'; - num_trailing_zeroes = 0; - } - #endif /* FLOATING_POINT_SUPPORT */ - - D(("conversion_type (preliminary) = %lc",c)); - - switch(c) - { - /* signed integer */ - case 'i': - - conversion_type = 'd'; - - format++; - break; - - /* unsigned integer (hexadecimal notation) */ - case 'X': - - SET_FLAG(format_flags,FORMATF_CapitalLetters); - - conversion_type = 'x'; - - format++; - break; - - /* floating point number (exponential notation) */ - case 'E': - - SET_FLAG(format_flags,FORMATF_CapitalLetters); - - conversion_type = 'e'; - - format++; - break; - - /* floating point number (hexadecimal digits; exponential notation) */ - case 'A': - - SET_FLAG(format_flags,FORMATF_CapitalLetters); - - conversion_type = 'a'; - - format++; - break; - - /* floating point number (plain or exponential notation) */ - case 'G': - - SET_FLAG(format_flags,FORMATF_CapitalLetters); - - conversion_type = 'g'; - - format++; - break; - - /* pointer (hexadecimal notation, eight digits, '0x' prefix) */ - case 'p': - - conversion_type = 'x'; - - SET_FLAG(format_flags,FORMATF_AlternateConversion); - - fill_character = '0'; - minimum_field_width = 8; - - format++; - break; - - case 'a': /* floating point number (hexadecimal digits; exponential notation) */ - case 'c': /* character */ - case 'd': /* signed integer */ - case 'f': /* floating point number */ - case 'e': /* floating point number (exponential notation) */ - case 'g': /* floating point number (plain or exponential notation) */ - case 's': /* string */ - case '%': /* % character */ - case 'o': /* unsigned integer (octal notation) */ - case 'x': /* unsigned integer (hexadecimal notation) */ - case 'u': /* unsigned integer */ - case 'n': /* number of characters written */ - default: /* anything else (% works as escape character) */ - - conversion_type = c; - format++; - break; - } - - D(("conversion_type (final) = %lc",conversion_type)); - - output_buffer = &buffer[sizeof(buffer)-1]; - (*output_buffer) = '\0'; - - output_len = 0; - - if(conversion_type == 'c') - { - int ch; - - SHOWMSG("character"); - - assert(arg != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(parameter_size == parameter_size_short) - { - /* Parameter is a short integer which - * must be cast to a long integer before - * it can be used. - */ - short short_integer; - - short_integer = (short)va_arg(arg, int); - - ch = short_integer; - } - else if (parameter_size == parameter_size_byte) - { - /* Parameter is a byte-sized integer which - * must be cast to a long integer before - * it can be used. - */ - char byte_integer; - - byte_integer = (char)va_arg(arg, int); - - ch = byte_integer; - } - else - { - #if defined(USE_64_BIT_INTS) && defined(__GNUC__) - { - if(parameter_size == parameter_size_long_long || parameter_size == parameter_size_intmax_t) - ch = va_arg(arg, long long); - else - ch = va_arg(arg, int); - } - #else - { - ch = va_arg(arg, int); - } - #endif /* __GNUC__ */ - } - - D(("output = %lc",ch)); - - output_buffer--; - output_len++; - - (*output_buffer) = ch; - - CLEAR_FLAG(format_flags,FORMATF_ProduceSign); - CLEAR_FLAG(format_flags,FORMATF_ProduceSpace); - } - else if (conversion_type == 'a' || - conversion_type == 'e' || - conversion_type == 'f' || - conversion_type == 'g') - { - SHOWMSG("floating point format"); - - assert(arg != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if defined(FLOATING_POINT_SUPPORT) - { - const char * buffer_stop = &buffer[sizeof(buffer)-1]; - char * buffer_start = buffer; - - const char * digit_encoding; - __long_double_t v; - int radix; - - if(conversion_type == 'a') - { - SET_FLAG(format_flags,FORMATF_HexPrefix); - - radix = 16; - } - else - { - radix = 10; - } - - if(FLAG_IS_SET(format_flags,FORMATF_CapitalLetters)) - digit_encoding = "0123456789ABCDEF"; - else - digit_encoding = "0123456789abcdef"; - - output_buffer = buffer_start; - - D(("sizeof(long double) == %ld",sizeof(v))); - - if(parameter_size == parameter_size_long_double) - v = va_arg(arg, __long_double_t); - else - v = va_arg(arg, double); - - if(isinf(v)) - { - SHOWMSG("infinity"); - - strcpy(output_buffer,"inf"); - output_len = 3; - - if(v < 0) - SET_FLAG(format_flags,FORMATF_IsNegative); - - fill_character = ' '; - } - else if (isnan(v)) - { - SHOWMSG("not a number"); - - strcpy(output_buffer,"nan"); - output_len = 3; - - if(FLAG_IS_SET(format_flags,FORMATF_ProduceSign)) - { - SET_FLAG(format_flags,FORMATF_ProduceSpace); - - CLEAR_FLAG(format_flags,FORMATF_ProduceSign); - } - - fill_character = ' '; - } - else - { - BOOL strip_trailing_zeroes = FALSE; - __long_double_t roundoff_fudge = 0.0; - int num_output_characters; - int num_leading_digits; - int max_digits = -1; - int exponent = 0; - int digit; - int i; - - /* This takes care of the sign. */ - if(v < 0.0) - { - SHOWMSG("negative number"); - - SET_FLAG(format_flags,FORMATF_IsNegative); - v = (-v); - } - - D(("sizeof(v) == %ld",sizeof(v))); - - #if DEBUG - { - unsigned long n[2]; - - memcpy(n,&v,sizeof(n)); - - D(("v = 0x%08lx%08lx",n[0],n[1])); - } - #endif /* DEBUG */ - - /* Default precision is 6 digits. */ - if(precision < 0) - { - SHOWMSG("no precision specified, using six digits"); - precision = 6; - } - - /* Figure out whether 'e' or 'f' format should be used. */ - if(conversion_type == 'g' || conversion_type == 'e' || conversion_type == 'a') - { - __long_double_t local_v = v; - int local_exponent = 0; - - /* Put one single digit in front of the decimal point. */ - while(local_v != 0.0 && local_v < 1.0) - { - local_v *= radix; - local_exponent--; - } - - while(local_v >= radix) - { - local_v /= radix; - local_exponent++; - } - - if(conversion_type == 'g') - { - /* If the precision is < 1, then it defaults to 1. */ - if(precision < 1) - precision = 1; - - SHOWVALUE(exponent); - SHOWVALUE(precision); - - /* If the exponent is < -4 or greater than or equal to - * the precision, we switch to 'e' or 'f' format, - * respectively. - */ - if((local_exponent < -4) || local_exponent >= precision) - conversion_type = 'e'; - else - conversion_type = 'f'; - - max_digits = precision; - - strip_trailing_zeroes = TRUE; - } - - if(conversion_type == 'e' || conversion_type == 'a') - { - v = local_v; - exponent = local_exponent; - } - } - - D(("conversion_type is now %lc",conversion_type)); - - /* If necessary, perform rounding after the - last digit to be displayed. */ - if(max_digits > 0) - { - int roundoff_position; - - if(v >= 1.0) - roundoff_position = max_digits - get_num_leading_digits(v,radix); - else - roundoff_position = max_digits; - - if(roundoff_position >= 0) - roundoff_fudge = pow((double)radix,(double)(roundoff_position + 1)); - } - else - { - roundoff_fudge = pow((double)radix,(double)(precision + 1)); - } - - if(roundoff_fudge > 0.0) - v += 5.0 / roundoff_fudge; - - /* The rounding may have caused an overflow, putting - two digits in front of the decimal point. This - needs to be corrected. */ - if(conversion_type == 'e' || conversion_type == 'a') - { - while(v >= radix) - { - v /= radix; - exponent++; - } - } - - SHOWMSG("integral part"); - - num_leading_digits = get_num_leading_digits(v,radix); - - SHOWVALUE(num_leading_digits); - - /* Figure out how much room the number will need in order - to be stored. */ - num_output_characters = - 1 + /* sign */ - num_leading_digits + /* integral part */ - 1 + /* decimal point */ - max(0,max(precision,max_digits)) + /* fractional part */ - 1 + /* 'e' or 'p' */ - 1 + /* sign of the exponent */ - 32 + /* exponent */ - 1; /* NUL termination */ - - /* Can we store that much? */ - if((size_t)num_output_characters > sizeof(buffer)) - { - if((size_t)num_output_characters > internal_buffer_size) - { - char * new_internal_buffer; - - /* Try to (re-)allocate a larger output buffer. */ - new_internal_buffer = realloc(internal_buffer,(size_t)num_output_characters); - if(new_internal_buffer == NULL) - { - __set_errno(ENOMEM); - goto out; - } - - internal_buffer = new_internal_buffer; - internal_buffer_size = (size_t)num_output_characters; - } - - buffer_start = internal_buffer; - buffer_stop = &internal_buffer[internal_buffer_size - 1]; - output_buffer = buffer_start; - } - - if(v >= 1.0) - { - /* 'Normalize' the number so that we have a zero in - front of the mantissa. We can't lose here: we - simply scale the value without any loss of - precision (we just change the floating point - exponent). */ - v /= pow((double)radix,(double)num_leading_digits); - - for(i = 0 ; (max_digits != 0) && (i < num_leading_digits) && (output_buffer < buffer_stop) ; i++) - { - v *= radix; - - digit = floor(v); - - D(("next digit = %lc (digit = %ld)",digit_encoding[digit],digit)); - - assert( 0 <= digit && digit < radix ); - - (*output_buffer++) = digit_encoding[digit]; - - v -= digit; - - if(max_digits > 0) - max_digits--; - } - } - else - { - /* NOTE: any 'significant' digits (for %g conversion) - will follow the decimal point. */ - (*output_buffer++) = '0'; - } - - /* Now for the fractional part. */ - if(precision > 0) - { - SHOWMSG("mantissa"); - - if((max_digits != 0) && (output_buffer < buffer_stop)) - { - (*output_buffer++) = '.'; - - for(i = 0 ; (max_digits != 0) && (i < precision) && (output_buffer < buffer_stop) ; i++) - { - v *= radix; - - digit = floor(v); - - D(("next digit = %lc",digit_encoding[digit])); - - assert( 0 <= digit && digit < radix ); - - (*output_buffer++) = digit_encoding[digit]; - - v -= digit; - - if(max_digits > 0) - max_digits--; - } - - if(i < precision && max_digits != 0 && NOT strip_trailing_zeroes) - { - num_trailing_zeroes = precision - i; - - if(max_digits > 0 && max_digits < num_trailing_zeroes) - num_trailing_zeroes = max_digits; - } - } - - /* Strip trailing digits and decimal point - * unless we shouldn't. - */ - if(strip_trailing_zeroes && FLAG_IS_CLEAR(format_flags,FORMATF_AlternateConversion)) - { - SHOWMSG("strip trailing zeroes and comma"); - - while(output_buffer > buffer_start+1 && output_buffer[-1] == '0') - output_buffer--; - - if(output_buffer > buffer_start && output_buffer[-1] == '.') - output_buffer--; - } - } - else - { - /* Precision is zero; if the alternative conversion flag - * is specified, add the lonely decimal point. - */ - if(FLAG_IS_SET(format_flags,FORMATF_AlternateConversion)) - { - if(output_buffer < buffer_stop) - (*output_buffer++) = '.'; - } - } - - #if DEBUG - { - (*output_buffer) = '\0'; - - output_len = output_buffer - buffer_start; - - D(("length = %ld, output_buffer = '%s'",output_len,buffer_start)); - } - #endif /* DEBUG */ - - if(conversion_type == 'e' || conversion_type == 'a') - { - char exponent_string[40]; - size_t exponent_string_len,j; - int exponent_sign; - - /* For the '%a' conversion the exponent is given in - binary notation rather than decimal. */ - if(conversion_type == 'a') - radix = 2; - - /* Build the exponent string in reverse order. */ - exponent_string_len = 0; - - if(exponent < 0) - { - exponent_sign = -1; - - exponent = (-exponent); - } - else - { - exponent_sign = 1; - } - - while(exponent > 0 && exponent_string_len < sizeof(exponent_string)) - { - exponent_string[exponent_string_len++] = '0' + (exponent % radix); - - exponent /= radix; - } - - /* Minimum length of the exponent is two digits. */ - while(exponent_string_len < 2) - exponent_string[exponent_string_len++] = '0'; - - if(exponent_string_len < sizeof(exponent_string)-1) - { - if(exponent_sign < 0) - exponent_string[exponent_string_len++] = '-'; - else - exponent_string[exponent_string_len++] = '+'; - - if(conversion_type == 'a') - { - if(FLAG_IS_SET(format_flags,FORMATF_CapitalLetters)) - exponent_string[exponent_string_len++] = 'P'; - else - exponent_string[exponent_string_len++] = 'p'; - } - else - { - if(FLAG_IS_SET(format_flags,FORMATF_CapitalLetters)) - exponent_string[exponent_string_len++] = 'E'; - else - exponent_string[exponent_string_len++] = 'e'; - } - } - - /* Add the exponent string in reverse order. */ - for(j = 0 ; exponent_string_len > 0 ; j++) - trail_string[j] = exponent_string[--exponent_string_len]; - - trail_string[j] = '\0'; - } - - (*output_buffer) = '\0'; - - output_len = output_buffer - buffer_start; - output_buffer = buffer_start; - - D(("length = %ld, output_buffer = '%s'",output_len,output_buffer)); - } - } - #else - { - /* Remove the parameter from the argument vector and - don't produce any output. */ - if(parameter_size == parameter_size_long_double) - (void)va_arg(arg, __long_double_t); - else - (void)va_arg(arg, double); - - minimum_field_width = 0; - format_flags = 0; - } - #endif /* FLOATING_POINT_SUPPORT */ - } - else if (conversion_type == 'd' || - conversion_type == 'o' || - conversion_type == 'u' || - conversion_type == 'x') - { - #if defined(USE_64_BIT_INTS) && defined(__GNUC__) - unsigned long long v; - #else - unsigned int v; - #endif /* __GNUC__ */ - - assert(arg != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(conversion_type == 'd') - { - #if defined(USE_64_BIT_INTS) && defined(__GNUC__) - long long sv; - #else - int sv; - #endif /* __GNUC__ */ - - SHOWMSG("signed integer"); - - if(parameter_size == parameter_size_short) - { - /* Parameter is a short integer which - * must be cast to a long integer before - * it can be used. - */ - short short_integer; - - short_integer = (short)va_arg(arg, int); - - sv = short_integer; - } - else if (parameter_size == parameter_size_byte) - { - /* Parameter is a byte-sized integer which - * must be cast to a long integer before - * it can be used. - */ - short byte_integer; - - byte_integer = (char)va_arg(arg, int); - - sv = byte_integer; - } - else - { - #if defined(USE_64_BIT_INTS) && defined(__GNUC__) - { - if(parameter_size == parameter_size_long_long || parameter_size == parameter_size_intmax_t) - sv = va_arg(arg, long long); - else - sv = va_arg(arg, int); - } - #else - { - sv = va_arg(arg, int); - } - #endif /* __GNUC__ */ - } - - if(sv < 0) - { - SHOWMSG("negative number"); - - SET_FLAG(format_flags,FORMATF_IsNegative); - - v = (-sv); - } - else - { - v = sv; - } - } - else - { - if(conversion_type == 'o') - SHOWMSG("unsigned integer (octal notation)"); - else if (conversion_type == 'x') - SHOWMSG("unsigned integer (hexadecimal notation)"); - else - SHOWMSG("unsigned integer"); - - if(parameter_size == parameter_size_short) - { - /* Parameter is a short integer which - * must be cast to a long integer before - * it can be used. - */ - unsigned short short_integer; - - short_integer = (unsigned short)va_arg(arg, unsigned int); - - v = short_integer; - } - else if (parameter_size == parameter_size_byte) - { - /* Parameter is a byte-sized integer which - * must be cast to a long integer before - * it can be used. - */ - unsigned char byte_integer; - - byte_integer = (unsigned char)va_arg(arg, unsigned int); - - v = byte_integer; - } - else - { - #if defined(USE_64_BIT_INTS) && defined(__GNUC__) - { - if(parameter_size == parameter_size_long_long || parameter_size == parameter_size_intmax_t) - v = va_arg(arg, unsigned long long); - else - v = va_arg(arg, unsigned int); - } - #else - { - v = va_arg(arg, unsigned int); - } - #endif /* __GNUC__ */ - } - - CLEAR_FLAG(format_flags,FORMATF_ProduceSign); - CLEAR_FLAG(format_flags,FORMATF_ProduceSpace); - } - - /* Don't print anything if the precision is 0 and the number - itself is 0. */ - if(v != 0 || precision != 0) - { - const char * digit_encoding; - int radix; - - if(conversion_type == 'o') - radix = 8; - else if (conversion_type == 'x') - radix = 16; - else - radix = 10; - - if(FLAG_IS_SET(format_flags,FORMATF_CapitalLetters)) - digit_encoding = "0123456789ABCDEF"; - else - digit_encoding = "0123456789abcdef"; - - do - { - output_buffer--; - output_len++; - - (*output_buffer) = digit_encoding[v % radix]; - v /= radix; - } - while(v > 0 && buffer < output_buffer); - - if(FLAG_IS_SET(format_flags,FORMATF_AlternateConversion)) - { - if(conversion_type == 'o') - SET_FLAG(format_flags,FORMATF_ZeroPrefix); - else if (conversion_type == 'x') - SET_FLAG(format_flags,FORMATF_HexPrefix); - } - - while(output_len < precision && output_buffer > buffer) - { - output_buffer--; - output_len++; - - (*output_buffer) = '0'; - } - } - } - else if (conversion_type == 's') - { - SHOWMSG("string"); - - assert(arg != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - output_buffer = va_arg(arg, char *); - - #if defined(NDEBUG) - { - if(output_buffer == NULL) - output_buffer = ""; - } - #else - { - if(output_buffer == NULL) - output_buffer = "*NULL POINTER*"; - } - #endif /* NDEBUG */ - - if(precision < 0) - { - output_len = strlen(output_buffer); - } - else - { - int i; - - output_len = precision; - - for(i = 0 ; i < precision ; i++) - { - if(output_buffer[i] == '\0') - { - output_len = i; - break; - } - } - } - - D(("string = '%s', length = %ld",output_buffer,output_len)); - - CLEAR_FLAG(format_flags,FORMATF_ProduceSign); - CLEAR_FLAG(format_flags,FORMATF_ProduceSpace); - } - else if (conversion_type == 'n') - { - SHOWMSG("number of characters"); - - assert(arg != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(parameter_size == parameter_size_short) - { - short * short_ptr; - - short_ptr = va_arg(arg, short *); - - assert( short_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(short_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - (*short_ptr) = len; - } - else if (parameter_size == parameter_size_byte) - { - char * byte_ptr; - - byte_ptr = va_arg(arg, char *); - - assert( byte_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(byte_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - (*byte_ptr) = len; - } - else - { - #if defined(USE_64_BIT_INTS) && defined(__GNUC__) - { - if(parameter_size == parameter_size_long_long || parameter_size == parameter_size_intmax_t) - { - long long * int_ptr; - - int_ptr = va_arg(arg, long long *); - - assert( int_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(int_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - (*int_ptr) = len; - } - else - { - int * int_ptr; - - int_ptr = va_arg(arg, int *); - - assert( int_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(int_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - (*int_ptr) = len; - } - } - #else - { - int * int_ptr; - - int_ptr = va_arg(arg, int *); - - assert( int_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(int_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - (*int_ptr) = len; - } - #endif /* __GNUC__ */ - } - - continue; - } - else - { - SHOWMSG("anything else"); - - /* Just store the conversion_type character. */ - if(__putc(conversion_type,stream,buffer_mode) == EOF) - goto out; - - len++; - - continue; - } - - /* Get ready to prefix a sign character, if required. */ - if(FLAG_IS_SET(format_flags,FORMATF_IsNegative)) - prefix = "-"; - else if (FLAG_IS_SET(format_flags,FORMATF_ProduceSign)) - prefix = "+"; - else if (FLAG_IS_SET(format_flags,FORMATF_ProduceSpace)) - prefix = " "; - else if (FLAG_IS_SET(format_flags,FORMATF_ZeroPrefix)) - prefix = "0"; - else - prefix = NULL; - - if(FLAG_IS_SET(format_flags,FORMATF_HexPrefix)) - { - strcpy(prefix_buffer,(prefix != NULL ? prefix : "")); - strcat(prefix_buffer,FLAG_IS_SET(format_flags,FORMATF_CapitalLetters) ? "0X" : "0x"); - - prefix = prefix_buffer; - } - - if(FLAG_IS_SET(format_flags,FORMATF_LeftJustified)) - { - int i; - - if(prefix != NULL) - { - - for(i = 0 ; prefix[i] != '\0' ; i++) - { - /* One less character to fill the output with. */ - minimum_field_width--; - - if(__putc(prefix[i],stream,buffer_mode) == EOF) - goto out; - - len++; - } - } - - for(i = 0 ; i < output_len ; i++) - { - if(__putc(output_buffer[i],stream,buffer_mode) == EOF) - goto out; - - len++; - } - - #if defined(FLOATING_POINT_SUPPORT) - { - for(i = 0 ; i < num_trailing_zeroes ; i++) - { - if(__putc('0',stream,buffer_mode) == EOF) - goto out; - - output_len++; - len++; - } - - for(i = 0 ; trail_string[i] != '\0' ; i++) - { - if(__putc(trail_string[i],stream,buffer_mode) == EOF) - goto out; - - output_len++; - len++; - } - } - #endif /* FLOATING_POINT_SUPPORT */ - - for(i = output_len ; i < minimum_field_width ; i++) - { - /* Left justified output defaults to use the blank - space as the fill character. */ - if(__putc(' ',stream,buffer_mode) == EOF) - goto out; - - len++; - } - } - else - { - int i; - - /* If we have to add the prefix later, make sure that - we don't add too many fill characters in front of - it now. */ - if(prefix != NULL) - { - for(i = 0 ; prefix[i] != '\0' ; i++) - { - /* One less character to fill the output with. */ - minimum_field_width--; - - if(fill_character == '0') - { - if(__putc(prefix[i],stream,buffer_mode) == EOF) - goto out; - - len++; - } - } - - /* That takes care of the sign. */ - if(fill_character == '0') - prefix = NULL; - } - - #if defined(FLOATING_POINT_SUPPORT) - { - trail_string_len = strlen(trail_string); - - minimum_field_width -= num_trailing_zeroes + trail_string_len; - } - #endif /* FLOATING_POINT_SUPPORT */ - - for(i = output_len ; i < minimum_field_width ; i++) - { - if(__putc(fill_character,stream,buffer_mode) == EOF) - goto out; - - len++; - } - - /* If we still have a sign character to add, do it here. */ - if(prefix != NULL) - { - for(i = 0 ; prefix[i] != '\0' ; i++) - { - if(__putc(prefix[i],stream,buffer_mode) == EOF) - goto out; - - len++; - } - } - - - for(i = 0 ; i < output_len ; i++) - { - if(__putc(output_buffer[i],stream,buffer_mode) == EOF) - goto out; - - len++; - } - - #if defined(FLOATING_POINT_SUPPORT) - { - for(i = 0 ; i < num_trailing_zeroes ; i++) - { - if(__putc('0',stream,buffer_mode) == EOF) - goto out; - - len++; - } - - for(i = 0 ; i < trail_string_len ; i++) - { - if(__putc(trail_string[i],stream,buffer_mode) == EOF) - goto out; - - len++; - } - } - #endif /* FLOATING_POINT_SUPPORT */ - } - } - - if(FLAG_IS_CLEAR(iob->iob_Flags,IOBF_NO_NUL)) - { - if(__putc('\0',stream,buffer_mode) == EOF) - goto out; - } - - result = len; - - out: - - #if defined(FLOATING_POINT_SUPPORT) - { - if(internal_buffer != NULL && internal_buffer_size > 0) - free(internal_buffer); - } - #endif /* FLOATING_POINT_SUPPORT */ - - /* Note: if buffering is disabled for this stream, then we still - may have buffered data around, queued to be printed right now. - This is intended to improve performance as it takes more effort - to write a single character to a file than to write a bunch. */ - if(result != EOF && (iob->iob_Flags & IOBF_BUFFER_MODE) == IOBF_BUFFER_MODE_NONE) - { - if(__iob_write_buffer_is_valid(iob) && __flush_iob_write_buffer(iob) < 0) - result = EOF; - } - - funlockfile(stream); - - RETURN(result); - return(result); -} diff --git a/library/stdio_vfscanf.c b/library/stdio_vfscanf.c deleted file mode 100644 index d233599..0000000 --- a/library/stdio_vfscanf.c +++ /dev/null @@ -1,1923 +0,0 @@ -/* - * $Id: stdio_vfscanf.c,v 1.18 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) && !defined(_MATH_HEADERS_H) -#include "math_headers.h" -#endif /* FLOATING_POINT_SUPPORT && !_MATH_HEADERS_H */ - -/****************************************************************************/ - -/* - * Uncomment this to activate '%lld' support and the like. Better still, - * define this is in the Makefile! - */ -/*#define USE_64_BIT_INTS*/ - -/****************************************************************************/ - -int -vfscanf(FILE *stream, const char *format, va_list arg) -{ - enum parameter_size_t - { - parameter_size_byte, - parameter_size_long, - parameter_size_short, - parameter_size_size_t, - parameter_size_ptrdiff_t, - parameter_size_long_long, - parameter_size_long_double, - parameter_size_intmax_t, - parameter_size_default - }; - - enum parameter_size_t parameter_size; - int total_num_chars_read = 0; - int num_chars_processed; - BOOL assignment_suppressed; - int maximum_field_width; - int result = EOF; - int num_conversions = 0; - int num_assignments = 0; - int conversion_type; - int c; - - ENTER(); - - assert( stream != NULL && format != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(stream); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(stream == NULL || format == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(__fgetc_check(stream) < 0) - goto out; - - /* Just so we can detect errors and tell them apart from - an 'end of file' condition. */ - clearerr(stream); - - while((c = (*(unsigned char *)format)) != '\0') - { - D(("next format character is '%lc'",c)); - - if(isspace(c)) - { - /* Skip all blank spaces in the stream. */ - format++; - - while((c = __getc(stream)) != EOF) - { - if(isspace(c)) - { - total_num_chars_read++; - } - else - { - /* End of the white space; we push the last - * character read back into the stream. - */ - if(ungetc(c,stream) == EOF) - goto out; - - /* Resume scanning. */ - break; - } - } - - if(c == EOF) - { - SHOWMSG("end of file"); - - /* Hit the end of the stream? */ - if(num_conversions == 0) - goto out; - - /* Finished... */ - break; - } - - /* Resume scanning. */ - continue; - } - else if (c != '%') - { - int d; - - SHOWMSG("next character must match exactly"); - - /* Match the next character in the stream. */ - format++; - - d = __getc(stream); - if(d == EOF) - { - SHOWMSG("end of file"); - - /* Hit the end of the stream. */ - if(num_conversions == 0) - goto out; - - break; - } - else if (c == d) - { - SHOWMSG("it matches"); - - total_num_chars_read++; - } - else - { - SHOWMSG("it does not match"); - - if(ungetc(d,stream) == EOF) - goto out; - - break; - } - - /* Resume scanning. */ - continue; - } - - format++; - - c = (*format); - - if(c == '*') - { - /* If the first letter of the format specification - * is an asterisk, no output will be produced for - * this parameter. - */ - assignment_suppressed = TRUE; - - format++; - - c = (*format); - } - else - { - assignment_suppressed = FALSE; - } - - maximum_field_width = -1; - - if('0' <= c && c <= '9') - { - int next_sum; - int sum = 0; - - /* This could be the field width specification. */ - while(TRUE) - { - c = (*format); - - if('0' <= c && c <= '9') - { - next_sum = (10 * sum) + c - '0'; - if(next_sum < sum) /* overflow? */ - break; - - sum = next_sum; - format++; - } - else - { - break; - } - } - - maximum_field_width = sum; - } - else if (c == '\0') - { - /* And that's the end of the string. */ - break; - } - - c = (*format); - - if(c == 'h') - { - /* Parameter is a short integer. */ - parameter_size = parameter_size_short; - format++; - } - else if (c == 'j') - { - parameter_size = parameter_size_intmax_t; - format++; - } - else if (c == 'l') - { - /* Parameter is a long integer or a double precision floating point value. */ - parameter_size = parameter_size_long; - format++; - } - else if (c == 'L') - { - /* Parameter is a long double floating point value. */ - parameter_size = parameter_size_long_double; - format++; - } - else if (c == 't') - { - parameter_size = parameter_size_ptrdiff_t; - format++; - } - else if (c == 'z') - { - parameter_size = parameter_size_size_t; - format++; - } - else if (c == '\0') - { - /* And that's the end of the string. */ - break; - } - else - { - /* Parameter is a long integer or a single precision floating point value. */ - parameter_size = parameter_size_default; - } - - /* Now for the conversion type. */ - c = (*format); - if(c == '\0') - break; - - #if defined(USE_64_BIT_INTS) && defined(__GNUC__) - { - /* Check for long long parameters. */ - if(parameter_size == parameter_size_long && c == 'l') - { - parameter_size = parameter_size_long_long; - - format++; - - /* The conversion type follows. */ - c = (*format); - if(c == '\0') - break; - } - } - #endif /* __GNUC__ */ - - /* Check for byte parameters. */ - if(parameter_size == parameter_size_short && c == 'h') - { - parameter_size = parameter_size_byte; - - format++; - - /* The conversion type follows. */ - c = (*format); - if(c == '\0') - break; - } - - switch(c) - { - /* It's a pointer. */ - case 'p': - - conversion_type = 'x'; - format++; - break; - - /* It's a floating point number. */ - case 'a': - case 'A': - case 'e': - case 'E': - case 'f': - case 'g': - case 'G': - - conversion_type = 'f'; - format++; - break; - - case 'c': /* character(s) */ - case 'd': /* signed integer */ - case 'i': /* signed integer in decimal, octal or hexadecimal format */ - case 'n': /* number of characters processed */ - case 'o': /* integer (octal) */ - case 's': /* string */ - case 'u': /* unsigned integer */ - case 'x': /* unsigned integer in hexadecimal format */ - case 'X': /* unsigned integer in hexadecimal format */ - case '%': /* the % character */ - case '[': /* a range of characters */ - - conversion_type = c; - format++; - break; - - default: - - /* Must be something else */ - continue; - } - - /* Skip any initial whitespace characters. Exceptions are %c, %n and %[. */ - if(conversion_type != 'c' && - conversion_type != 'n' && - conversion_type != '[') - { - while((c = __getc(stream)) != EOF) - { - if(isspace(c)) - { - total_num_chars_read++; - } - else - { - /* End of the white space; we push the last - * character read back into the stream. - */ - if(ungetc(c,stream) == EOF) - goto out; - - /* Proceed with the conversion operation. */ - break; - } - } - } - - num_chars_processed = 0; - - D(("conversion type = '%lc'",c)); - - if(conversion_type == 'c') - { - char * c_ptr; - int i; - - /* The maximum field width is actually the number - * of characters that should be read. Default is - * 1 character. - */ - if(maximum_field_width < 0) - maximum_field_width = 1; - - if(NOT assignment_suppressed) - { - assert( arg != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - c_ptr = va_arg(arg,char *); - - assert( c_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(c_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - } - else - { - c_ptr = NULL; - } - - for(i = 0 ; i < maximum_field_width ; i++) - { - c = __getc(stream); - if(c == EOF) - { - /* Bail out if we hit the end of the stream. */ - if(num_conversions == 0) - goto out; - - break; - } - - total_num_chars_read++; - - if(NOT assignment_suppressed) - (*c_ptr++) = c; - - num_chars_processed++; - } - - /* Did we read as many characters as we wanted? */ - if(num_chars_processed != maximum_field_width) - break; - - if(NOT assignment_suppressed) - num_assignments++; - - num_conversions++; - } - else if (conversion_type == 'f') - { - #if defined(FLOATING_POINT_SUPPORT) - { - __long_double_t sum = 0.0; - __long_double_t new_sum; - BOOL is_negative = FALSE; - BOOL decimal_point_matches = FALSE; - BOOL have_exponent = FALSE; - void * next_parameter = NULL; - - /* We boldly try to initialize the parameter to a well- - defined value before we begin the conversion. */ - if(NOT assignment_suppressed) - { - assert( arg != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(parameter_size == parameter_size_default) - { - SHOWMSG("short format (float)"); - - next_parameter = va_arg(arg,float *); - } - else if (parameter_size == parameter_size_long) - { - SHOWMSG("long format (double)"); - - next_parameter = va_arg(arg,double *); - } - else - { - SHOWMSG("extended format (long double)"); - - next_parameter = va_arg(arg,__long_double_t *); - } - - assert( next_parameter != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(next_parameter == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(parameter_size == parameter_size_default) - { - *((float *)next_parameter) = 0; - } - else if (parameter_size == parameter_size_long) - { - *((double *)next_parameter) = 0; - } - else - { - *((__long_double_t *)next_parameter) = 0; - } - } - - if(maximum_field_width != 0) - { - c = __getc(stream); - if(c != EOF) - { - /* Skip the sign. */ - if(c == '-') - { - SHOWMSG("negative floating point number"); - - is_negative = 1; - - total_num_chars_read++; - - if(maximum_field_width > 0) - maximum_field_width--; - } - else if (c == '+') - { - SHOWMSG("ignoring positive sign"); - - total_num_chars_read++; - - if(maximum_field_width > 0) - maximum_field_width--; - } - else - { - D(("first character '%lc' is not a sign",c)); - - /* It's not a sign; reread this later. */ - if(ungetc(c,stream) == EOF) - { - SHOWMSG("couldn't push this character back"); - goto out; - } - } - } - } - - /* Now it gets complicated. We need to pick up a keyword - such as "inf", "infinity" or "nan" if it's present. - This is tricky because we won't be able to push all - the characters back we read during scanning. */ - if(maximum_field_width != 0) - { - const char infinity_string[] = "infinity"; - const char infinity_nan[] = "nan"; - char chars_read_so_far[80]; - size_t num_chars_read_so_far = 0; - size_t infinity_match = 0; - size_t nan_match = 0; - - while(maximum_field_width != 0 && num_chars_read_so_far < sizeof(chars_read_so_far) && (c = __getc(stream)) != EOF) - { - D(("c = '%lc'",c)); - - if(tolower(c) == infinity_string[infinity_match]) - { - SHOWVALUE(infinity_match); - - nan_match = 0; - - chars_read_so_far[num_chars_read_so_far++] = c; - if(maximum_field_width > 0) - maximum_field_width--; - - /* Did we match the complete word? */ - infinity_match++; - if(infinity_match == sizeof(infinity_string)-1) - { - SHOWMSG("we have a match for infinity"); - break; - } - } - else if (infinity_match == 3) /* Did we match the "inf" of "infinity"? */ - { - SHOWVALUE(infinity_match); - - nan_match = 0; - - if(ungetc(c,stream) == EOF) - { - SHOWMSG("couldn't push this character back"); - goto out; - } - - SHOWMSG("we have a match for inf"); - break; - } - else if (tolower(c) == infinity_nan[nan_match]) - { - SHOWVALUE(nan_match); - - infinity_match = 0; - - chars_read_so_far[num_chars_read_so_far++] = c; - if(maximum_field_width > 0) - maximum_field_width--; - - /* Did we match the complete word? */ - nan_match++; - if(nan_match == sizeof(infinity_nan)-1) - { - SHOWMSG("we have a match for nan"); - - /* Check for the () to follow the nan. */ - if(maximum_field_width != 0 && num_chars_read_so_far < sizeof(chars_read_so_far) && (c = __getc(stream)) != EOF) - { - /* Is this the opening parenthesis of the "nan()" keyword? */ - if(c == '(') - { - SHOWMSG("there's something following the nan"); - - nan_match++; - - if(maximum_field_width > 0) - maximum_field_width--; - - /* Look for the closing parenthesis. */ - while(maximum_field_width != 0 && (c = __getc(stream)) != EOF) - { - nan_match++; - - if(maximum_field_width > 0) - maximum_field_width--; - - if(c == ')') - break; - } - } - else - { - if(ungetc(c,stream) == EOF) - { - SHOWMSG("couldn't push this character back"); - goto out; - } - } - } - - break; - } - } - else - { - SHOWMSG("we didn't find a match for infinity/nan"); - - nan_match = infinity_match = 0; - - if(ungetc(c,stream) == EOF) - { - SHOWMSG("couldn't push this character back"); - goto out; - } - - maximum_field_width += num_chars_read_so_far; - - /* Let's try our best here... */ - while(num_chars_read_so_far > 0) - ungetc(chars_read_so_far[--num_chars_read_so_far],stream); - - break; - } - } - - SHOWVALUE(infinity_match); - - if(infinity_match >= 3) - { - SHOWMSG("infinity"); - - sum = __inf(); - - total_num_chars_read = num_chars_processed = infinity_match; - } - else if (nan_match >= 3) - { - SHOWMSG("not a number"); - - sum = nan(NULL); - - total_num_chars_read = num_chars_processed = nan_match; - } - } - - /* If we didn't find a keyword above, look for digits. */ - if(num_chars_processed == 0) - { - int radix = 10; - - /* Check if there's a hex prefix introducing this number. */ - if(maximum_field_width != 0 && (c = __getc(stream)) != EOF) - { - if(c == '0') - { - /* Use the leading zero as is. */ - total_num_chars_read++; - num_chars_processed++; - - if(maximum_field_width > 0) - maximum_field_width--; - - if(maximum_field_width != 0 && (c = __getc(stream)) != EOF) - { - if(tolower(c) == 'x') - { - SHOWMSG("found the 0x prefix; setting radix to 16"); - - /* The floating point number will be encoded - in hexadecimal/binary notation. */ - radix = 16; - - total_num_chars_read++; - num_chars_processed++; - - if(maximum_field_width > 0) - maximum_field_width--; - } - else - { - /* Put this back. */ - if(ungetc(c,stream) == EOF) - { - SHOWMSG("couldn't push this character back"); - goto out; - } - } - } - } - else - { - /* Put this back. */ - if(ungetc(c,stream) == EOF) - { - SHOWMSG("couldn't push this character back"); - goto out; - } - } - } - - if(maximum_field_width != 0) - { - int digit; - - while(maximum_field_width != 0 && (c = __getc(stream)) != EOF) - { - /* Is this a digit? */ - if('0' <= c && c <= '9') - digit = c - '0'; - else if ('a' <= c && c <= 'f') - digit = c - 'a' + 10; - else if ('A' <= c && c <= 'F') - digit = c - 'A' + 10; - else - digit = radix; - - if(digit < radix) - { - D(("got another digit '%lc'",c)); - - new_sum = (radix * sum) + digit; - if(new_sum < sum) /* overflow? */ - { - /* Put this back. */ - if(ungetc(c,stream) == EOF) - { - SHOWMSG("couldn't push this character back"); - goto out; - } - - break; - } - - sum = new_sum; - } - else - { - D(("'%lc' is not a digit",c)); - - /* It's not a digit; reread this later. */ - if(ungetc(c,stream) == EOF) - { - SHOWMSG("couldn't push this character back"); - goto out; - } - - break; - } - - total_num_chars_read++; - num_chars_processed++; - - if(maximum_field_width > 0) - maximum_field_width--; - } - - if(c == EOF && num_chars_processed == 0 && num_conversions == 0) - goto out; - } - - if(maximum_field_width != 0) - { - SHOWMSG("looking for decimal point"); - - c = __getc(stream); - if(c != EOF) - { - __locale_lock(); - - /* Did we find the decimal point? We accept both the - * locale configured decimal point and the plain old - * dot. - */ - if(__locale_table[LC_NUMERIC] != NULL) - { - unsigned char * point; - - point = (unsigned char *)__locale_table[LC_NUMERIC]->loc_DecimalPoint; - - if(c == (*point) || c == '.') - { - SHOWMSG("found a decimal point"); - - decimal_point_matches = TRUE; - } - else - { - D(("'%lc' is not a decimal point",c)); - } - } - else - { - if(c == '.') - { - SHOWMSG("found a decimal point"); - - decimal_point_matches = TRUE; - } - else - { - D(("'%lc' is not a decimal point",c)); - } - } - - __locale_unlock(); - - if(decimal_point_matches) - { - total_num_chars_read++; - - if(maximum_field_width > 0) - maximum_field_width--; - } - else if ((radix == 10 && (c == 'e' || c == 'E')) || - (radix == 16 && (c == 'p' || c == 'P'))) - { - SHOWMSG("found an exponent specifier"); - - total_num_chars_read++; - - have_exponent = TRUE; - - if(maximum_field_width > 0) - maximum_field_width--; - } - else - { - if(ungetc(c,stream) == EOF) - { - SHOWMSG("couldn't push this character back"); - goto out; - } - } - } - - if(decimal_point_matches) - { - double multiplier = 1.0 / radix; - int digit; - - SHOWMSG("found a decimal point"); - - /* Process all digits following the decimal point. */ - while(maximum_field_width != 0 && (c = __getc(stream)) != EOF) - { - /* Is this a digit? */ - if('0' <= c && c <= '9') - digit = c - '0'; - else if ('a' <= c && c <= 'f') - digit = c - 'a' + 10; - else if ('A' <= c && c <= 'F') - digit = c - 'A' + 10; - else - digit = radix; - - if(digit < radix) - { - D(("got another digit '%lc'",c)); - - if(multiplier != 0.0) - { - new_sum = sum + digit * multiplier; - if(new_sum < sum) /* overflow? */ - { - SHOWMSG("got an overflow"); - - /* Put this back. */ - if(ungetc(c,stream) == EOF) - { - SHOWMSG("couldn't push this character back"); - goto out; - } - - break; - } - - sum = new_sum; - - multiplier = multiplier / radix; - } - - total_num_chars_read++; - - if(maximum_field_width > 0) - maximum_field_width--; - } - else if ((radix == 10 && (c == 'e' || c == 'E')) || - (radix == 16 && (c == 'p' || c == 'P'))) - { - SHOWMSG("found an exponent specifier"); - - total_num_chars_read++; - - if(maximum_field_width > 0) - maximum_field_width--; - - have_exponent = TRUE; - break; - } - else - { - if(ungetc(c,stream) == EOF) - { - SHOWMSG("couldn't push this character back"); - goto out; - } - - break; - } - } - } - - if(have_exponent) - { - BOOL exponent_is_negative = FALSE; - int new_exponent; - int exponent = 0; - int exponent_radix; - - SHOWMSG("processing exponent"); - - /* The exponent may be a binary number. */ - if(radix == 16) - exponent_radix = 2; - else - exponent_radix = 10; - - if(maximum_field_width != 0) - { - c = __getc(stream); - if(c != EOF) - { - int digit; - - /* Skip the sign. */ - if(c == '-') - { - exponent_is_negative = TRUE; - - total_num_chars_read++; - - if(maximum_field_width > 0) - maximum_field_width--; - } - else if (c == '+') - { - total_num_chars_read++; - - if(maximum_field_width > 0) - maximum_field_width--; - } - else - { - /* It's not a sign; reread this later. */ - if(ungetc(c,stream) == EOF) - { - SHOWMSG("couldn't push this character back"); - goto out; - } - } - - while(maximum_field_width != 0 && (c = __getc(stream)) != EOF) - { - if('0' <= c && c <= '9') - digit = c - '0'; - else - digit = exponent_radix; - - if(digit < exponent_radix) - { - D(("got another digit '%lc'",c)); - - new_exponent = (exponent_radix * exponent) + digit; - if(new_exponent < exponent) /* overflow? */ - { - if(ungetc(c,stream) == EOF) - { - SHOWMSG("couldn't push this character back"); - goto out; - } - - break; - } - - exponent = new_exponent; - - total_num_chars_read++; - - if(maximum_field_width > 0) - maximum_field_width--; - } - else - { - if(ungetc(c,stream) == EOF) - { - SHOWMSG("couldn't push this character back"); - goto out; - } - - break; - } - } - - /* If the exponent is valid, scale the number - * accordingly. - */ - if(exponent != 0) - { - if(exponent_is_negative) - { - double divisor; - - /* A negative exponent means division. */ - divisor = pow((double)radix,(double)exponent); - if(divisor != 0.0) - sum = sum / divisor; - } - else - { - /* A positive exponent means multiplication. */ - new_sum = sum * pow((double)radix,(double)exponent); - if(new_sum >= sum) - sum = new_sum; - else - sum = __get_huge_val(); - } - } - } - } - } - } - } - - SHOWMSG("conversion finished.."); - - if(num_chars_processed > 0) - { - if(NOT assignment_suppressed) - { - if(is_negative) - sum = (-sum); - - if(parameter_size == parameter_size_default) - { - *((float *)next_parameter) = sum; - } - else if (parameter_size == parameter_size_long) - { - *((double *)next_parameter) = sum; - } - else - { - *((__long_double_t *)next_parameter) = sum; - } - - num_assignments++; - } - - num_conversions++; - } - } - #else - { - if(NOT assignment_suppressed) - { - void * next_parameter; - - assert( arg != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(parameter_size == parameter_size_default) - { - SHOWMSG("short format (float)"); - - next_parameter = va_arg(arg,float *); - } - else if (parameter_size == parameter_size_long) - { - SHOWMSG("long format (double)"); - - next_parameter = va_arg(arg,double *); - } - else - { - SHOWMSG("extended format (long double)"); - - next_parameter = va_arg(arg,__long_double_t *); - } - - assert( next_parameter != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(next_parameter == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - } - } - #endif /* FLOATING_POINT_SUPPORT */ - } - else if (conversion_type == 'd' || - conversion_type == 'i' || - conversion_type == 'o' || - conversion_type == 'u' || - conversion_type == 'x') - { - #if defined(USE_64_BIT_INTS) && defined(__GNUC__) - long long next_sum; - long long sum = 0; - #else - int next_sum; - int sum = 0; - #endif /* __GNUC__ */ - BOOL is_negative = FALSE; - int radix; - void * next_parameter = NULL; - - /* We boldly try to initialize the parameter to a well- - defined value before we begin the conversion. */ - if(NOT assignment_suppressed) - { - assert( arg != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(parameter_size == parameter_size_short) - { - next_parameter = va_arg(arg,short *); - } - else if (parameter_size == parameter_size_byte) - { - next_parameter = va_arg(arg,char *); - } - else - { - #if defined(USE_64_BIT_INTS) && defined(__GNUC__) - { - if(parameter_size == parameter_size_long_long || parameter_size == parameter_size_intmax_t) - next_parameter = va_arg(arg,long long *); - else - next_parameter = va_arg(arg,int *); - } - #else - { - next_parameter = va_arg(arg,int *); - } - #endif /* __GNUC__ */ - } - - assert( next_parameter != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(next_parameter == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(parameter_size == parameter_size_short) - { - *((short *)next_parameter) = 0; - } - else if (parameter_size == parameter_size_byte) - { - *((char *)next_parameter) = 0; - } - else - { - #if defined(USE_64_BIT_INTS) && defined(__GNUC__) - { - if(parameter_size == parameter_size_long_long || parameter_size == parameter_size_intmax_t) - *((long long *)next_parameter) = 0; - else - *((int *)next_parameter) = 0; - } - #else - { - *((int *)next_parameter) = 0; - } - #endif /* __GNUC__ */ - } - } - - /* Chose a base according to the conversion to be - expected. For the 'x' and 'i' we examine the - incoming data rather than commit ourselves to - a peculiar data format now. */ - if(conversion_type == 'd' || conversion_type == 'u') - radix = 10; - else if (conversion_type == 'o') - radix = 8; - else - radix = 0; - - if(maximum_field_width != 0) - { - c = __getc(stream); - if(c != EOF) - { - /* Skip the sign. */ - if(c == '-') - { - is_negative = TRUE; - - total_num_chars_read++; - - if(maximum_field_width > 0) - maximum_field_width--; - } - else if (c == '+') - { - total_num_chars_read++; - - if(maximum_field_width > 0) - maximum_field_width--; - } - else if (c == '0') - { - /* Keep the leading zero. */ - total_num_chars_read++; - num_chars_processed++; - - if(maximum_field_width > 0) - maximum_field_width--; - - if(radix == 0 && maximum_field_width != 0) - { - /* This could be an octal number, the - * '0x' prefix or just a zero. - */ - c = __getc(stream); - - /* This takes care of the '0x' prefix for hexadecimal - numbers ('%x') and also picks the right type of - data for the '%i' type. */ - if ((c == 'x' || c == 'X') && (conversion_type == 'x' || conversion_type == 'i')) - { - /* It's the hex prefix. */ - radix = 16; - - /* The preceding '0' was part of the - hex prefix. So we don't really know - the number yet. */ - num_chars_processed--; - - total_num_chars_read++; - - if(maximum_field_width > 0) - maximum_field_width--; - } - else if (isdigit(c) && (conversion_type == 'i')) /* This could be the octal prefix for the '%i' format. */ - { - /* The preceding '0' was part of the - octal prefix. So we don't really know - the number yet. */ - num_chars_processed--; - - /* It's an octal number. */ - radix = 8; - - /* Process the rest later. */ - if(ungetc(c,stream) == EOF) - goto out; - } - else if (c != EOF) - { - /* It's something else; put it back. */ - if(ungetc(c,stream) == EOF) - goto out; - } - } - } - else - { - if(ungetc(c,stream) == EOF) - goto out; - } - } - } - - /* Pick a base if none has been chosen yet. */ - if(radix == 0) - { - if(conversion_type == 'x') - radix = 16; - else - radix = 10; - } - - if(maximum_field_width != 0) - { - int digit; - - while(maximum_field_width != 0 && (c = __getc(stream)) != EOF) - { - /* Is this a digit or hexadecimal value? */ - if('0' <= c && c <= '9') - digit = c - '0'; - else if ('a' <= c && c <= 'f') - digit = c - 'a' + 10; - else if ('A' <= c && c <= 'F') - digit = c - 'A' + 10; - else - digit = radix; - - /* Is this a valid digit? */ - if(digit >= radix) - { - if(ungetc(c,stream) == EOF) - goto out; - - break; - } - - next_sum = (radix * sum) + digit; - - #if defined(USE_64_BIT_INTS) && defined(__GNUC__) - { - if((parameter_size == parameter_size_long_long || parameter_size == parameter_size_intmax_t) && (unsigned long long)next_sum < (unsigned long long)sum) /* overflow? */ - { - /* Put this back. */ - if(ungetc(c,stream) == EOF) - goto out; - - break; - } - else if ((unsigned int)next_sum < (unsigned int)sum) /* overflow? */ - { - /* Put this back. */ - if(ungetc(c,stream) == EOF) - goto out; - - break; - } - } - #else - { - if((unsigned int)next_sum < (unsigned int)sum) /* overflow? */ - { - /* Put this back. */ - if(ungetc(c,stream) == EOF) - goto out; - - break; - } - } - #endif /* __GNUC__ */ - - total_num_chars_read++; - num_chars_processed++; - - sum = next_sum; - - if(maximum_field_width > 0) - maximum_field_width--; - } - - if(c == EOF && num_chars_processed == 0 && num_conversions == 0) - goto out; - } - - if(num_chars_processed > 0) - { - if(NOT assignment_suppressed) - { - if(is_negative) - sum = (-sum); - - if(parameter_size == parameter_size_short) - { - *((short *)next_parameter) = sum; - } - else if (parameter_size == parameter_size_byte) - { - *((char *)next_parameter) = sum; - } - else - { - #if defined(USE_64_BIT_INTS) && defined(__GNUC__) - { - if(parameter_size == parameter_size_long_long || parameter_size == parameter_size_intmax_t) - *((long long *)next_parameter) = sum; - else - *((int *)next_parameter) = sum; - } - #else - { - *((int *)next_parameter) = sum; - } - #endif /* __GNUC__ */ - } - - num_assignments++; - } - - num_conversions++; - } - } - else if (conversion_type == 's') - { - char * s_ptr; - - if(NOT assignment_suppressed) - { - assert( arg != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - s_ptr = va_arg(arg,char *); - - assert( s_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - } - else - { - s_ptr = NULL; - } - - /* Try to NUL terminate this even in case of failure. */ - if(NOT assignment_suppressed) - (*s_ptr) = '\0'; - - if(maximum_field_width != 0) - { - while(maximum_field_width != 0 && (c = __getc(stream)) != EOF) - { - /* Blank spaces stop the conversion process. */ - if(isspace(c)) - { - if(ungetc(c,stream) == EOF) - goto out; - - break; - } - - total_num_chars_read++; - num_chars_processed++; - - if(NOT assignment_suppressed) - { - (*s_ptr++) = c; - (*s_ptr) = '\0'; /* Try to NUL terminate this even in case of failure. */ - } - - if(maximum_field_width > 0) - maximum_field_width--; - } - - /* The conversion is considered to have failed if an EOF was - encountered before any non-whitespace characters could be - converted. */ - if(c == EOF && num_chars_processed == 0 && num_conversions == 0) - goto out; - } - - if(NOT assignment_suppressed) - num_assignments++; - - num_conversions++; - } - else if (conversion_type == 'n') - { - if(NOT assignment_suppressed) - { - assert( arg != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(parameter_size == parameter_size_short) - { - short * short_ptr; - - short_ptr = va_arg(arg,short *); - - assert( short_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(short_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - (*short_ptr) = total_num_chars_read; - } - else if (parameter_size == parameter_size_byte) - { - char * byte_ptr; - - byte_ptr = va_arg(arg,char *); - - assert( byte_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(byte_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - (*byte_ptr) = total_num_chars_read; - } - else - { - #if defined(USE_64_BIT_INTS) && defined(__GNUC__) - { - if(parameter_size == parameter_size_long_long || parameter_size == parameter_size_intmax_t) - { - long long * int_ptr; - - int_ptr = va_arg(arg,long long *); - - assert( int_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(int_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - (*int_ptr) = total_num_chars_read; - } - else - { - int * int_ptr; - - int_ptr = va_arg(arg,int *); - - assert( int_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(int_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - (*int_ptr) = total_num_chars_read; - } - } - #else - { - int * int_ptr; - - int_ptr = va_arg(arg,int *); - - assert( int_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(int_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - (*int_ptr) = total_num_chars_read; - } - #endif /* __GNUC__ */ - } - } - } - else if (c == '%') - { - int d; - - d = __getc(stream); - if(d == EOF) - { - SHOWMSG("end of file"); - - /* Hit the end of the stream. */ - if(num_conversions == 0) - goto out; - - break; - } - else if (c == d) - { - total_num_chars_read++; - } - else - { - /* This is not what we expected. We're finished. */ - if(ungetc(d,stream) == EOF) - goto out; - - break; - } - } - else if (c == '[') - { - char * s_ptr; - char set[256]; - const unsigned char * scanset; - size_t scanset_length,i; - int pick; - - if(NOT assignment_suppressed) - { - assert( arg != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - s_ptr = va_arg(arg,char *); - - assert( s_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - } - else - { - s_ptr = NULL; - } - - c = (*format); - if(c == '^') - { - /* Accept only characters which are not found in the range. */ - pick = 0; - - format++; - } - else - { - /* Accept only characters which are found in the range. */ - pick = 1; - } - - memset(set,1 - pick,sizeof(set)); - - /* If the ']' character introduces the range, then - * it is not considered the range termination character. - */ - c = (*format); - if(c == ']') - { - set[c] = pick; - - format++; - } - - /* Figure out how many characters are in the scanset. */ - scanset = (const unsigned char *)format; - - for(scanset_length = 0 ; scanset[scanset_length] != '\0' && scanset[scanset_length] != ']' ; scanset_length++) - format++; - - /* We already skipped everything but the right bracket. */ - if((*format) == ']') - format++; - - /* Now have a look at the specification. We support a non-standard - scanf() family feature which permits you to specify ranges of - characters rather than spelling out each character included in - the range. */ - for(i = 0 ; i < scanset_length ; i++) - { - c = scanset[i]; - - /* Could this be a range? It's not a range if it - is the first or the last character in the - specification. */ - if(c == '-' && 0 < i && i < scanset_length - 1) - { - int first,last,j; - - /* Pick the first and the last character in - the range, e.g. for "%[A-Z]" the first would - be the 'A' and the 'Z' would be the last. */ - first = scanset[i-1]; - last = scanset[i+1]; - - /* Everything in the scanset now - goes into the set. */ - for(j = first ; j <= last ; j++) - set[j] = pick; - - /* Skip the character which marked the - end of the range and resume scanning. */ - i++; - - continue; - } - - assert( 0 <= c && c <= 255 ); - - set[c] = pick; - } - - /* Try to NUL terminate this even in case of failure. */ - if(NOT assignment_suppressed) - (*s_ptr) = '\0'; - - if(maximum_field_width != 0) - { - while(maximum_field_width != 0 && (c = __getc(stream)) != EOF) - { - assert( 0 <= c && c <= 255 ); - - /* If the character is not part of the - * range we stop further processing. - */ - if(set[c] == 0) - { - if(ungetc(c,stream) == EOF) - goto out; - - break; - } - - if(NOT assignment_suppressed) - { - (*s_ptr++) = c; - (*s_ptr) = '\0'; /* Try to NUL terminate this even in case of failure. */ - } - - total_num_chars_read++; - num_chars_processed++; - - if(maximum_field_width > 0) - maximum_field_width--; - } - - if(c == EOF && num_chars_processed == 0 && num_conversions == 0) - goto out; - } - - if(num_chars_processed > 0) - { - if(NOT assignment_suppressed) - num_assignments++; - - num_conversions++; - } - } - } - - result = num_assignments; - - out: - - funlockfile(stream); - - RETURN(result); - return(result); -} diff --git a/library/stdio_vprintf.c b/library/stdio_vprintf.c deleted file mode 100644 index 49fd7f0..0000000 --- a/library/stdio_vprintf.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $Id: stdio_vprintf.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -vprintf(const char *format,va_list arg) -{ - int result = EOF; - - ENTER(); - - SHOWSTRING(format); - SHOWPOINTER(arg); - - assert( format != NULL && arg != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(format == NULL || arg == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = vfprintf(stdout,format,arg); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_vscanf.c b/library/stdio_vscanf.c deleted file mode 100644 index d261ce1..0000000 --- a/library/stdio_vscanf.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * $Id: stdio_vscanf.c,v 1.1 2005-05-07 13:21:49 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -vscanf(const char *format,va_list arg) -{ - int result = EOF; - - ENTER(); - - SHOWSTRING(format); - - assert(format != NULL); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(format == NULL) - { - SHOWMSG("invalid format parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = vfscanf(stdin,format,arg); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_vsnprintf.c b/library/stdio_vsnprintf.c deleted file mode 100644 index af20a41..0000000 --- a/library/stdio_vsnprintf.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * $Id: stdio_vsnprintf.c,v 1.7 2005-02-28 10:07:31 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -vsnprintf(char *buffer,size_t size,const char *format,va_list arg) -{ - struct iob string_iob; - int result = EOF; - char local_buffer[32]; - - ENTER(); - - SHOWPOINTER(buffer); - SHOWVALUE(size); - SHOWSTRING(format); - SHOWPOINTER(arg); - - assert( format != NULL && arg != NULL && (int)size >= 0 ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(format == NULL || (buffer == NULL && size > 0)) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - __initialize_iob(&string_iob,__vsnprintf_hook_entry, - NULL, - local_buffer,sizeof(local_buffer), - -1, - -1, - IOBF_IN_USE | IOBF_WRITE | IOBF_NO_NUL | IOBF_BUFFER_MODE_NONE | IOBF_INTERNAL, - NULL); - - /* Store up to 'size-1' characters in the output buffer. This - does not include the terminating NUL character, which we - will add later. */ - string_iob.iob_String = (STRPTR)buffer; - string_iob.iob_StringSize = (size > 0) ? (size - 1) : 0; - - /* We will return the number of characters that would have been - stored if there had been enough room. */ - result = vfprintf((FILE *)&string_iob,format,arg); - - /* Figure out how many characters were stored. Fewer than - the output buffer size allows for may have been written - to the buffer. The string needs to be terminated with a - NUL byte behind the last character stored. */ - if(size > 0) - { - assert( string_iob.iob_StringPosition >= 0 ); - assert( string_iob.iob_StringPosition+1 <= size ); - - buffer[string_iob.iob_StringPosition] = '\0'; - - SHOWSTRING(buffer); - } - else - { - SHOWMSG("output buffer is empty"); - } - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdio_vsnprintf_hook_entry.c b/library/stdio_vsnprintf_hook_entry.c deleted file mode 100644 index e07a4a6..0000000 --- a/library/stdio_vsnprintf_hook_entry.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * $Id: stdio_vsnprintf_hook_entry.c,v 1.7 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -__vsnprintf_hook_entry( - struct iob * string_iob, - struct file_action_message * fam) -{ - int result = EOF; - - assert( fam != NULL && string_iob != NULL ); - - if(fam->fam_Action != file_action_write) - { - fam->fam_Error = EBADF; - goto out; - } - - if(fam->fam_Size > 0 && string_iob->iob_StringSize > 0 && string_iob->iob_StringPosition < string_iob->iob_StringSize) - { - int num_bytes_left; - int num_bytes; - - num_bytes_left = string_iob->iob_StringSize - string_iob->iob_StringPosition; - - num_bytes = fam->fam_Size; - if(num_bytes > num_bytes_left) - num_bytes = num_bytes_left; - - assert( num_bytes >= 0 ); - - assert( fam->fam_Data != NULL ); - assert( string_iob->iob_String != NULL ); - - memmove(&string_iob->iob_String[string_iob->iob_StringPosition],fam->fam_Data,(size_t)num_bytes); - string_iob->iob_StringPosition += num_bytes; - } - - result = fam->fam_Size; - - out: - - return(result); -} diff --git a/library/stdio_vsprintf.c b/library/stdio_vsprintf.c deleted file mode 100644 index 8c9258f..0000000 --- a/library/stdio_vsprintf.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * $Id: stdio_vsprintf.c,v 1.6 2005-02-28 10:07:31 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -vsprintf(char *s,const char *format,va_list arg) -{ - struct iob string_iob; - int result = EOF; - char buffer[32]; - - assert( s != NULL && format != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s == NULL || format == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - __initialize_iob(&string_iob,__vsprintf_hook_entry, - NULL, - buffer,sizeof(buffer), - -1, - -1, - IOBF_IN_USE | IOBF_WRITE | IOBF_BUFFER_MODE_NONE | IOBF_INTERNAL, - NULL); - - string_iob.iob_String = (STRPTR)s; - - result = vfprintf((FILE *)&string_iob,format,arg); - - out: - - return(result); -} diff --git a/library/stdio_vsprintf_hook_entry.c b/library/stdio_vsprintf_hook_entry.c deleted file mode 100644 index 0c47d48..0000000 --- a/library/stdio_vsprintf_hook_entry.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * $Id: stdio_vsprintf_hook_entry.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -__vsprintf_hook_entry( - struct iob * string_iob, - struct file_action_message * fam) -{ - int result = ERROR; - - assert( fam != NULL && string_iob != NULL ); - - if(fam->fam_Action != file_action_write) - { - fam->fam_Error = EBADF; - goto out; - } - - assert( fam->fam_Size >= 0 ); - - assert( fam->fam_Data != NULL ); - assert( string_iob->iob_StringPosition >= 0 ); - - memmove(&string_iob->iob_String[string_iob->iob_StringPosition],fam->fam_Data,(size_t)fam->fam_Size); - string_iob->iob_StringPosition += fam->fam_Size; - - result = fam->fam_Size; - - out: - - return(result); -} diff --git a/library/stdio_vsscanf.c b/library/stdio_vsscanf.c deleted file mode 100644 index af88d0a..0000000 --- a/library/stdio_vsscanf.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * $Id: stdio_vsscanf.c,v 1.1 2005-05-07 13:21:49 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -int -vsscanf(const char *s,const char *format,va_list arg) -{ - struct iob string_iob; - char local_buffer[32]; - int result = EOF; - - ENTER(); - - SHOWSTRING(s); - SHOWSTRING(format); - - assert( s != NULL && format != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s == NULL || format == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - __initialize_iob(&string_iob,__sscanf_hook_entry, - NULL, - local_buffer,sizeof(local_buffer), - -1, - -1, - IOBF_IN_USE | IOBF_READ | IOBF_BUFFER_MODE_FULL | IOBF_INTERNAL, - NULL); - - string_iob.iob_String = (STRPTR)s; - string_iob.iob_StringLength = strlen(s); - - result = vfscanf((FILE *)&string_iob,format,arg); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdlib_abort.c b/library/stdlib_abort.c deleted file mode 100644 index 539a6df..0000000 --- a/library/stdlib_abort.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * $Id: stdlib_abort.c,v 1.4 2005-03-27 10:02:50 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -#ifndef _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -void -abort(void) -{ - /* Try to call the signal handler that might be in charge of - handling cleanup operations, etc. */ - raise(SIGABRT); - - /* If the signal handler returns it means that we still have - to terminate the program. */ - - __check_abort_enabled = FALSE; - - __print_termination_message(NULL); - - /* Note that we drop into the exit() function which - does not trigger the exit trap. */ - _exit(EXIT_FAILURE); -} diff --git a/library/stdlib_abs.c b/library/stdlib_abs.c deleted file mode 100644 index c0d11f4..0000000 --- a/library/stdlib_abs.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id: stdlib_abs.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -int -abs(int x) -{ - int result; - - result = (x < 0) ? (-x) : x; - - return(result); -} diff --git a/library/stdlib_alloca.c b/library/stdlib_alloca.c deleted file mode 100644 index ba8698d..0000000 --- a/library/stdlib_alloca.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * $Id: stdlib_alloca.c,v 1.6 2005-03-18 12:38:23 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -#undef alloca - -extern void * alloca(size_t size); - -/****************************************************************************/ - -struct MemoryContextNode -{ - struct MinNode mcn_MinNode; - void * mcn_StackPointer; - void * mcn_Memory; -}; - -/****************************************************************************/ - -static struct MinList alloca_memory_list; - -/****************************************************************************/ - -CLIB_DESTRUCTOR(alloca_exit) -{ - ENTER(); - - /* Clean this up, too, just to be safe. */ - NewList((struct List *)&alloca_memory_list); - - LEAVE(); -} - -/****************************************************************************/ - -void -__alloca_cleanup(const char * file,int line) -{ - /* Initialize this if it hasn't been taken care of yet. */ - if(alloca_memory_list.mlh_Head == NULL) - NewList((struct List *)&alloca_memory_list); - - /* Is this worth cleaning up? */ - if(NOT IsListEmpty((struct List *)&alloca_memory_list)) - { - void * stack_pointer = __get_sp(); - struct MemoryContextNode * mcn_prev; - struct MemoryContextNode * mcn; - - /* The assumption is that the stack grows downwards. If this function is - called, we must get rid off all the allocations associated with stack - pointers whose addresses are smaller than the current stack pointer. - Which so happen to be stored near the end of the list. The further - we move up from the end to the top of the list, the closer we get - to the allocations made in the context of a stack frame near to - where were currently are. */ - for(mcn = (struct MemoryContextNode *)alloca_memory_list.mlh_TailPred ; - mcn->mcn_MinNode.mln_Pred != NULL && mcn->mcn_StackPointer < stack_pointer ; - mcn = mcn_prev) - { - mcn_prev = (struct MemoryContextNode *)mcn->mcn_MinNode.mln_Pred; - - Remove((struct Node *)mcn); - - __force_free(mcn->mcn_Memory,file,line); - __free(mcn,file,line); - } - } -} - -/****************************************************************************/ - -__static void * -__alloca(size_t size,const char * file,int line) -{ - void * stack_pointer = __get_sp(); - struct MemoryContextNode * mcn; - void * result = NULL; - - __alloca_cleanup(file,line); - - assert( (int)size >= 0 ); - - if(size == 0) - { - #ifdef __MEM_DEBUG - { - kprintf("[%s] ",__program_name); - - if(file != NULL) - kprintf("%s:%ld:",file,line); - - kprintf("alloca(0) called.\n"); - } - #endif /* __MEM_DEBUG */ - - goto out; - } - - mcn = __allocate_memory(sizeof(*mcn),FALSE,file,line); - if(mcn == NULL) - { - SHOWMSG("not enough memory"); - goto out; - } - - /* Allocate memory which cannot be run through realloc() or free(). */ - mcn->mcn_Memory = __allocate_memory(size,TRUE,file,line); - if(mcn->mcn_Memory == NULL) - { - SHOWMSG("not enough memory"); - - __free(mcn,file,line); - goto out; - } - - mcn->mcn_StackPointer = stack_pointer; - - assert( alloca_memory_list.mlh_Head != NULL ); - - AddTail((struct List *)&alloca_memory_list,(struct Node *)mcn); - - result = mcn->mcn_Memory; - - out: - - return(result); -} - -/****************************************************************************/ - -void * -alloca(size_t size) -{ - void * result; - - result = __alloca(size,NULL,0); - - return(result); -} diff --git a/library/stdlib_arg.c b/library/stdlib_arg.c deleted file mode 100644 index fdd58e8..0000000 --- a/library/stdlib_arg.c +++ /dev/null @@ -1,346 +0,0 @@ -/* - * $Id: stdlib_arg.c,v 1.8 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 DEBUG*/ - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -#ifndef _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -#include -#include -#include -#include -#include - -/****************************************************************************/ - -char ** NOCOMMON __argv; -int NOCOMMON __argc; - -/****************************************************************************/ - -STATIC BOOL -is_space(unsigned char c) -{ - BOOL result; - - result = (BOOL)(c == '\t' || /* horizontal tab */ - c == '\r' || /* carriage return */ - c == '\n' || /* line feed */ - c == '\v' || /* vertical tab */ - c == '\f' || /* form feed */ - c == ' ' || /* blank space */ - c == (unsigned char)'\240'); /* non-breaking space */ - - return(result); -} - -/****************************************************************************/ - -STATIC BOOL -is_escape_character(unsigned char c) -{ - BOOL result; - - result = (BOOL)(c == '*' || c == __shell_escape_character); - - return(result); -} - -/****************************************************************************/ - -STATIC BOOL -is_final_quote_character(const unsigned char * str) -{ - BOOL result; - - result = (BOOL)(str[0] == '\"' && (str[1] == '\0' || is_space(str[1]))); - - return(result); -} - -/****************************************************************************/ - -ARG_CONSTRUCTOR(arg_init) -{ - BOOL success = FALSE; - - ENTER(); - - /* Shell startup? */ - if(__WBenchMsg == NULL) - { - size_t number_of_arguments; - unsigned char * arg_str; - size_t arg_len; - unsigned char * command_line; - unsigned char * str; - - /* Get the shell parameter string and find out - how long it is, stripping a trailing line - feed and blank spaces if necessary. */ - arg_str = GetArgStr(); - - while(is_space(*arg_str)) - arg_str++; - - arg_len = strlen(arg_str); - - while(arg_len > 0 && is_space(arg_str[arg_len - 1])) - arg_len--; - - /* Make a copy of the shell parameter string. */ - command_line = malloc(arg_len + 1); - if(command_line == NULL) - goto out; - - memmove(command_line,arg_str,arg_len); - command_line[arg_len] = '\0'; - - /* If we have a valid command line string and a command - name, proceed to set up the argument vector. */ - str = command_line; - - /* Count the number of arguments. */ - number_of_arguments = 1; - - while(TRUE) - { - /* Skip leading blank space. */ - while((*str) != '\0' && is_space(*str)) - str++; - - if((*str) == '\0') - break; - - number_of_arguments++; - - /* Quoted parameter starts here? */ - if((*str) == '\"') - { - str++; - - /* Skip the quoted string. */ - while((*str) != '\0' && NOT is_final_quote_character(str)) - { - /* Escape character? */ - if(is_escape_character(*str)) - { - str++; - - if((*str) != '\0') - str++; - } - else - { - str++; - } - } - - /* Skip the closing quote. */ - if((*str) != '\0') - str++; - } - else - { - /* Skip the parameter. */ - while((*str) != '\0' && NOT is_space(*str)) - str++; - - if((*str) == '\0') - break; - } - } - - /* Put all this together into an argument vector. - We allocate one extra slot to put a NULL pointer - into. */ - __argv = (char **)malloc((number_of_arguments + 1) * sizeof(*__argv)); - if(__argv == NULL) - goto out; - - /* The first parameter is the program name. */ - __argv[0] = __program_name; - - str = command_line; - - __argc = 1; - - while(TRUE) - { - /* Skip leading blank space. */ - while((*str) != '\0' && is_space(*str)) - str++; - - if((*str) == '\0') - break; - - /* Quoted parameter starts here? */ - if((*str) == '\"') - { - char * arg; - - #if defined(UNIX_PATH_SEMANTICS) - { - /* If necessary, indicate that this parameter was quoted. */ - if(__wildcard_quote_parameter(__argc) < 0) - goto out; - } - #endif /* UNIX_PATH_SEMANTICS */ - - str++; - - __argv[__argc++] = str; - - arg = str; - - /* Process the quoted string. */ - while((*str) != '\0' && NOT is_final_quote_character(str)) - { - if(is_escape_character(*str)) - { - str++; - - switch(*str) - { - /* "*e" == "\033" */ - case 'E': - case 'e': - - (*arg++) = '\033'; - break; - - /* "*n" == "\n" */ - case 'N': - case 'n': - - (*arg++) = '\n'; - break; - - case '\0': - - /* NOTE: the termination is handled down below. */ - break; - - default: - - (*arg++) = (*str); - break; - } - - if((*str) != '\0') - str++; - } - else - { - (*arg++) = (*str++); - } - } - - /* Skip the terminating quote. */ - if((*str) != '\0') - str++; - - /* Make sure that the quoted string is properly terminated. This - actually overwrites the final quote character. */ - (*arg) = '\0'; - } - else - { - __argv[__argc++] = str; - - while((*str) != '\0' && NOT is_space(*str)) - str++; - - if((*str) == '\0') - break; - - (*str++) = '\0'; - } - } - - assert( __argc == (int)number_of_arguments ); - assert( str <= &command_line[arg_len] ); - - __argv[__argc] = NULL; - - #if defined(UNIX_PATH_SEMANTICS) - { - /* If necessary, expand wildcard patterns found in the command - line string into file and directory names. */ - if(__wildcard_expand_init() < 0) - goto out; - } - #endif /* UNIX_PATH_SEMANTICS */ - } - else - { - /* Return a pointer to the startup message in place of the - the argument vector. The argument counter (what will come - out as 'argc' for the main() function) will remain 0. */ - __argv = (char **)__WBenchMsg; - } - - success = TRUE; - - out: - - SHOWVALUE(success); - LEAVE(); - - if(success) - CONSTRUCTOR_SUCCEED(); - else - CONSTRUCTOR_FAIL(); -} diff --git a/library/stdlib_assertion_failure.c b/library/stdlib_assertion_failure.c deleted file mode 100644 index 1c929aa..0000000 --- a/library/stdlib_assertion_failure.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * $Id: stdlib_assertion_failure.c,v 1.10 2005-03-19 11:06:57 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 PROTO_EXEC_H -#include -#endif /* PROTO_EXEC_H */ - -#define __NOLIBBASE__ -#define __NOGLOBALIFACE__ - -#ifndef PROTO_INTUITION_H -#include -#endif /* PROTO_INTUITION_H */ - -#ifndef PROTO_DOS_H -#include -#endif /* PROTO_DOS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -void -__assertion_failure( - const char * file_name, - int line_number, - const char * expression) -{ - static int been_here_before; - - /* Don't drop into a recursion. */ - if(been_here_before++ == 0) - { - if(__no_standard_io || __WBenchMsg != NULL) - { - #if defined(__amigaos4__) - struct IntuitionIFace * IIntuition = NULL; - #endif /* __amigaos4__ */ - - struct Library * IntuitionBase; - - IntuitionBase = OpenLibrary("intuition.library",37); - - #if defined(__amigaos4__) - { - if(IntuitionBase != NULL) - { - IIntuition = (struct IntuitionIFace *)GetInterface(IntuitionBase, "main", 1, 0); - if(IIntuition == NULL) - { - CloseLibrary(IntuitionBase); - IntuitionBase = NULL; - } - } - } - #endif /* __amigaos4__ */ - - if(IntuitionBase != NULL) - { - struct EasyStruct es; - - memset(&es,0,sizeof(es)); - - es.es_StructSize = sizeof(es); - es.es_Title = (STRPTR)__program_name; - es.es_TextFormat = (STRPTR)"Assertion of expression\n\"%s\"\nfailed in file \"%s\", line %ld."; - es.es_GadgetFormat = (STRPTR)"Sorry"; - - EasyRequest(NULL,&es,NULL, - expression,file_name,line_number); - - #if defined(__amigaos4__) - { - DropInterface((struct Interface *)IIntuition); - } - #endif /* __amigaos4__ */ - - CloseLibrary(IntuitionBase); - } - } - else - { - if(__num_iob > STDERR_FILENO) - { - if(__program_name != NULL) - fprintf(stderr,"[%s] ",__program_name); - - fprintf(stderr, - "%s:%d: failed assertion \"%s\".\n", - file_name, - line_number, - expression); - - abort(); - } - else - { - #if defined(__amigaos4__) - struct DOSIFace * IDOS = NULL; - #endif /* __amigaos4__ */ - - struct Library * DOSBase; - - DOSBase = OpenLibrary("dos.library",37); - - #if defined(__amigaos4__) - { - if(DOSBase != NULL) - { - IDOS = (struct DOSIFace *)GetInterface(DOSBase, "main", 1, 0); - if(IDOS == NULL) - { - CloseLibrary(DOSBase); - DOSBase = NULL; - } - } - } - #endif /* __amigaos4__ */ - - if(DOSBase != NULL) - { - BPTR output; - - /* Dump all currently unwritten data, especially to the console. */ - __flush_all_files(-1); - - #if defined(__amigaos4__) - { - /* Try to print the error message on the default error output stream. */ - output = ErrorOutput(); - } - #else - { - struct Process * this_process = (struct Process *)FindTask(NULL); - - output = this_process->pr_CES; - } - #endif /* __amigaos4__ */ - - if(output == ZERO) - output = Output(); - - if(output != ZERO) - { - if(__program_name != NULL) - FPrintf(output,"[%s] ",__program_name); - - FPrintf(output, - "%s:%ld: failed assertion \"%s\".\n", - file_name, - line_number, - expression); - } - - #if defined(__amigaos4__) - { - DropInterface((struct Interface *)IDOS); - } - #endif /* __amigaos4__ */ - - CloseLibrary(DOSBase); - } - - _exit(EXIT_FAILURE); - } - } - } - - been_here_before--; -} diff --git a/library/stdlib_atexit.c b/library/stdlib_atexit.c deleted file mode 100644 index dc2c4c7..0000000 --- a/library/stdlib_atexit.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * $Id: stdlib_atexit.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -struct ExitTrapNode -{ - struct MinNode etn_MinNode; - void (*etn_Function)(void); -}; - -/****************************************************************************/ - -/* 32 functions are the minimum required by ISO 'C'. */ -static struct ExitTrapNode exit_node_table[32]; -static struct MinList exit_trap_list; -static size_t num_exit_nodes_used; -static BOOL atexit_blocked; - -/****************************************************************************/ - -int -atexit(void (*function)(void)) -{ - struct ExitTrapNode * etn; - int result = ERROR; - - assert( function != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(function == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(atexit_blocked) - { - __set_errno(EACCES); - goto out; - } - - /* We always have room for 32 exit trap functions. */ - if(num_exit_nodes_used < NUM_ENTRIES(exit_node_table)) - { - etn = &exit_node_table[num_exit_nodes_used++]; - } - else - { - /* More than 32 exit trap functions are called - * for. Let's make room for another one. - */ - etn = malloc(sizeof(*etn)); - if(etn == NULL) - { - __set_errno(ENOMEM); - goto out; - } - } - - etn->etn_Function = function; - - if(exit_trap_list.mlh_Head == NULL) - NewList((struct List *)&exit_trap_list); - - AddHead((struct List *)&exit_trap_list,(struct Node *)etn); - - result = OK; - - out: - - return(result); -} - -/****************************************************************************/ - -void -__exit_trap_trigger(void) -{ - struct ExitTrapNode * etn; - - /* Disallow further additions to the atexit() list. */ - atexit_blocked = TRUE; - - /* Remove the trap entries one at a time and process them. - * Should one of the routines drop into exit(), processing - * will continue with the next entry until eventually all - * list items have been taken care of. - */ - if(exit_trap_list.mlh_Head != NULL) - { - while((etn = (struct ExitTrapNode *)RemHead((struct List *)&exit_trap_list)) != NULL) - (*etn->etn_Function)(); - } -} diff --git a/library/stdlib_atof.c b/library/stdlib_atof.c deleted file mode 100644 index bd3bb89..0000000 --- a/library/stdlib_atof.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * $Id: stdlib_atof.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -atof(const char *str) -{ - double result = 0.0; - - assert( str != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(str == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = strtod(str,NULL); - - out: - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/stdlib_atoi.c b/library/stdlib_atoi.c deleted file mode 100644 index 8690aea..0000000 --- a/library/stdlib_atoi.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * $Id: stdlib_atoi.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -int -atoi(const char *str) -{ - int result = 0; - - assert( str != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(str == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = (int)strtol(str, (char **)NULL, 10); - - out: - - return(result); -} diff --git a/library/stdlib_atol.c b/library/stdlib_atol.c deleted file mode 100644 index 9d74d6c..0000000 --- a/library/stdlib_atol.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * $Id: stdlib_atol.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -long -atol(const char *str) -{ - long result = 0; - - assert( str != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(str == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = strtol(str, (char **)NULL, 10); - - out: - - return(result); -} diff --git a/library/stdlib_atoll.c b/library/stdlib_atoll.c deleted file mode 100644 index 4489c1b..0000000 --- a/library/stdlib_atoll.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * $Id: stdlib_atoll.c,v 1.1 2005-03-02 12:57:53 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#if defined(USE_64_BIT_INTS) - -/****************************************************************************/ - -long long -atoll(const char *str) -{ - long long result = 0; - - assert( str != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(str == NULL) - { - errno = EFAULT; - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = strtoll(str, (char **)NULL, 10); - - out: - - return(result); -} - -/****************************************************************************/ - -#endif /* USE_64_BIT_INTS */ diff --git a/library/stdlib_bsearch.c b/library/stdlib_bsearch.c deleted file mode 100644 index 71774cb..0000000 --- a/library/stdlib_bsearch.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * $Id: stdlib_bsearch.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -void * -bsearch(const void *key, const void *base, size_t count, size_t size, int (*compare)(const void * key,const void * value)) -{ - void * result = NULL; - - ENTER(); - - SHOWPOINTER(key); - SHOWPOINTER(base); - SHOWVALUE(count); - SHOWVALUE(size); - SHOWPOINTER(compare); - - if(count > 0 && size > 0) - { - void * current; - size_t lower = 0; - size_t upper = count; - size_t position; - int delta; - - assert( key != NULL && base != NULL && compare != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(key == NULL || base == NULL || compare == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - while(lower < upper) - { - position = (lower + upper) / 2; - - current = (void *)(((ULONG)base) + (position * size)); - - delta = (*compare)(key, current); - if(delta == 0) - { - result = current; - break; - } - - if(delta < 0) - upper = position; - else - lower = position + 1; - } - } - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdlib_calloc.c b/library/stdlib_calloc.c deleted file mode 100644 index 706ba3a..0000000 --- a/library/stdlib_calloc.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * $Id: stdlib_calloc.c,v 1.5 2005-03-18 12:38:23 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#undef calloc - -/****************************************************************************/ - -__static void * -__calloc(size_t num_elements,size_t element_size,const char * file,int line) -{ - void * result = NULL; - - #ifdef __MEM_DEBUG - { - /*__check_memory_allocations(file,line);*/ - } - #endif /* __MEM_DEBUG */ - - assert( (int)num_elements >= 0 && (int)element_size >= 0 ); - - if(num_elements > 0 && element_size > 0) - { - size_t total_size; - - total_size = num_elements * element_size; - - result = __malloc(total_size,file,line); - if(result != NULL) - memset(result,0,total_size); - else - SHOWMSG("memory allocation failure"); - } - else - { - SHOWMSG("zero length allocation"); - } - - return(result); -} - -/****************************************************************************/ - -void * -calloc(size_t num_elements,size_t element_size) -{ - void * result; - - result = __calloc(num_elements,element_size,NULL,0); - - return(result); -} diff --git a/library/stdlib_checkdetach.c b/library/stdlib_checkdetach.c deleted file mode 100644 index 1f03840..0000000 --- a/library/stdlib_checkdetach.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: stdlib_checkdetach.c,v 1.3 2005-03-18 12:38:23 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 EXEC_TYPES_H -#include -#endif /* EXEC_TYPES_H */ - -/****************************************************************************/ - -BOOL (* __check_detach)(void); diff --git a/library/stdlib_constructor.c b/library/stdlib_constructor.c deleted file mode 100644 index c93b9c2..0000000 --- a/library/stdlib_constructor.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id: stdlib_constructor.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__) - -/****************************************************************************/ - -typedef void (*func_ptr)(void); - -/****************************************************************************/ - -func_ptr __CTOR_LIST__[] = { (func_ptr)0 }; - -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_constructor.h b/library/stdlib_constructor.h deleted file mode 100644 index 62e02a2..0000000 --- a/library/stdlib_constructor.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * $Id: stdlib_constructor.h,v 1.2 2005-03-20 11:18:06 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_CONSTRUCTOR_H -#define _STDLIB_CONSTRUCTOR_H - -/****************************************************************************/ - -/* Constructor and destructor functions, as used by the library for data - initialization and cleanup. These particular functions are invoked by - the startup code before and after the main() function is/was called. - How this works is very compiler specific. We support three flavours - below. */ - -/****************************************************************************/ - -#ifdef __SASC - -#define CONSTRUCTOR(name,pri) \ - int __stdargs _STI_##pri##_##name(void); \ - int __stdargs _STI_##pri##_##name(void) - -#define DESTRUCTOR(name,pri) \ - void __stdargs _STD_##pri##_##name(void); \ - void __stdargs _STD_##pri##_##name(void) - -#define CONSTRUCTOR_SUCCEED() \ - return(0) - -#define CONSTRUCTOR_FAIL() \ - return(1) - -#endif /* __SASC */ - -/****************************************************************************/ - -#ifdef __GNUC__ - -#if defined(__amigaos4__) - -#define CONSTRUCTOR(name,pri) \ - STATIC VOID __attribute__((used)) name##_ctor(VOID); \ - STATIC VOID (*__##name##_ctor)(VOID) __attribute__((used,section(".ctors._" #pri))) = name##_ctor; \ - STATIC VOID name##_ctor(VOID) - -#define DESTRUCTOR(name,pri) \ - STATIC VOID __attribute__((used)) name##_dtor(VOID); \ - STATIC VOID (*__##name##_dtor)(VOID) __attribute__((used,section(".dtors._" #pri))) = name##_dtor; \ - STATIC VOID name##_dtor(VOID) - -#else - -#define CONSTRUCTOR(name,pri) \ - asm(".stabs \"___INIT_LIST__\",22,0,0,___ctor_" #name); \ - asm(".stabs \"___INIT_LIST__\",20,0,0," #pri); \ - VOID __ctor_##name##(VOID); \ - VOID __ctor_##name##(VOID) - -#define DESTRUCTOR(name,pri) \ - asm(".stabs \"___EXIT_LIST__\",22,0,0,___dtor_" #name); \ - asm(".stabs \"___EXIT_LIST__\",20,0,0," #pri); \ - VOID __dtor_##name##(VOID); \ - VOID __dtor_##name##(VOID) - -#endif /* __amigaos4__ */ - -#define CONSTRUCTOR_SUCCEED() \ - return - -#define CONSTRUCTOR_FAIL() \ - exit(RETURN_FAIL) - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -/* These macros are for declaring functions to serve as constructors or - destructors. In which order these should be invoked is defined by the - priority, which is a number in the range 0-999. User-supplied - constructor/destructor functions should have priority 0. That way, - the user-supplied constructors will be invoked after the library - constructors and the user-supplied destructors before the library - destructors. */ - -#define STDLIB_CONSTRUCTOR(name) CONSTRUCTOR(name, 9) -#define STDLIB_DESTRUCTOR(name) DESTRUCTOR(name, 9) - -#define STK_CONSTRUCTOR(name) CONSTRUCTOR(name, 8) -#define STK_DESTRUCTOR(name) DESTRUCTOR(name, 8) - -#define STDIO_CONSTRUCTOR(name) CONSTRUCTOR(name, 7) -#define STDIO_DESTRUCTOR(name) DESTRUCTOR(name, 7) - -#define FILE_CONSTRUCTOR(name) CONSTRUCTOR(name, 6) -#define FILE_DESTRUCTOR(name) DESTRUCTOR(name, 6) - -#define MATH_CONSTRUCTOR(name) CONSTRUCTOR(name, 5) -#define MATH_DESTRUCTOR(name) DESTRUCTOR(name, 5) - -#define SOCKET_CONSTRUCTOR(name) CONSTRUCTOR(name, 4) -#define SOCKET_DESTRUCTOR(name) DESTRUCTOR(name, 4) - -#define ARG_CONSTRUCTOR(name) CONSTRUCTOR(name, 3) -#define ARG_DESTRUCTOR(name) DESTRUCTOR(name, 3) - -#define CLIB_CONSTRUCTOR(name) CONSTRUCTOR(name, 2) -#define CLIB_DESTRUCTOR(name) DESTRUCTOR(name, 2) - -#define PROFILE_CONSTRUCTOR(name) CONSTRUCTOR(name, 1) -#define PROFILE_DESTRUCTOR(name) DESTRUCTOR(name, 1) - -/****************************************************************************/ - -#endif /* _STDLIB_CONSTRUCTOR_H */ diff --git a/library/stdlib_constructor_begin.c b/library/stdlib_constructor_begin.c deleted file mode 100644 index a63e60c..0000000 --- a/library/stdlib_constructor_begin.c +++ /dev/null @@ -1,344 +0,0 @@ -/* - * $Id: stdlib_constructor_begin.c,v 1.10 2005-03-25 08:50:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -#if defined(__SASC) - -/****************************************************************************/ - -extern int (* __far __ctors[])(void); -extern void (* __far __dtors[])(void); - -/****************************************************************************/ - -/* With SAS/C this function is placed in front of the first constructor - table entry. It will invoke all following constructors and - finally all the destructors. We don't use this approach here and - we can't because the naming scheme we use for the constructor and - destructor functions differs from the default SAS/C usage. With - SAS/C the default behaviour is to invoke the constructors in - ascending order of priority. We invoke them in descending order of - priority (highest first). */ -void -__construct(void) -{ -} - -/****************************************************************************/ - -void -_init(void) -{ - void * volatile p = &__ctors; - - /* The address is NULL if no constructor functions are to be used. */ - if(p != NULL) - { - int num_constructors; - int i; - - /* Count the number of constructors we have to deal with. */ - num_constructors = 0; - - while(__ctors[num_constructors] != NULL) - num_constructors++; - - for(i = 0 ; i < num_constructors ; i++) - { - if((*__ctors[num_constructors - (i + 1)])() != 0) - exit(RETURN_FAIL); - } - } -} - -/****************************************************************************/ - -void -_fini(void) -{ - void * volatile p = &__dtors; - - /* The address is NULL if no destructor functions are to be used. */ - if(p != NULL) - { - static int i; - - int num_destructors; - - /* Count the number of destructors we have to deal with. */ - num_destructors = 0; - - while(__dtors[num_destructors] != NULL) - num_destructors++; - - while(i < num_destructors) - { - /* Increment this before jumping in, so that the next - invocation will always pick up the destructor following - the one we will invoke rigt now. */ - i++; - - (*__dtors[num_destructors - i])(); - } - } -} - -/****************************************************************************/ - -#endif /* __SASC */ - -/****************************************************************************/ - -#if defined(__GNUC__) && !defined(__amigaos4__) - -/****************************************************************************/ - -/* The GCC 68k port does not sort constructor/destructor functions. We - have to sort them here all on our own before they can be used. */ - -/****************************************************************************/ - -typedef void (*func_ptr)(void); - -/****************************************************************************/ - -struct private_function -{ - func_ptr function; - int priority; -}; - -/****************************************************************************/ - -extern func_ptr __INIT_LIST__[]; -extern func_ptr __EXIT_LIST__[]; - -/****************************************************************************/ - -extern func_ptr __CTOR_LIST__[]; -extern func_ptr __DTOR_LIST__[]; - -/****************************************************************************/ - -/* Sort the private function table in ascending order by priority. This is - a simple bubblesort algorithm which assumes that there will be at least - two entries in the table worth sorting. */ -static void -sort_private_functions(struct private_function * base, size_t count) -{ - struct private_function * a; - struct private_function * b; - size_t i,j; - - i = count - 2; - - do - { - a = base; - - for(j = 0 ; j <= i ; j++) - { - b = a + 1; - - if(a->priority > b->priority) - { - struct private_function t; - - t = (*a); - (*a) = (*b); - (*b) = t; - } - - a = b; - } - } - while(i-- > 0); -} - -/****************************************************************************/ - -/* Sort all the init and exit functions (private library constructors), then - invoke the init functions in descending order. */ -static void -call_init_functions(void) -{ - LONG num_init_functions = (LONG)(__INIT_LIST__[0]) / 2; - LONG num_exit_functions = (LONG)(__EXIT_LIST__[0]) / 2; - - ENTER(); - - SHOWVALUE(num_init_functions); - - if(num_init_functions > 1) - sort_private_functions((struct private_function *)&__INIT_LIST__[1],num_init_functions); - - SHOWVALUE(num_exit_functions); - - if(num_exit_functions > 1) - sort_private_functions((struct private_function *)&__EXIT_LIST__[1],num_exit_functions); - - if(num_init_functions > 0) - { - struct private_function * t = (struct private_function *)&__INIT_LIST__[1]; - LONG i,j; - - for(j = 0 ; j < num_init_functions ; j++) - { - i = num_init_functions - (j + 1); - - D(("calling init function #%ld, 0x%08lx",i,t[i].function)); - - (*t[i].function)(); - } - } - - LEAVE(); -} - -/****************************************************************************/ - -/* Call all exit functions in ascending order; this assumes that the function - table was prepared by call_init_functions() above. */ -static void -call_exit_functions(void) -{ - LONG num_exit_functions = (LONG)(__EXIT_LIST__[0]) / 2; - - ENTER(); - - if(num_exit_functions > 0) - { - STATIC LONG j = 0; - - struct private_function * t = (struct private_function *)&__EXIT_LIST__[1]; - LONG i; - - while(j++ < num_exit_functions) - { - i = j - 1; - - D(("calling exit function #%ld, 0x%08lx",i,t[i].function)); - - (*t[i].function)(); - } - } - - LEAVE(); -} - -/****************************************************************************/ - -static void -call_constructors(void) -{ - ULONG num_ctors = (ULONG)__CTOR_LIST__[0]; - ULONG i; - - ENTER(); - - D(("there are %ld constructors to be called",num_ctors)); - - /* Call all constructors in reverse order */ - for(i = 0 ; i < num_ctors ; i++) - { - D(("calling constructor #%ld, 0x%08lx",i,__CTOR_LIST__[1+i])); - - __CTOR_LIST__[num_ctors - i](); - } - - LEAVE(); -} - -/****************************************************************************/ - -static void -call_destructors(void) -{ - ULONG num_dtors = (ULONG)__DTOR_LIST__[0]; - static ULONG i; - - ENTER(); - - D(("there are %ld destructors to be called",num_dtors)); - - /* Call all destructors in forward order */ - while(i++ < num_dtors) - { - D(("calling destructor #%ld, 0x%08lx",i,__DTOR_LIST__[i])); - - __DTOR_LIST__[i](); - } - - SHOWMSG("all done."); - - LEAVE(); -} - -/****************************************************************************/ - -void -_init(void) -{ - ENTER(); - - call_init_functions(); - call_constructors(); - - LEAVE(); -} - -/****************************************************************************/ - -void -_fini(void) -{ - ENTER(); - - call_destructors(); - call_exit_functions(); - - LEAVE(); -} - -/****************************************************************************/ - -#endif /* __GNUC__ && !__amigaos4__ */ diff --git a/library/stdlib_default_pool_size.c b/library/stdlib_default_pool_size.c deleted file mode 100644 index 7893cf9..0000000 --- a/library/stdlib_default_pool_size.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: stdlib_default_pool_size.c,v 1.3 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -int NOCOMMON __default_pool_size = 4096; diff --git a/library/stdlib_default_puddle_size.c b/library/stdlib_default_puddle_size.c deleted file mode 100644 index f05d4a3..0000000 --- a/library/stdlib_default_puddle_size.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: stdlib_default_puddle_size.c,v 1.3 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -int NOCOMMON __default_puddle_size = 4096; diff --git a/library/stdlib_destructor.c b/library/stdlib_destructor.c deleted file mode 100644 index 663557d..0000000 --- a/library/stdlib_destructor.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id: stdlib_destructor.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__) - -/****************************************************************************/ - -typedef void (*func_ptr)(void); - -/****************************************************************************/ - -func_ptr __DTOR_LIST__[] = { (func_ptr)0 }; - -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_detach.c b/library/stdlib_detach.c deleted file mode 100644 index b820639..0000000 --- a/library/stdlib_detach.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: stdlib_detach.c,v 1.3 2005-03-18 12:38:23 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 EXEC_TYPES_H -#include -#endif /* EXEC_TYPES_H */ - -/****************************************************************************/ - -BOOL __detach; diff --git a/library/stdlib_disablerequesters.c b/library/stdlib_disablerequesters.c deleted file mode 100644 index c642a4d..0000000 --- a/library/stdlib_disablerequesters.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: stdlib_disablerequesters.c,v 1.3 2005-03-18 12:38:24 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 EXEC_TYPES_H -#include -#endif /* EXEC_TYPES_H */ - -/****************************************************************************/ - -BOOL __disable_dos_requesters; diff --git a/library/stdlib_div.c b/library/stdlib_div.c deleted file mode 100644 index fa23a85..0000000 --- a/library/stdlib_div.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id: stdlib_div.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -div_t -div(int n,int d) -{ - div_t result; - - assert( d != 0 ); - - result.quot = n / d; - result.rem = n % d; - - return(result); -} diff --git a/library/stdlib_divmodsi3.c b/library/stdlib_divmodsi3.c deleted file mode 100644 index 25cec69..0000000 --- a/library/stdlib_divmodsi3.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * $Id: stdlib_divmodsi3.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl ___modsi3 - -| D1.L = D0.L % D1.L signed - -___modsi3: - - moveml sp@(4:W),d0/d1 - jbsr ___divsi4 - movel d1,d0 - rts - - .globl ___divsi3 - .globl ___UtilityBase - -| D0.L = D0.L / D1.L signed - -___divsi3: - moveml sp@(4:W),d0/d1 -___divsi4: - movel "A4(___UtilityBase)",a0 - jmp a0@(-150:W) - -"); - -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_divsi3.c b/library/stdlib_divsi3.c deleted file mode 100644 index 37a943f..0000000 --- a/library/stdlib_divsi3.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * $Id: stdlib_divsi3.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__) - -/****************************************************************************/ -#ifndef __PPC__ -asm(" \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl ___divsi3 \n\ - .globl ___udivsi4 \n\ - \n\ -| D0.L = D0.L / D1.L signed \n\ - \n\ -___divsi3: \n\ - \n\ - moveml sp@(4:W),d0/d1 \n\ - jbra ___divsi4 \n\ - \n\ -"); -#else -__asm (" \n\ - .text \n\ - .align 2 \n\ - \n\ - .globl __divsi3 \n\ - \n\ -__divsi3: \n\ - divw r3, r3, r4 \n\ - blr \n\ -"); -#endif - -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_divsi4.c b/library/stdlib_divsi4.c deleted file mode 100644 index 717b27c..0000000 --- a/library/stdlib_divsi4.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $Id: stdlib_divsi4.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ -#ifndef __PPC__ -asm(" \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl ___divsi4 \n\ - .globl ___UtilityBase \n\ - \n\ -___divsi4: \n\ - \n\ - movel "A4(___UtilityBase)",a0 \n\ - jmp a0@(-150:W) \n\ - \n\ -"); -#else -__asm(" \n\ - .text \n\ - .align 2 \n\ - \n\ - .globl __divsi4 \n\ - \n\ -__divis4: \n\ - divw r3, r3, r4 \n\ - blr \n\ -"); - -#endif -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_dosbase.c b/library/stdlib_dosbase.c deleted file mode 100644 index fafca28..0000000 --- a/library/stdlib_dosbase.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * $Id: stdlib_dosbase.c,v 1.3 2005-03-18 12:38:24 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 __NOLIBBASE__ - -#ifndef PROTO_DOS_H -#include -#endif /* PROTO_DOS_H */ - -/****************************************************************************/ - -struct Library * DOSBase; - -/****************************************************************************/ - -#if defined(__amigaos4__) - -struct DOSIFace * IDOS; - -#endif /* __amigaos4__ */ diff --git a/library/stdlib_exit.c b/library/stdlib_exit.c deleted file mode 100644 index b0dd521..0000000 --- a/library/stdlib_exit.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * $Id: stdlib_exit.c,v 1.5 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -jmp_buf NOCOMMON __exit_jmp_buf; -int NOCOMMON __exit_value = RETURN_FAIL; -BOOL NOCOMMON __exit_blocked; - -/****************************************************************************/ - -void -_exit(int return_code) -{ - if(NOT __exit_blocked) - { - __exit_value = return_code; - - longjmp(__exit_jmp_buf,1); - } -} - -/****************************************************************************/ - -/* The C99 version of _exit(). */ -void -_Exit(int return_code) -{ - if(NOT __exit_blocked) - _exit(return_code); -} - -/****************************************************************************/ - -void -exit(int return_code) -{ - if(NOT __exit_blocked) - { - __exit_trap_trigger(); - - _exit(return_code); - } -} diff --git a/library/stdlib_free.c b/library/stdlib_free.c deleted file mode 100644 index 675262b..0000000 --- a/library/stdlib_free.c +++ /dev/null @@ -1,524 +0,0 @@ -/* - * $Id: stdlib_free.c,v 1.10 2005-03-20 11:18:06 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#undef free -#undef __free - -/****************************************************************************/ - -#ifdef __MEM_DEBUG - -/****************************************************************************/ - -STATIC char -get_hex_char(int n) -{ - char result; - - if(0 <= n && n <= 9) - result = n + '0'; - else - result = n + 'A' - 10; - - return(result); -} - -STATIC VOID -int_to_hex(unsigned long v,char * buffer,int min_digits) -{ - int i,j,c; - - i = 0; - - do - { - c = (v % 16); - v = v / 16; - - buffer[i++] = get_hex_char(c); - } - while(v > 0); - - while(i < min_digits) - buffer[i++] = '0'; - - for(j = 0 ; j < i / 2 ; j++) - { - c = buffer[i - 1 - j]; - buffer[i - 1 - j] = buffer[j]; - buffer[j] = c; - } - - buffer[i] = '\0'; -} - -STATIC VOID -dump_memory(unsigned char * m,int size,int ignore) -{ - const int mod = 20; - int position,i,c; - char buffer[120]; - char hex[10]; - - buffer[0] = '\0'; - - for(i = 0 ; i < size ; i++) - { - position = i % mod; - if(position == 0) - { - if(buffer[0] != '\0') - { - int len = sizeof(buffer)-1; - - while(len > 0 && buffer[len-1] == ' ') - len--; - - buffer[len] = '\0'; - - kprintf("[%s] %s\n",__program_name,buffer); - } - - memset(buffer,' ',sizeof(buffer)-1); - - int_to_hex((unsigned long)&m[i],hex,8); - - memmove(buffer,hex,8); - hex[9] = ':'; - } - - if(m[i] != ignore) - { - buffer[10 + 2 * position + 0] = get_hex_char(m[i] >> 4); - buffer[10 + 2 * position + 1] = get_hex_char(m[i] & 15); - - c = m[i]; - if(c < ' ' || (c >= 127 && c <= 160)) - c = '.'; - - buffer[10 + 2 * mod + 1 + position] = c; - } - else - { - buffer[10 + 2 * position + 0] = '_'; - buffer[10 + 2 * position + 1] = '_'; - } - } - - if(buffer[0] != '\0') - { - int len = sizeof(buffer)-1; - - while(len > 0 && buffer[len-1] == ' ') - len--; - - buffer[len] = '\0'; - - kprintf("[%s] %s\n",__program_name,buffer); - } -} - -/****************************************************************************/ - -STATIC VOID -check_memory_node(struct MemoryNode * mn,const char * file,int line) -{ - size_t size = mn->mn_Size; - unsigned char * head = (unsigned char *)(mn + 1); - unsigned char * body = head + MALLOC_HEAD_SIZE; - unsigned char * tail = body + size; - int max_head_damage = 0; - int max_tail_damage = 0; - int max_body_damage = 0; - int i; - - for(i = 1 ; i <= MALLOC_HEAD_SIZE ; i++) - { - if(head[MALLOC_HEAD_SIZE - i] != MALLOC_HEAD_FILL) - max_head_damage = i; - } - - if(max_head_damage > 0) - { - kprintf("[%s] ",__program_name); - - if(file != NULL) - kprintf("%s:%ld:",file,line); - - kprintf("At least %ld bytes were damaged in front of allocation 0x%08lx..0x%08lx, size = %ld", - max_head_damage, - body,body + size - 1,size); - - if(mn->mn_File != NULL) - kprintf(", allocated at %s:%ld",mn->mn_File,mn->mn_Line); - - kprintf("\n"); - - dump_memory(head,MALLOC_HEAD_SIZE,MALLOC_HEAD_FILL); - } - - for(i = 0 ; i < MALLOC_TAIL_SIZE ; i++) - { - if(tail[i] != MALLOC_TAIL_FILL) - max_tail_damage = i+1; - } - - if(max_tail_damage > 0) - { - kprintf("[%s] ",__program_name); - - if(file != NULL) - kprintf("%s:%ld:",file,line); - - kprintf("At least %ld bytes were damaged behind allocation 0x%08lx..0x%08lx, size = %ld (with damage = %ld)", - max_tail_damage, - body,body + size - 1, - size,size+max_tail_damage); - - if(mn->mn_File != NULL) - kprintf(", allocated at %s:%ld",mn->mn_File,mn->mn_Line); - - kprintf("\n"); - - dump_memory(tail,MALLOC_TAIL_SIZE,MALLOC_TAIL_FILL); - } - - if(mn->mn_AlreadyFree) - { - for(i = 0 ; i < size ; i++) - { - if(body[i] != MALLOC_FREE_FILL) - max_body_damage = i+1; - } - - if(max_body_damage > 0) - { - kprintf("[%s] ",__program_name); - - if(file != NULL) - kprintf("%s:%ld:",file,line); - - kprintf("At least %ld bytes were damaged in freed allocation 0x%08lx..0x%08lx, size = %ld", - max_body_damage, - body,body + size - 1,size); - - if(mn->mn_File != NULL) - kprintf(", allocated at %s:%ld",mn->mn_File,mn->mn_Line); - - kprintf("\n"); - - dump_memory(body,size,MALLOC_FREE_FILL); - } - } -} - -/****************************************************************************/ - -void -__check_memory_allocations(const char * file,int line) -{ - struct MemoryNode * mn; - - __memory_lock(); - - for(mn = (struct MemoryNode *)__memory_list.mlh_Head ; - mn->mn_MinNode.mln_Succ != NULL ; - mn = (struct MemoryNode *)mn->mn_MinNode.mln_Succ) - { - check_memory_node(mn,file,line); - } - - __memory_unlock(); -} - -/****************************************************************************/ - -struct MemoryNode * -__find_memory_node(void * address) -{ - struct MemoryNode * result; - - assert( address != NULL ); - - __memory_lock(); - - #if defined(__USE_MEM_TREES) - { - result = __red_black_tree_find(&__memory_tree,address); - } - #else - { - struct MemoryNode * mn; - - result = NULL; - - for(mn = (struct MemoryNode *)__memory_list.mlh_Head ; - mn->mn_MinNode.mln_Succ != NULL ; - mn = (struct MemoryNode *)mn->mn_MinNode.mln_Succ) - { - if(address == mn->mn_Allocation) - { - result = mn; - break; - } - } - } - #endif /* __USE_MEM_TREES */ - - __memory_unlock(); - - return(result); -} - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -struct MemoryNode * -__find_memory_node(void * address) -{ - struct MemoryNode * result; - - assert( address != NULL ); - - result = &((struct MemoryNode *)address)[-1]; - - return(result); -} - -/****************************************************************************/ - -#endif /* __MEM_DEBUG */ - -/****************************************************************************/ - -STATIC VOID -remove_and_free_memory_node(struct MemoryNode * mn) -{ - size_t allocation_size; - - assert( mn != NULL ); - - __memory_lock(); - - Remove((struct Node *)mn); - - #if defined(__USE_MEM_TREES) && defined(__MEM_DEBUG) - { - __red_black_tree_remove(&__memory_tree,mn); - } - #endif /* __USE_MEM_TREES && __MEM_DEBUG */ - - #ifdef __MEM_DEBUG - { - allocation_size = sizeof(*mn) + MALLOC_HEAD_SIZE + mn->mn_Size + MALLOC_TAIL_SIZE; - - assert( allocation_size == mn->mn_AllocationSize ); - - memset(mn,MALLOC_FREE_FILL,allocation_size); - } - #else - { - allocation_size = sizeof(*mn) + mn->mn_Size; - } - #endif /* __MEM_DEBUG */ - - if(__memory_pool != NULL) - FreePooled(__memory_pool,mn,allocation_size); - else - FreeMem(mn,allocation_size); - - __memory_unlock(); -} - -/****************************************************************************/ - -void -__free_memory_node(struct MemoryNode * mn,const char * UNUSED file,int UNUSED line) -{ - assert(mn != NULL); - - #ifdef __MEM_DEBUG - { - size_t size = mn->mn_Size; - - check_memory_node(mn,file,line); - - if(NOT mn->mn_AlreadyFree) - { - #ifdef __MEM_DEBUG_LOG - { - kprintf("[%s] - %10ld 0x%08lx [",__program_name,mn->mn_Size,mn->mn_Allocation); - - if(mn->mn_File != NULL) - kprintf("allocated at %s:%ld, ",mn->mn_File,mn->mn_Line); - - kprintf("freed at %s:%ld]\n",file,line); - } - #endif /* __MEM_DEBUG_LOG */ - - if(__never_free) - { - mn->mn_AlreadyFree = TRUE; - - mn->mn_FreeFile = (char *)file; - mn->mn_FreeLine = line; - - memset(mn->mn_Allocation,MALLOC_FREE_FILL,size); - } - else - { - __current_memory_allocated -= size; - __current_num_memory_chunks_allocated--; - - remove_and_free_memory_node(mn); - } - } - else - { - #ifdef __MEM_DEBUG_LOG - { - kprintf("[%s] - %10ld 0x%08lx [",__program_name,mn->mn_Size,mn->mn_Allocation); - - kprintf("FAILED]\n"); - } - #endif /* __MEM_DEBUG_LOG */ - - kprintf("[%s] %s:%ld:Allocation at address 0x%08lx, size %ld", - __program_name,file,line,mn->mn_Allocation,mn->mn_Size); - - if(mn->mn_File != NULL) - kprintf(", allocated at %s:%ld",mn->mn_File,mn->mn_Line); - - kprintf(", has already been freed at %s:%ld.\n",mn->mn_FreeFile,mn->mn_FreeLine); - } - } - #else - { - remove_and_free_memory_node(mn); - } - #endif /* __MEM_DEBUG */ -} - -/****************************************************************************/ - -STATIC VOID -free_memory(void * ptr,BOOL force,const char * file,int line) -{ - struct MemoryNode * mn; - - assert(ptr != NULL); - - /* Try to get rid of now unused memory. */ - /*__alloca_cleanup(file,line);*/ - - #ifdef __MEM_DEBUG - { - /*if((rand() % 16) == 0) - __check_memory_allocations(file,line);*/ - } - #endif /* __MEM_DEBUG */ - - mn = __find_memory_node(ptr); - - #ifdef __MEM_DEBUG - { - if(mn != NULL) - { - if(force || (NOT mn->mn_NeverFree)) - __free_memory_node(mn,file,line); - } - else - { - #ifdef __MEM_DEBUG_LOG - { - kprintf("[%s] - %10ld 0x%08lx [",__program_name,0,ptr); - - kprintf("FAILED]\n"); - } - #endif /* __MEM_DEBUG_LOG */ - - kprintf("[%s] %s:%ld:Address for free(0x%08lx) not known.\n",__program_name,file,line,ptr); - - D(("memory allocation at 0x%08lx could not be freed",ptr)); - } - } - #else - { - assert( mn != NULL ); - - if(mn != NULL && (force || (NOT mn->mn_NeverFree))) - __free_memory_node(mn,file,line); - } - #endif /* __MEM_DEBUG */ -} - -/****************************************************************************/ - -void -__force_free(void * ptr,const char * file,int line) -{ - if(ptr != NULL) - free_memory(ptr,TRUE,file,line); -} - -/****************************************************************************/ - -__static void -__free(void * ptr,const char * file,int line) -{ - if(ptr != NULL) - free_memory(ptr,FALSE,file,line); -} - -/****************************************************************************/ - -void -free(void * ptr) -{ - __free(ptr,NULL,0); -} diff --git a/library/stdlib_gcc_help.h b/library/stdlib_gcc_help.h deleted file mode 100644 index 8f13ad0..0000000 --- a/library/stdlib_gcc_help.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * $Id: stdlib_gcc_help.h,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_GCC_HELP_H -#define _STDLIB_GCC_HELP_H - -/****************************************************************************/ - -/* - * Uncomment this to build a library which contains code that helps - * GCC to build itself. This has two effects: the shell escape character - * "\" is enabled and the default stack size is raised to 200000 bytes - * with an additional helper function included which can be used to override - * the default stack size. - */ -/*#define GCC_HELP_SUPPORT*/ - -/****************************************************************************/ - -#endif /* _STDLIB_GCC_HELP_H */ diff --git a/library/stdlib_get_errno.c b/library/stdlib_get_errno.c deleted file mode 100644 index 2d7b2c0..0000000 --- a/library/stdlib_get_errno.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: stdlib_get_errno.c,v 1.1 2005-02-03 16:56:16 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -int -__get_errno(void) -{ - return(errno); -} diff --git a/library/stdlib_getdefstacksize.c b/library/stdlib_getdefstacksize.c deleted file mode 100644 index aac9e74..0000000 --- a/library/stdlib_getdefstacksize.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * $Id: stdlib_getdefstacksize.c,v 1.3 2005-04-24 14:04:36 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_GCC_HELP_H -#include "stdlib_gcc_help.h" -#endif /* _STDLIB_GCC_HELP_H */ - -/****************************************************************************/ - -#ifndef GCC_HELP_SUPPORT - -unsigned int (* __get_default_stack_size)(void); - -#endif /* GCC_HELP_SUPPORT */ diff --git a/library/stdlib_getenv.c b/library/stdlib_getenv.c deleted file mode 100644 index e4b5809..0000000 --- a/library/stdlib_getenv.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * $Id: stdlib_getenv.c,v 1.4 2005-02-28 10:07:31 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -char * -getenv(const char * name) -{ - static char env_var_buffer[FILENAME_MAX]; - char * result = NULL; - - ENTER(); - - SHOWSTRING(name); - - assert( name != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name == NULL) - { - SHOWMSG("invalid name parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(GetVar((STRPTR)name,env_var_buffer,sizeof(env_var_buffer),0) < 0) - { - SHOWMSG("couldn't get the variable"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - result = env_var_buffer; - - SHOWSTRING(result); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdlib_getsp.asm b/library/stdlib_getsp.asm deleted file mode 100644 index 10ac358..0000000 --- a/library/stdlib_getsp.asm +++ /dev/null @@ -1,45 +0,0 @@ -* -* $Id: stdlib_getsp.asm,v 1.2 2005-01-02 09:07:18 obarthel Exp $ -* -* :ts=8 -* -* Portable ISO 'C' (1994) runtime library for the Amiga computer -* Copyright (c) 2002-2005 by Olaf Barthel -* 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 - - xdef ___get_sp - -___get_sp: - - move.l sp,d0 - addq.l #4,d0 - - rts - - end diff --git a/library/stdlib_getsp.c b/library/stdlib_getsp.c deleted file mode 100644 index 032bf5c..0000000 --- a/library/stdlib_getsp.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * $Id: stdlib_getsp.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#ifndef __PPC__ - -/****************************************************************************/ - -asm(" \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl ___get_sp \n\ - \n\ -___get_sp: \n\ - movel sp,d0 \n\ - addql #4,d0 \n\ - rts \n\ - \n\ -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -__asm(" \n\ - \n\ - .text \n\ - .align 2 \n\ - \n\ - .globl __get_sp \n\ - \n\ -__get_sp: \n\ - \n\ - mr r3, r1 \n\ - blr \n\ - \n\ -"); - -/****************************************************************************/ - -#endif /* __PPC__ */ - -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_headers.h b/library/stdlib_headers.h deleted file mode 100644 index 17e5c97..0000000 --- a/library/stdlib_headers.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - * $Id: stdlib_headers.h,v 1.18 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#define _STDLIB_HEADERS_H - -/****************************************************************************/ - -#ifndef EXEC_LIBRARIES_H -#include -#endif /* EXEC_LIBRARIES_H */ - -/****************************************************************************/ - -/* This enables the legacy compatible 'struct AnchorPathOld'. */ -#ifndef __amigaos4__ -#define USE_OLD_ANCHORPATH -#endif /* USE_OLD_ANCHORPATH */ - -/****************************************************************************/ - -#if (INCLUDE_VERSION >= 50) -#ifndef DOS_ANCHORPATH_H -#include -#endif /* DOS_ANCHORPATH_H */ -#endif /* (INCLUDE_VERSION >= 50) */ - -/****************************************************************************/ - -#ifndef DOS_DOSEXTENS_H -#include -#endif /* DOS_DOSEXTENS_H */ - -#ifndef DOS_DOSTAGS_H -#include -#endif /* DOS_DOSTAGS_H */ - -#ifndef DOS_DOSASL_H -#include -#endif /* DOS_DOSASL_H */ - -/****************************************************************************/ - -#ifndef WORKBENCH_STARTUP_H -#include -#endif /* WORKBENCH_STARTUP_H */ - -/****************************************************************************/ - -#ifndef CLIB_ALIB_PROTOS_H -#include -#endif /* CLIB_ALIB_PROTOS_H */ - -/****************************************************************************/ - -#ifndef PROTO_EXEC_H -#include -#endif /* PROTO_EXEC_H */ - -#ifndef PROTO_DOS_H -#include -#endif /* PROTO_DOS_H */ - -/****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/****************************************************************************/ - -#ifndef _STDLIB_LOCALEBASE_H -#include "stdlib_localebase.h" -#endif /* _STDLIB_LOCALEBASE_H */ - -#ifndef _STDLIB_UTILITYBASE_H -#include "stdlib_utilitybase.h" -#endif /* _STDLIB_UTILITYBASE_H */ - -/****************************************************************************/ - -#ifndef _MATH_FP_SUPPORT_H -#include "math_fp_support.h" -#endif /* _MATH_FP_SUPPORT_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) -#include -#endif /* FLOATING_POINT_SUPPORT */ - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_H */ - -#ifndef _DEBUG_H -#include "debug.h" -#endif /* _DEBUG_H */ - -/****************************************************************************/ - -extern unsigned int NOCOMMON __random_seed; - -/****************************************************************************/ - -extern jmp_buf NOCOMMON __exit_jmp_buf; -extern int NOCOMMON __exit_value; -extern BOOL NOCOMMON __exit_blocked; - -/****************************************************************************/ - -extern unsigned int NOCOMMON (* __get_default_stack_size)(void); - -/****************************************************************************/ - -extern unsigned int NOCOMMON __stack_size; -extern UBYTE * NOCOMMON __stk_limit; -extern UBYTE * NOCOMMON __base; - -/****************************************************************************/ - -extern ULONG NOCOMMON __stk_extensions; -extern ULONG NOCOMMON __stk_maxsize; - -/****************************************************************************/ - -extern ULONG NOCOMMON __stk_argbytes; -extern ULONG NOCOMMON __stk_safezone; -extern ULONG NOCOMMON __stk_size; -extern ULONG NOCOMMON __stk_minframe; - -/****************************************************************************/ - -extern BOOL NOCOMMON __is_resident; - -/****************************************************************************/ - -extern UBYTE NOCOMMON __shell_escape_character; - -/****************************************************************************/ - -extern char ** NOCOMMON __argv; -extern int NOCOMMON __argc; - -/****************************************************************************/ - -extern BOOL NOCOMMON __lib_startup; - -/****************************************************************************/ - -#ifndef _STDLIB_PROTOS_H -#include "stdlib_protos.h" -#endif /* _STDLIB_PROTOS_H */ - -/****************************************************************************/ - -extern void kprintf(const char * format,...); - -/****************************************************************************/ - -#endif /* _STDLIB_HEADERS_H */ diff --git a/library/stdlib_isresident.c b/library/stdlib_isresident.c deleted file mode 100644 index 2373238..0000000 --- a/library/stdlib_isresident.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: stdlib_isresident.c,v 1.4 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 EXEC_TYPES_H -#include -#endif /* EXEC_TYPES_H */ - -/****************************************************************************/ - -#include "macros.h" - -/****************************************************************************/ - -BOOL NOCOMMON __is_resident; diff --git a/library/stdlib_labs.c b/library/stdlib_labs.c deleted file mode 100644 index 93c8619..0000000 --- a/library/stdlib_labs.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id: stdlib_labs.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -long -labs(long x) -{ - long result; - - result = (x < 0) ? (-x) : x; - - return(result); -} diff --git a/library/stdlib_ldiv.c b/library/stdlib_ldiv.c deleted file mode 100644 index a7361e0..0000000 --- a/library/stdlib_ldiv.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id: stdlib_ldiv.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -ldiv_t -ldiv(long n,long d) -{ - ldiv_t result; - - assert( d != 0 ); - - result.quot = n / d; - result.rem = n % d; - - return(result); -} diff --git a/library/stdlib_lib_main.c b/library/stdlib_lib_main.c deleted file mode 100755 index 5d6a3dc..0000000 --- a/library/stdlib_lib_main.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * $Id: stdlib_lib_main.c,v 1.1 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(__THREAD_SAFE) - -/****************************************************************************/ - -#ifndef EXEC_EXECBASE_H -#include -#endif /* EXEC_EXECBASE_H */ - -/****************************************************************************/ - -#include -#include -#include -#include -#include - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -STATIC BOOL lib_init_successful; - -/****************************************************************************/ - -STATIC BOOL -open_libraries(struct Library * sys_base) -{ - BOOL success = FALSE; - int os_version; - - SysBase = sys_base; - - #if defined(__amigaos4__) - { - /* Get exec interface */ - IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; - } - #endif /* __amigaos4__ */ - - /* Check which minimum operating system version we actually require. */ - os_version = 37; - if(__minimum_os_lib_version > 37) - os_version = __minimum_os_lib_version; - - /* Open the minimum required libraries. */ - DOSBase = (struct Library *)OpenLibrary("dos.library",os_version); - if(DOSBase == NULL) - goto out; - - __UtilityBase = OpenLibrary("utility.library",os_version); - if(__UtilityBase == NULL) - goto out; - - #if defined(__amigaos4__) - { - /* Obtain the interfaces for these libraries. */ - IDOS = (struct DOSIFace *)GetInterface(DOSBase, "main", 1, 0); - if(IDOS == NULL) - goto out; - - __IUtility = (struct UtilityIFace *)GetInterface(__UtilityBase, "main", 1, 0); - if(__IUtility == NULL) - goto out; - } - #endif /* __amigaos4__ */ - - success = TRUE; - - out: - - return(success); -} - -/****************************************************************************/ - -STATIC VOID -close_libraries(VOID) -{ - #if defined(__amigaos4__) - { - if(__IUtility != NULL) - { - DropInterface((struct Interface *)__IUtility); - __IUtility = NULL; - } - - if(IDOS != NULL) - { - DropInterface((struct Interface *)IDOS); - IDOS = NULL; - } - } - #endif /* __amigaos4__ */ - - if(__UtilityBase != NULL) - { - CloseLibrary(__UtilityBase); - __UtilityBase = NULL; - } - - if(DOSBase != NULL) - { - CloseLibrary(DOSBase); - DOSBase = NULL; - } -} - -/****************************************************************************/ - -VOID -__lib_exit(VOID) -{ - ENTER(); - - if(lib_init_successful) - { - /* Enable exit() again. */ - __exit_blocked = FALSE; - - /* If one of the destructors drops into exit(), either directly - or through a failed assert() call, processing will resume with - the next following destructor. */ - (void)setjmp(__exit_jmp_buf); - - /* Go through the destructor list */ - _fini(); - - close_libraries(); - - lib_init_successful = FALSE; - } - - LEAVE(); -} - -/****************************************************************************/ - -BOOL -__lib_init(struct Library * sys_base) -{ - int result = FALSE; - - ENTER(); - - /* Make sure that no requesters and such pop up if anything - goes wrong during initialization. */ - __lib_startup = TRUE; - - /* Open dos.library and utility.library. */ - if(CANNOT open_libraries(sys_base)) - goto out; - - /* This plants the return buffer for _exit(). */ - if(setjmp(__exit_jmp_buf) != 0) - { - SHOWMSG("invoking the destructors"); - - /* If one of the destructors drops into exit(), either directly - or through a failed assert() call, processing will resume with - the next following destructor. */ - (void)setjmp(__exit_jmp_buf); - - /* Go through the destructor list */ - _fini(); - - goto out; - } - - SHOWMSG("now invoking the constructors"); - - /* Go through the constructor list */ - _init(); - - /* Disable exit() and its kin. */ - __exit_blocked = TRUE; - - /* Remember this so that __lib_exit() will know what to do. */ - lib_init_successful = TRUE; - - result = TRUE; - - out: - - if(NOT lib_init_successful) - close_libraries(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ diff --git a/library/stdlib_lib_startup.c b/library/stdlib_lib_startup.c deleted file mode 100644 index f5fdf65..0000000 --- a/library/stdlib_lib_startup.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: stdlib_lib_startup.c,v 1.1 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 EXEC_TYPES_H -#include -#endif /* EXEC_TYPES_H */ - -/****************************************************************************/ - -#include "macros.h" - -/****************************************************************************/ - -BOOL NOCOMMON __lib_startup; diff --git a/library/stdlib_llabs.c b/library/stdlib_llabs.c deleted file mode 100644 index 296eeb0..0000000 --- a/library/stdlib_llabs.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id: stdlib_llabs.c,v 1.1 2005-05-07 13:21:49 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -long long -llabs(long long x) -{ - long long result; - - result = (x < 0) ? (-x) : x; - - return(result); -} diff --git a/library/stdlib_lldiv.c b/library/stdlib_lldiv.c deleted file mode 100644 index f613a78..0000000 --- a/library/stdlib_lldiv.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id: stdlib_lldiv.c,v 1.1 2005-05-07 13:21:49 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -lldiv_t -lldiv(long long n,long long d) -{ - lldiv_t result; - - assert( d != 0 ); - - result.quot = n / d; - result.rem = n % d; - - return(result); -} diff --git a/library/stdlib_localebase.h b/library/stdlib_localebase.h deleted file mode 100644 index 864c55b..0000000 --- a/library/stdlib_localebase.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * $Id: stdlib_localebase.h,v 1.1 2005-03-30 19:37:43 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_LOCALEBASE_H -#define _STDLIB_LOCALEBASE_H - -/****************************************************************************/ - -#ifndef __NOLIBBASE__ -#define __NOLIBBASE__ -#endif /* __NOLIBBASE__ */ - -#ifndef __NOGLOBALIFACE__ -#define __NOGLOBALIFACE__ -#endif /* __NOGLOBALIFACE__ */ - -#include - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_H */ - -/****************************************************************************/ - -extern struct Library * NOCOMMON __LocaleBase; - -/****************************************************************************/ - -#if defined(__amigaos4__) - -/****************************************************************************/ - -extern struct LocaleIFace NOCOMMON * __ILocale; - -/****************************************************************************/ - -#define DECLARE_LOCALEBASE() \ - struct Library * UNUSED LocaleBase = __LocaleBase; \ - struct LocaleIFace * ILocale = __ILocale - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#define DECLARE_LOCALEBASE() \ - struct Library * LocaleBase = __LocaleBase - -/****************************************************************************/ - -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -#endif /* _STDLIB_LOCALEBASE_H */ diff --git a/library/stdlib_machine_test.c b/library/stdlib_machine_test.c deleted file mode 100644 index 9796ddb..0000000 --- a/library/stdlib_machine_test.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * $Id: stdlib_machine_test.c,v 1.7 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef EXEC_EXECBASE_H -#include -#endif /* EXEC_EXECBASE_H */ - -/****************************************************************************/ - -/* ZZZ this function should be called somewhere, but where from? */ -int -__machine_test(void) -{ - int result = ERROR; - - #if defined(M68020) - { - if(FLAG_IS_CLEAR(((struct ExecBase *)SysBase)->AttnFlags,AFF_68020)) - { - __show_error("This program requires an MC68020 CPU, or better."); - - goto out; - } - } - #endif /* M68020 */ - - result = OK; - - out: - - return(result); -} diff --git a/library/stdlib_main.c b/library/stdlib_main.c deleted file mode 100644 index 9d3ac88..0000000 --- a/library/stdlib_main.c +++ /dev/null @@ -1,590 +0,0 @@ -/* - * $Id: stdlib_main.c,v 1.25 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 EXEC_EXECBASE_H -#include -#endif /* EXEC_EXECBASE_H */ - -/****************************************************************************/ - -#include -#include -#include -#include -#include - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_MONITORING_H -#include "stdlib_profile_monitoring.h" -#endif /* _STDLIB_PROFILE_MONITORING_H */ - -/****************************************************************************/ - -extern int main(int arg_c,char ** arg_v); - -/****************************************************************************/ - -/* This will be set to TRUE in case a stack overflow was detected. */ -BOOL NOCOMMON __stack_overflow; - -/****************************************************************************/ - -STATIC int -call_main(void) -{ - ENTER(); - - /* This plants the return buffer for _exit(). */ - if(setjmp(__exit_jmp_buf) != 0) - goto out; - - SHOWMSG("now invoking the constructors"); - - /* Go through the constructor list */ - _init(); - - SHOWMSG("done."); - - /* If the SAS/C profiling code is set up for printing function - call chains, switch it on now. */ - __show_profile_names(); - - /* This can be helpful for debugging purposes: print the name of the current - directory, followed by the name of the command and all the parameters - passed to it. */ - #ifndef NDEBUG - { - UBYTE value_str[10]; - LONG value; - - /* Careful: only echo this information if a global environment - variable is set to enable this feature! */ - if(GetVar("_echo",value_str,sizeof(value_str),GVF_GLOBAL_ONLY) > 0 && StrToLong(value_str,&value) > 0 && value != 0) - { - struct Process * this_process = (struct Process *)FindTask(NULL); - UBYTE * arg_str = GetArgStr(); - size_t arg_str_len = strlen(arg_str); - UBYTE * arg_str_copy = AllocVec(arg_str_len+1,MEMF_ANY); - UBYTE current_dir_name[256]; - - if(arg_str_copy != NULL && NameFromLock(this_process->pr_CurrentDir,current_dir_name,sizeof(current_dir_name))) - { - strcpy(arg_str_copy,arg_str); - - while(arg_str_len > 0 && arg_str_copy[arg_str_len-1] <= ' ') - arg_str_copy[--arg_str_len] = '\0'; - - kprintf("[%s] %s %s\n",current_dir_name,__program_name,arg_str_copy); - } - - FreeVec(arg_str_copy); - } - } - #endif /* NDEBUG */ - - /* After all these preparations, get this show on the road... */ - exit(main((int)__argc,(char **)__argv)); - - out: - - /* Switch off function name printing, if it was enabled. */ - __hide_profile_names(); - - /* From this point on, don't worry about ^C checking any more. */ - __check_abort_enabled = FALSE; - - /* If we end up here with the __stack_overflow variable - set then the stack overflow handler dropped into - longjmp() and _exit() did not get called. This - means that we will have to show the error message - and invoke _exit() all on our own. */ - if(__stack_overflow) - { - SHOWMSG("we have a stack overflow"); - - /* Dump all currently unwritten data, especially to the console. */ - __flush_all_files(-1); - - __show_error("Stack overflow detected"); - - if(setjmp(__exit_jmp_buf) == 0) - _exit(RETURN_FAIL); - } - - /* If necessary, print stack size usage information. */ - #ifndef NDEBUG - { - __stack_usage_exit(); - } - #endif /* NDEBUG */ - - SHOWMSG("invoking the destructors"); - - /* If one of the destructors drops into exit(), either directly - or through a failed assert() call, processing will resume with - the next following destructor. */ - (void)setjmp(__exit_jmp_buf); - - /* Go through the destructor list */ - _fini(); - - SHOWMSG("done."); - - RETURN(__exit_value); - return(__exit_value); -} - -/****************************************************************************/ - -STATIC BOOL -open_libraries(VOID) -{ - BOOL success = FALSE; - int os_version; - - /* Check which minimum operating system version we actually require. */ - os_version = 37; - if(__minimum_os_lib_version > 37) - os_version = __minimum_os_lib_version; - - /* Open the minimum required libraries. */ - DOSBase = (struct Library *)OpenLibrary("dos.library",os_version); - if(DOSBase == NULL) - goto out; - - __UtilityBase = OpenLibrary("utility.library",os_version); - if(__UtilityBase == NULL) - goto out; - - #if defined(__amigaos4__) - { - /* Obtain the interfaces for these libraries. */ - IDOS = (struct DOSIFace *)GetInterface(DOSBase, "main", 1, 0); - if(IDOS == NULL) - goto out; - - __IUtility = (struct UtilityIFace *)GetInterface(__UtilityBase, "main", 1, 0); - if(__IUtility == NULL) - goto out; - } - #endif /* __amigaos4__ */ - - success = TRUE; - - out: - - return(success); -} - -/****************************************************************************/ - -STATIC VOID -close_libraries(VOID) -{ - #if defined(__amigaos4__) - { - if(__IUtility != NULL) - { - DropInterface((struct Interface *)__IUtility); - __IUtility = NULL; - } - - if(IDOS != NULL) - { - DropInterface((struct Interface *)IDOS); - IDOS = NULL; - } - } - #endif /* __amigaos4__ */ - - if(__UtilityBase != NULL) - { - CloseLibrary(__UtilityBase); - __UtilityBase = NULL; - } - - if(DOSBase != NULL) - { - CloseLibrary(DOSBase); - DOSBase = NULL; - } -} - -/****************************************************************************/ - -STATIC VOID ASM -detach_cleanup(REG(d0, LONG UNUSED unused_return_code),REG(d1, BPTR segment_list)) -{ - #if NOT defined(__amigaos4__) - { - /* The following trick is necessary only under dos.library V40 and below. */ - if(((struct Library *)DOSBase)->lib_Version < 50) - { - /* Now for the slightly shady part. We need to unload the segment - list this program was originally loaded with. We have to close - dos.library, though, which means that either we can close the - library or unload the code, but not both. But there's a loophole - in that we can enter Forbid(), unload the code, close the library - and exit and nobody will be able to allocate this program's - memory until after the process has been terminated. */ - Forbid(); - - UnLoadSeg(segment_list); - } - } - #endif /* __amigaos4__ */ - - close_libraries(); -} - -/****************************************************************************/ - -STATIC ULONG -get_stack_size(void) -{ - struct Task * tc = FindTask(NULL); - ULONG upper,lower; - ULONG result; - - /* How much stack size was provided? */ - upper = (ULONG)tc->tc_SPUpper; - lower = (ULONG)tc->tc_SPLower; - - result = upper - lower; - - return(result); -} - -/****************************************************************************/ - -int -_main(void) -{ - struct Process * volatile child_process = NULL; - struct WBStartup * volatile startup_message; - volatile APTR old_window_pointer = NULL; - volatile BOOL old_window_pointer_valid = FALSE; - struct Process * this_process; - int return_code = RETURN_FAIL; - ULONG current_stack_size; - - SysBase = *(struct Library **)4; - - #if defined(__amigaos4__) - { - /* Get exec interface */ - IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; - } - #endif /* __amigaos4__ */ - - /* Pick up the Workbench startup message, if available. */ - this_process = (struct Process *)FindTask(NULL); - - if(this_process->pr_CLI == ZERO) - { - struct MsgPort * mp = &this_process->pr_MsgPort; - - WaitPort(mp); - - startup_message = (struct WBStartup *)GetMsg(mp); - } - else - { - startup_message = NULL; - } - - __WBenchMsg = (struct WBStartup *)startup_message; - - /* Try to open the libraries we need to proceed. */ - if(CANNOT open_libraries()) - { - char * error_message; - - /* If available, use the error message provided by the client. */ - error_message = __minimum_os_lib_error; - - #if defined(__amigaos4__) - { - if(error_message == NULL) - error_message = "This program requires AmigaOS 4.0 or higher."; - } - #else - { - if(error_message == NULL) - error_message = "This program requires AmigaOS 2.04 or higher."; - } - #endif /* __amigaos4__ */ - - __show_error(error_message); - goto out; - } - - if(__disable_dos_requesters) - { - /* Don't display any requesters. */ - old_window_pointer = __set_process_window((APTR)-1); - } - else - { - /* Just remember the original pointer. */ - old_window_pointer = __set_process_window(NULL); - - __set_process_window(old_window_pointer); - } - - old_window_pointer_valid = TRUE; - - /* If a callback was provided which can fill us in on which - minimum stack size should be used, invoke it now and - store its result in the global __stack_size variable. */ - if(__get_default_stack_size != NULL) - { - unsigned int size; - - size = (*__get_default_stack_size)(); - if(size > 0) - __stack_size = size; - } - - /* How much stack space was provided? */ - current_stack_size = get_stack_size(); - - /* If this is a resident program, don't allow for the detach - code to run. Same goes for launching the program from - Workbench. */ - if(__is_resident || startup_message != NULL) - { - __detach = FALSE; - } - else if (__check_detach != NULL) - { - /* Check if we may need to detach from the shell. */ - __detach = (*__check_detach)(); - } - - /* The following code will be executed if the program is to keep - running in the shell or was launched from Workbench. */ - if(DO_NOT __detach) - { - int old_priority = this_process->pr_Task.tc_Node.ln_Pri; - - /* Change the task priority, if requested. */ - if(-128 <= __priority && __priority <= 127) - SetTaskPri((struct Task *)this_process,__priority); - - /* Was a minimum stack size requested and do we - need more stack space than was provided for? */ - if(__stack_size > 0 && current_stack_size < (ULONG)__stack_size) - { - struct StackSwapStruct * stk; - unsigned int stack_size; - APTR new_stack; - - /* Make the stack size a multiple of 32 bytes. */ - stack_size = 32 + ((__stack_size + 31UL) & ~31UL); - - /* Allocate the stack swapping data structure - and the stack space separately. */ - stk = AllocVec(sizeof(*stk),MEMF_PUBLIC|MEMF_ANY); - if(stk == NULL) - goto out; - - new_stack = AllocMem(stack_size,MEMF_PUBLIC|MEMF_ANY); - if(new_stack == NULL) - { - FreeVec(stk); - goto out; - } - - /* Fill in the lower and upper bounds, then take care of - the stack pointer itself. */ - stk->stk_Lower = new_stack; - stk->stk_Upper = (ULONG)(new_stack) + stack_size; - stk->stk_Pointer = (APTR)(stk->stk_Upper - 32); - - /* If necessary, set up for stack size usage measurement. */ - #ifndef NDEBUG - { - __stack_usage_init(stk); - } - #endif /* NDEBUG */ - - return_code = __swap_stack_and_call(stk,(APTR)call_main); - - FreeMem(new_stack, stack_size); - FreeVec(stk); - } - else - { - /* We have enough room to make the call or just don't care. */ - return_code = call_main(); - } - - /* Restore the task priority. */ - SetTaskPri((struct Task *)this_process,old_priority); - } - else - { - struct CommandLineInterface * cli = Cli(); - struct TagItem tags[12]; - UBYTE program_name[256]; - unsigned int stack_size; - int i; - - /* Now for the interesting part: detach from the shell we're - currently executing in. This works only if the program is - not reentrant and has not been launched from Workbench. */ - - stack_size = __stack_size; - - if(stack_size < current_stack_size) - stack_size = current_stack_size; - - if(stack_size < cli->cli_DefaultStack * sizeof(LONG)) - stack_size = cli->cli_DefaultStack * sizeof(LONG); - - GetProgramName(program_name,sizeof(program_name)); - - i = 0; - - tags[i]. ti_Tag = NP_Entry; - tags[i++]. ti_Data = (ULONG)call_main; - tags[i]. ti_Tag = NP_StackSize; - tags[i++]. ti_Data = stack_size; - tags[i]. ti_Tag = NP_Name; - tags[i++]. ti_Data = (ULONG)(__process_name != NULL ? (UBYTE *)__process_name : FilePart(program_name)); - tags[i]. ti_Tag = NP_CommandName; - tags[i++]. ti_Data = (ULONG)FilePart(program_name); - tags[i]. ti_Tag = NP_Cli; - tags[i++]. ti_Data = TRUE; - tags[i]. ti_Tag = NP_Arguments; - tags[i++]. ti_Data = (ULONG)GetArgStr(); - tags[i]. ti_Tag = NP_ExitCode; - tags[i++]. ti_Data = (ULONG)detach_cleanup; - tags[i]. ti_Tag = NP_ExitData; - tags[i++]. ti_Data = (ULONG)cli->cli_Module; - - /* Use a predefined task priority, if requested. */ - if(-128 <= __priority && __priority <= 127) - { - tags[i]. ti_Tag = NP_Priority; - tags[i++]. ti_Data = (ULONG)__priority; - } - - /* dos.library V50 will free the segment list upon exit. */ - if(((struct Library *)DOSBase)->lib_Version >= 50) - { - tags[i]. ti_Tag = NP_Seglist; - tags[i++]. ti_Data = (ULONG)cli->cli_Module;; - tags[i]. ti_Tag = NP_FreeSeglist; - tags[i++]. ti_Data = TRUE; - } - - tags[i].ti_Tag = TAG_END; - - Forbid(); - - child_process = CreateNewProc(tags); - if(child_process == NULL) - { - Permit(); - - PrintFault(IoErr(),program_name); - - return_code = RETURN_FAIL; - goto out; - } - - /* The standard I/O streams are no longer attached to a console. */ - __no_standard_io = TRUE; - - cli->cli_Module = ZERO; - - return_code = RETURN_OK; - - Permit(); - } - - out: - - if(old_window_pointer_valid) - __set_process_window(old_window_pointer); - - if(child_process == NULL) - close_libraries(); - - if(startup_message != NULL) - { - Forbid(); - - ReplyMsg((struct Message *)startup_message); - } - - return(return_code); -} - -/****************************************************************************/ - -/* The following is automatically called by the main() function through code - inserted by GCC. In theory, this could be removed by updating the machine - definition, but for now we'll just keep this stub around. It is intended - to call the constructor functions, but we do this in our own _main() - anyway. */ - -#if defined(__GNUC__) - -/****************************************************************************/ - -void __main(void); - -/****************************************************************************/ - -void -__main(void) -{ -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_malloc.c b/library/stdlib_malloc.c deleted file mode 100644 index 9b4f39d..0000000 --- a/library/stdlib_malloc.c +++ /dev/null @@ -1,420 +0,0 @@ -/* - * $Id: stdlib_malloc.c,v 1.13 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -#undef malloc -#undef __malloc - -/****************************************************************************/ - -#ifdef __MEM_DEBUG - -unsigned long NOCOMMON __maximum_memory_allocated; -unsigned long NOCOMMON __current_memory_allocated; -unsigned long NOCOMMON __maximum_num_memory_chunks_allocated; -unsigned long NOCOMMON __current_num_memory_chunks_allocated; - -#if defined(__USE_MEM_TREES) -struct MemoryTree NOCOMMON __memory_tree; -#endif /* __USE_MEM_TREES */ - -#endif /* __MEM_DEBUG */ - -/****************************************************************************/ - -APTR NOCOMMON __memory_pool; -struct MinList NOCOMMON __memory_list; - -/****************************************************************************/ - -size_t -__get_allocation_size(size_t size) -{ - #ifndef __MEM_DEBUG - { - size_t total_allocation_size; - - total_allocation_size = sizeof(struct MemoryNode) + size; - - /* Round up the allocation size to the physical allocation granularity. */ - size += ((total_allocation_size + MEM_BLOCKMASK) & ~((ULONG)MEM_BLOCKMASK)) - total_allocation_size; - } - #endif /* __MEM_DEBUG */ - - return(size); -} - -/****************************************************************************/ - -void * -__allocate_memory(size_t size,BOOL never_free,const char * UNUSED file,int UNUSED line) -{ - struct MemoryNode * mn; - size_t allocation_size; - void * result = NULL; - - assert( size > 0 ); - - __memory_lock(); - - if(__free_memory_threshold > 0 && AvailMem(MEMF_ANY|MEMF_LARGEST) < __free_memory_threshold) - { - SHOWMSG("not enough free memory available to safely proceed with allocation"); - - __set_errno(ENOMEM); - goto out; - } - - #ifdef __MEM_DEBUG - { - assert( MALLOC_HEAD_SIZE > 0 && (MALLOC_HEAD_SIZE % 4) == 0 ); - assert( MALLOC_TAIL_SIZE > 0 && (MALLOC_TAIL_SIZE % 4) == 0 ); - assert( (sizeof(*mn) % 4) == 0 ); - - allocation_size = sizeof(*mn) + MALLOC_HEAD_SIZE + size + MALLOC_TAIL_SIZE; - } - #else - { - /* Round up the allocation size to the physical allocation granularity. */ - size = __get_allocation_size(size); - - allocation_size = sizeof(*mn) + size; - } - #endif /* __MEM_DEBUG */ - - if(__memory_pool != NULL) - mn = AllocPooled(__memory_pool,allocation_size); - else - mn = AllocMem(allocation_size,MEMF_ANY); - - if(mn == NULL) - { - SHOWMSG("not enough memory"); - - __set_errno(ENOMEM); - goto out; - } - - mn->mn_Size = size; - mn->mn_NeverFree = never_free; - - AddTail((struct List *)&__memory_list,(struct Node *)mn); - - #ifdef __MEM_DEBUG - { - char * head = (char *)(mn + 1); - char * body = head + MALLOC_HEAD_SIZE; - char * tail = body + size; - - mn->mn_AlreadyFree = FALSE; - mn->mn_Allocation = body; - mn->mn_AllocationSize = allocation_size; - mn->mn_File = (char *)file; - mn->mn_Line = line; - mn->mn_FreeFile = NULL; - mn->mn_FreeLine = 0; - - memset(head,MALLOC_HEAD_FILL,MALLOC_HEAD_SIZE); - memset(body,MALLOC_NEW_FILL,size); - memset(tail,MALLOC_TAIL_FILL,MALLOC_TAIL_SIZE); - - __current_memory_allocated += size; - if(__maximum_memory_allocated < __current_memory_allocated) - __maximum_memory_allocated = __current_memory_allocated; - - __current_num_memory_chunks_allocated++; - if(__maximum_num_memory_chunks_allocated < __current_num_memory_chunks_allocated) - __maximum_num_memory_chunks_allocated = __current_num_memory_chunks_allocated; - - #ifdef __MEM_DEBUG_LOG - { - kprintf("[%s] + %10ld 0x%08lx [",__program_name,size,body); - - kprintf("allocated at %s:%ld]\n",file,line); - } - #endif /* __MEM_DEBUG_LOG */ - - #ifdef __USE_MEM_TREES - { - __red_black_tree_insert(&__memory_tree,mn); - } - #endif /* __USE_MEM_TREES */ - - result = mn->mn_Allocation; - } - #else - { - result = &mn[1]; - } - #endif /* __MEM_DEBUG */ - - assert( (((ULONG)result) & 3) == 0 ); - - out: - - #ifdef __MEM_DEBUG_LOG - { - if(result == NULL) - { - kprintf("[%s] + %10ld 0x%08lx [",__program_name,size,NULL); - - kprintf("FAILED: allocated at %s:%ld]\n",file,line); - } - } - #endif /* __MEM_DEBUG_LOG */ - - __memory_unlock(); - - return(result); -} - -/****************************************************************************/ - -__static void * -__malloc(size_t size,const char * file,int line) -{ - void * result = NULL; - - /* Try to get rid of now unused memory. */ - /*__alloca_cleanup(file,line);*/ - - #ifdef __MEM_DEBUG - { - /*if((rand() % 16) == 0) - __check_memory_allocations(file,line);*/ - } - #endif /* __MEM_DEBUG */ - - if(size == 0) - { - #ifdef __MEM_DEBUG - { - kprintf("[%s] ",__program_name); - - if(file != NULL) - kprintf("%s:%ld:",file,line); - - kprintf("malloc(0) called.\n"); - } - #endif /* __MEM_DEBUG */ - - goto out; - } - - assert( (int)size > 0 ); - - /* Allocate memory which can be put through realloc() and free(). */ - result = __allocate_memory(size,FALSE,file,line); - - out: - - return(result); -} - -/****************************************************************************/ - -void * -malloc(size_t size) -{ - void * result; - - result = __malloc(size,NULL,0); - - return(result); -} - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -/****************************************************************************/ - -static struct SignalSemaphore * memory_semaphore; - -/****************************************************************************/ - -void -__memory_lock(void) -{ - if(memory_semaphore != NULL) - ObtainSemaphore(memory_semaphore); -} - -/****************************************************************************/ - -void -__memory_unlock(void) -{ - if(memory_semaphore != NULL) - ReleaseSemaphore(memory_semaphore); -} - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ - -/****************************************************************************/ - -STDLIB_DESTRUCTOR(stdlib_memory_exit) -{ - ENTER(); - - #ifdef __MEM_DEBUG - { - kprintf("[%s] %ld bytes still allocated upon exit, maximum of %ld bytes allocated at a time.\n", - __program_name,__current_memory_allocated,__maximum_memory_allocated); - - kprintf("[%s] %ld chunks of memory still allocated upon exit, maximum of %ld chunks allocated at a time.\n", - __program_name,__current_num_memory_chunks_allocated,__maximum_num_memory_chunks_allocated); - - __check_memory_allocations(__FILE__,__LINE__); - - __never_free = FALSE; - - if(__memory_list.mlh_Head != NULL) - { - while(NOT IsListEmpty((struct List *)&__memory_list)) - { - ((struct MemoryNode *)__memory_list.mlh_Head)->mn_AlreadyFree = FALSE; - - __free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,__FILE__,__LINE__); - } - } - - #if defined(__USE_MEM_TREES) - { - __initialize_red_black_tree(&__memory_tree); - } - #endif /* __USE_MEM_TREES */ - } - #endif /* __MEM_DEBUG */ - - if(__memory_pool != NULL) - { - NewList((struct List *)&__memory_list); - - DeletePool(__memory_pool); - __memory_pool = NULL; - } - else - { - if(__memory_list.mlh_Head != NULL) - { - #ifdef __MEM_DEBUG - { - while(NOT IsListEmpty((struct List *)&__memory_list)) - __free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,__FILE__,__LINE__); - } - #else - { - while(NOT IsListEmpty((struct List *)&__memory_list)) - __free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,NULL,0); - } - #endif /* __MEM_DEBUG */ - } - } - - #if defined(__THREAD_SAFE) - { - __delete_semaphore(memory_semaphore); - memory_semaphore = NULL; - } - #endif /* __THREAD_SAFE */ - - LEAVE(); -} - -/****************************************************************************/ - -STDLIB_CONSTRUCTOR(stdlib_memory_init) -{ - BOOL success = FALSE; - - ENTER(); - - #if defined(__THREAD_SAFE) - { - memory_semaphore = __create_semaphore(); - if(memory_semaphore == NULL) - goto out; - } - #endif /* __THREAD_SAFE */ - - #if defined(__USE_MEM_TREES) && defined(__MEM_DEBUG) - { - __initialize_red_black_tree(&__memory_tree); - } - #endif /* __USE_MEM_TREES && __MEM_DEBUG */ - - NewList((struct List *)&__memory_list); - - #if defined(__amigaos4__) - { - __memory_pool = CreatePool(MEMF_ANY,(ULONG)__default_pool_size,(ULONG)__default_puddle_size); - } - #else - { - if(((struct Library *)SysBase)->lib_Version >= 39) - __memory_pool = CreatePool(MEMF_ANY,(ULONG)__default_pool_size,(ULONG)__default_puddle_size); - } - #endif /* __amigaos4__ */ - - success = TRUE; - - out: - - SHOWVALUE(success); - LEAVE(); - - if(success) - CONSTRUCTOR_SUCCEED(); - else - CONSTRUCTOR_FAIL(); -} diff --git a/library/stdlib_math.c b/library/stdlib_math.c deleted file mode 100644 index 854e666..0000000 --- a/library/stdlib_math.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: stdlib_math.c,v 1.4 2005-03-18 12:38:24 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -int -__math_init(void) -{ - return(OK); -} diff --git a/library/stdlib_mblen.c b/library/stdlib_mblen.c deleted file mode 100644 index cc6c4f0..0000000 --- a/library/stdlib_mblen.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: stdlib_mblen.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -int -mblen(const char *s, size_t n) -{ - /* ZZZ unimplemented */ - return(-1); -} diff --git a/library/stdlib_mbstowcs.c b/library/stdlib_mbstowcs.c deleted file mode 100644 index f259454..0000000 --- a/library/stdlib_mbstowcs.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: stdlib_mbstowcs.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -size_t -mbstowcs(wchar_t *pwcs, const char *s, size_t n) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/stdlib_mbtowc.c b/library/stdlib_mbtowc.c deleted file mode 100644 index 383749d..0000000 --- a/library/stdlib_mbtowc.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: stdlib_mbtowc.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -int -mbtowc(wchar_t *pwc, const char *s, size_t n) -{ - /* ZZZ unimplemented */ - return(-1); -} diff --git a/library/stdlib_memory.h b/library/stdlib_memory.h deleted file mode 100644 index 9146c9d..0000000 --- a/library/stdlib_memory.h +++ /dev/null @@ -1,236 +0,0 @@ -/* - * $Id: stdlib_memory.h,v 1.2 2005-03-20 11:18:06 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_MEMORY_H -#define _STDLIB_MEMORY_H - -/****************************************************************************/ - -/* - * Uncomment this to build a library which has the memory debugging features - * enabled. - */ -/*#define __MEM_DEBUG*/ - -/****************************************************************************/ - -/* - * Uncomment this to see reports of where and how much memory is allocated - * or released. - */ -/*#define __MEM_DEBUG_LOG*/ - -/****************************************************************************/ - -/* - * Uncomment this to speed up memory data maintenance operations when - * the memory debugging mode is enabled. - */ -/*#define __USE_MEM_TREES*/ - -/****************************************************************************/ - -/* - * Memory debugging parameters; note that the head/tail size must be - * multiples of four, or you will break code that depends upon malloc() - * and friends to return long word aligned data structures! Better - * still, there are assert()s in the library which will blow your code - * out of the water if the data returned by malloc() and realloc() is - * not long word aligned... - */ - -#define MALLOC_HEAD_SIZE 512 /* How many bytes to allocate in front of - each memory chunk */ -#define MALLOC_TAIL_SIZE 512 /* How many bytes to allocate behind each - memory chunk */ - -/****************************************************************************/ - -#define MALLOC_NEW_FILL 0xA3 /* The byte value to fill newly created - memory allocations with */ -#define MALLOC_FREE_FILL 0xA5 /* The byte value to fill freed memory - allocations with */ -#define MALLOC_HEAD_FILL 0xA7 /* The byte value to fill the memory in - front of each allocation with */ -#define MALLOC_TAIL_FILL 0xA9 /* The byte value to fill the memory behind - each allocation with */ - -/****************************************************************************/ - -#ifndef EXEC_MEMORY_H -#include -#endif /* EXEC_MEMORY_H */ - -#ifndef EXEC_NODES_H -#include -#endif /* EXEC_NODES_H */ - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_H */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -/* We shuffle things around a bit for the debug code. This works by joining - related code which shares the same name. The debug code symbols also have - to be completely separate from the "regular" code. */ -#if defined(__MEM_DEBUG) - -#define __static - -#define __alloca_cleanup __alloca_cleanup_debug - -#define __find_memory_node __find_memory_node_debug -#define __free_memory_node __free_memory_node_debug -#define __force_free __force_free_debug - -#define __get_allocation_size __get_allocation_size_debug -#define __allocate_memory __allocate_memory_debug - -#define __memory_pool __memory_pool_debug -#define __memory_list __memory_list_debug - -#define __vasprintf_hook_entry __vasprintf_hook_entry_debug - -extern void * __alloca(size_t size,const char * file,int line); -extern void * __calloc(size_t num_elements,size_t element_size,const char * file,int line); -extern void __free(void * ptr,const char * file,int line); -extern void * __malloc(size_t size,const char * file,int line); -extern void * __realloc(void *ptr,size_t size,const char * file,int line); -extern char * __strdup(const char *s,const char * file,int line); -extern char * __getcwd(char * buffer,size_t buffer_size,const char *file,int line); - -#else - -#define __static STATIC - -#define __free(mem,file,line) free(mem) -#define __malloc(size,file,line) malloc(size) - -#endif /* __MEM_DEBUG */ - -/****************************************************************************/ - -struct MemoryNode -{ - struct MinNode mn_MinNode; - size_t mn_Size; - - UBYTE mn_NeverFree; - -#ifdef __MEM_DEBUG - UBYTE mn_AlreadyFree; - UBYTE mn_Pad0[2]; - - void * mn_Allocation; - size_t mn_AllocationSize; - - char * mn_FreeFile; - int mn_FreeLine; - - char * mn_File; - int mn_Line; - -#ifdef __USE_MEM_TREES - struct MemoryNode * mn_Left; - struct MemoryNode * mn_Right; - struct MemoryNode * mn_Parent; - UBYTE mn_IsRed; - UBYTE mn_Pad1[3]; -#endif /* __USE_MEM_TREES */ - -#else - UBYTE mn_Pad0[3]; -#endif /* __MEM_DEBUG */ -}; - -#ifdef __USE_MEM_TREES - -struct MemoryTree -{ - struct MemoryNode * mt_Root; - struct MemoryNode mt_RootNode; - struct MemoryNode mt_NullNode; -}; - -#endif /* __USE_MEM_TREES */ - -/****************************************************************************/ - -extern struct MemoryTree NOCOMMON __memory_tree; -extern struct MinList NOCOMMON __memory_list; -extern APTR NOCOMMON __memory_pool; - -/****************************************************************************/ - -extern unsigned long NOCOMMON __maximum_memory_allocated; -extern unsigned long NOCOMMON __current_memory_allocated; -extern unsigned long NOCOMMON __maximum_num_memory_chunks_allocated; -extern unsigned long NOCOMMON __current_num_memory_chunks_allocated; - -/****************************************************************************/ - -extern int NOCOMMON __default_pool_size; -extern int NOCOMMON __default_puddle_size; - -/****************************************************************************/ - -#if defined(__THREAD_SAFE) - -/****************************************************************************/ - -extern void __memory_lock(void); -extern void __memory_unlock(void); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#define __memory_lock() ((void)0) -#define __memory_unlock() ((void)0) - -/****************************************************************************/ - -#endif /* __THREAD_SAFE */ - -/****************************************************************************/ - -#endif /* _STDLIB_MEMORY_H */ diff --git a/library/stdlib_mkdtemp.c b/library/stdlib_mkdtemp.c deleted file mode 100644 index 567e204..0000000 --- a/library/stdlib_mkdtemp.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * $Id: stdlib_mkdtemp.c,v 1.4 2005-02-03 16:56:16 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -char * -mkdtemp(char *name_template) -{ - char * result = NULL; - - ENTER(); - - SHOWSTRING(name_template); - - assert( name_template != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name_template == NULL) - { - SHOWMSG("invalid name template"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(mktemp(name_template) == NULL) - { - SHOWMSG("could not pick a temp name"); - goto out; - } - - if(mkdir(name_template,0700) == -1) - { - SHOWMSG("could not create directory"); - goto out; - } - - result = name_template; - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdlib_mkstemp.c b/library/stdlib_mkstemp.c deleted file mode 100644 index 1d46252..0000000 --- a/library/stdlib_mkstemp.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * $Id: stdlib_mkstemp.c,v 1.5 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -mkstemp(char *name_template) -{ - int result = ERROR; - - ENTER(); - - SHOWSTRING(name_template); - - assert( name_template != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name_template == NULL) - { - SHOWMSG("invalid name template"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(mktemp(name_template) == NULL) - { - SHOWMSG("could not pick temp name"); - goto out; - } - - SHOWSTRING(name_template); - - result = open(name_template,O_RDWR|O_CREAT|O_TRUNC,0600); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdlib_mktemp.c b/library/stdlib_mktemp.c deleted file mode 100644 index 7717c35..0000000 --- a/library/stdlib_mktemp.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * $Id: stdlib_mktemp.c,v 1.7 2005-02-28 10:07:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -char * -mktemp(char * name_template) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info name_template_nti; - #endif /* UNIX_PATH_SEMANTICS */ - char * test_name; - struct Process * this_process; - APTR old_window_pointer; - char * result = NULL; - size_t template_offset; - size_t template_len; - size_t name_len; - size_t offset; - time_t now; - ULONG pseudo_random_number; - BPTR lock; - size_t i; - - ENTER(); - - SHOWSTRING(name_template); - - assert(name_template != NULL); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name_template == NULL) - { - SHOWMSG("invalid name template"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - this_process = (struct Process *)FindTask(NULL); - - SHOWSTRING(name_template); - - /* So, how long is that name template? */ - name_len = strlen(name_template); - if(name_len == 0) - { - SHOWMSG("invalid name template"); - - __set_errno(EINVAL); - goto out; - } - - /* Find out how many trailing 'X' characters there are in - the template. There should be at least 6. We also want - to know where to find the first 'X' and how many of the - 'X' characters there are. */ - template_offset = 0; - template_len = 0; - - for(i = 0 ; i < name_len ; i++) - { - assert( name_len >= (i + 1) ); - - offset = name_len - (i + 1); - - if(name_template[offset] != 'X') - break; - - template_offset = offset; - template_len++; - } - - SHOWVALUE(template_offset); - SHOWVALUE(template_len); - - if(template_len == 0) - { - SHOWMSG("invalid name template"); - - __set_errno(EINVAL); - goto out; - } - - /* Generate a pseudo-random number from the current time and - the address of the current process. */ - time(&now); - - pseudo_random_number = (ULONG)now + (ULONG)this_process; - - /* Fill the template 'X' characters with letters made up by - converting the pseudo-random number. */ - for(i = 0 ; i < template_len ; i++) - { - name_template[template_offset + i] = 'A' + (pseudo_random_number % 26); - - /* One more letter taken; if we run out of letters, - cook up another pseudo-random number. */ - pseudo_random_number = (pseudo_random_number / 26); - if(pseudo_random_number == 0) - { - time(&now); - - pseudo_random_number = (ULONG)now; - } - } - - SHOWSTRING(name_template); - - /* Now check if the name we picked is unique. If not, make another name. */ - while(TRUE) - { - if(__check_abort_enabled) - __check_abort(); - - D(("checking '%s'",name_template)); - - test_name = name_template; - - /* If necessary, quickly translate the semantics of the file name - we cooked up above. */ - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name((char const **)&test_name,&name_template_nti) != 0) - goto out; - - if(name_template_nti.is_root) - { - __set_errno(EACCES); - goto out; - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - /* Turn off DOS error requesters. */ - old_window_pointer = __set_process_window((APTR)-1); - - /* Does this object exist already? */ - PROFILE_OFF(); - lock = Lock(test_name,SHARED_LOCK); - PROFILE_ON(); - - /* Restore DOS requesters. */ - __set_process_window(old_window_pointer); - - if(lock == ZERO) - { - /* If the object does not exist yet then we - * are finished. - */ - if(IoErr() == ERROR_OBJECT_NOT_FOUND) - { - result = name_template; - break; - } - - /* Looks like a serious error. */ - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - /* OK, so it exists already. Start over... */ - - PROFILE_OFF(); - UnLock(lock); - PROFILE_ON(); - - /* Change one letter; if that 'overflows', start - over with 'A' and move on to the next position. */ - for(i = 0 ; i < template_len ; i++) - { - name_template[template_offset + i]++; - if(name_template[template_offset + i] <= 'Z') - break; - - name_template[template_offset + i] = 'A'; - } - } - - SHOWSTRING(name_template); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdlib_modsi3.c b/library/stdlib_modsi3.c deleted file mode 100644 index 2a1f372..0000000 --- a/library/stdlib_modsi3.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * $Id: stdlib_modsi3.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__) - -/****************************************************************************/ - -#ifndef __PPC__ -asm(" \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl ___modsi3 \n\ - .globl ___divsi4 \n\ - \n\ -| D1.L = D0.L % D1.L signed \n\ - \n\ -___modsi3: \n\ - \n\ - moveml sp@(4:W),d0/d1 \n\ - jbsr ___divsi4 \n\ - movel d1,d0 \n\ - rts \n\ - \n\ -"); -#else -__asm(" \n\ - .text \n\ - .align 2 \n\ - \n\ - .globl __modsi3 \n\ - .globl __divsi4 \n\ - \n\ -__modsi3: \n\ - stw r0, 20(r1) \n\ - divw r0, r3, r4 \n\ - mullw r0, r0, r4 \n\ - subf r3, r0, r3 \n\ - blr \n\ -"); -#endif - -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_mulsi3.c b/library/stdlib_mulsi3.c deleted file mode 100644 index 5febbe1..0000000 --- a/library/stdlib_mulsi3.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * $Id: stdlib_mulsi3.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ -#ifndef __PPC__ -asm(" \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl ___mulsi3 \n\ - .globl ___UtilityBase \n\ - \n\ -| D0 = D0 * D1 \n\ - \n\ -___mulsi3: \n\ - \n\ - moveml sp@(4),d0/d1 \n\ - movel "A4(___UtilityBase)",a0 \n\ - jmp a0@(-138:W) \n\ - \n\ -"); -#else -__asm(" \n\ - .text \n\ - .align 2 \n\ - \n\ - .globl __mulsi3 \n\ - \n\ -__mulsi3: \n\ - mullw r3, r3, r4 \n\ - blr \n\ -"); -#endif -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_never_free.c b/library/stdlib_never_free.c deleted file mode 100644 index 0f4ae2f..0000000 --- a/library/stdlib_never_free.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: stdlib_never_free.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -BOOL __never_free = FALSE; diff --git a/library/stdlib_null_pointer_check.h b/library/stdlib_null_pointer_check.h deleted file mode 100644 index b1d9198..0000000 --- a/library/stdlib_null_pointer_check.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * $Id: stdlib_null_pointer_check.h,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 -#define _STDLIB_NULL_POINTER_CHECK_H - -/****************************************************************************/ - -/* - * Uncomment this to build a library which checks pointer parameters against - * NULL upon entry. - */ -/*#define CHECK_FOR_NULL_POINTERS*/ - -/****************************************************************************/ - -#endif /* _STDLIB_NULL_POINTER_CHECK_H */ diff --git a/library/stdlib_osliberror.c b/library/stdlib_osliberror.c deleted file mode 100644 index 31dd543..0000000 --- a/library/stdlib_osliberror.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * $Id: stdlib_osliberror.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -char * __minimum_os_lib_error; diff --git a/library/stdlib_oslibversion.c b/library/stdlib_oslibversion.c deleted file mode 100644 index 07e6909..0000000 --- a/library/stdlib_oslibversion.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * $Id: stdlib_oslibversion.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -int __minimum_os_lib_version; diff --git a/library/stdlib_priority.c b/library/stdlib_priority.c deleted file mode 100644 index 31bf608..0000000 --- a/library/stdlib_priority.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * $Id: stdlib_priority.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -/* We use an invalid priority value to indicate "do not change the program's - task priority". */ -int __priority = 256; diff --git a/library/stdlib_process_name.c b/library/stdlib_process_name.c deleted file mode 100644 index 5776d76..0000000 --- a/library/stdlib_process_name.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * $Id: stdlib_process_name.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -char * __process_name; diff --git a/library/stdlib_profile.h b/library/stdlib_profile.h deleted file mode 100644 index b5133b5..0000000 --- a/library/stdlib_profile.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * $Id: stdlib_profile.h,v 1.1 2005-03-18 12:38:24 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_PROFILE_H -#define _STDLIB_PROFILE_H - -/****************************************************************************/ - -/* Magic macros for code profiling, SAS/C style. Normally, you would find - these in , which is SAS/C-specific. */ - -/****************************************************************************/ - -#ifdef __SASC - -/****************************************************************************/ - -extern void ASM _PROLOG(REG(a0,char *)); -extern void ASM _EPILOG(REG(a0,char *)); - -#if _PROFILE -#define PROFILE_OFF() _PROLOG(0L) -#define PROFILE_ON() _EPILOG(0L) -#else -#define PROFILE_OFF() ((void)0) -#define PROFILE_ON() ((void)0) -#endif /* _PROFILE */ - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#define PROFILE_OFF() ((void)0) -#define PROFILE_ON() ((void)0) - -/****************************************************************************/ - -#endif /* __SASC */ - -/****************************************************************************/ - -#endif /* _STDLIB_PROFILE_H */ diff --git a/library/stdlib_profile_monitoring.c b/library/stdlib_profile_monitoring.c deleted file mode 100644 index 3296144..0000000 --- a/library/stdlib_profile_monitoring.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * $Id: stdlib_profile_monitoring.c,v 1.1 2005-03-19 10:15:56 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(__SASC) - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -static BOOL show_profile_names = FALSE; -static int nest_level; - -/****************************************************************************/ - -void ASM -_PROLOG(REG(a0,char * id)) -{ - nest_level++; - - if(id != NULL && __program_name != NULL) - { - int i; - - kprintf("[%s]",__program_name); - - for(i = 0 ; i < nest_level ; i++) - kputc(' '); - - kprintf("%s\n",id); - } -} - -/****************************************************************************/ - -void ASM -_EPILOG(REG(a0,char * id)) -{ - if(nest_level > 0) - nest_level--; -} - -/****************************************************************************/ - -void -__show_profile_names(void) -{ - show_profile_names = TRUE; -} - -/****************************************************************************/ - -void -__hide_profile_names(void) -{ - show_profile_names = FALSE; -} - -/****************************************************************************/ - -#endif /* __SASC */ diff --git a/library/stdlib_profile_monitoring.h b/library/stdlib_profile_monitoring.h deleted file mode 100644 index 4f0d94f..0000000 --- a/library/stdlib_profile_monitoring.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * $Id: stdlib_profile_monitoring.h,v 1.1 2005-03-19 10:15:56 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_PROFILE_MONITORING_H -#define _STDLIB_PROFILE_MONITORING_H - -/****************************************************************************/ - -/* The SAS/C profiling hooks can be used to track call chains. Neat - trick, but not always necessary. Don't enable this unless you know - what you're doing... */ - -/****************************************************************************/ - -/*#define USE_PROFILE_MONITORING*/ - -/****************************************************************************/ - -#if defined(__SASC) && defined(USE_PROFILE_MONITORING) - -/****************************************************************************/ - -extern void __show_profile_names(void); -extern void __hide_profile_names(void); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#define __show_profile_names() ((void)0) -#define __hide_profile_names() ((void)0) - -/****************************************************************************/ - -#endif /* __SASC && USE_PROFILE_MONITORING */ - -/****************************************************************************/ - -#endif /* _STDLIB_PROFILE_MONITORING_H */ diff --git a/library/stdlib_program_name.c b/library/stdlib_program_name.c deleted file mode 100755 index 7871e47..0000000 --- a/library/stdlib_program_name.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * $Id: stdlib_program_name.c,v 1.1 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -static BOOL free_program_name; - -/****************************************************************************/ - -char * NOCOMMON __program_name; - -/****************************************************************************/ - -STDLIB_DESTRUCTOR(stdlib_program_name_exit) -{ - ENTER(); - - if(free_program_name && __program_name != NULL) - { - FreeVec(__program_name); - __program_name = NULL; - } - - LEAVE(); -} - -/****************************************************************************/ - -STDLIB_CONSTRUCTOR(stdlib_program_name_init) -{ - BOOL success = FALSE; - - ENTER(); - - if(__WBenchMsg == NULL) - { - const size_t program_name_size = 256; - - /* Make a copy of the current command name string. */ - __program_name = AllocVec((ULONG)program_name_size,MEMF_ANY); - if(__program_name == NULL) - goto out; - - free_program_name = TRUE; - - if(CANNOT GetProgramName(__program_name,program_name_size)) - goto out; - } - else - { - __program_name = (char *)__WBenchMsg->sm_ArgList[0].wa_Name; - } - - success = TRUE; - - out: - - SHOWVALUE(success); - LEAVE(); - - if(success) - CONSTRUCTOR_SUCCEED(); - else - CONSTRUCTOR_FAIL(); -} diff --git a/library/stdlib_protos.h b/library/stdlib_protos.h deleted file mode 100644 index 5f5815c..0000000 --- a/library/stdlib_protos.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * $Id: stdlib_protos.h,v 1.15 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_PROTOS_H -#define _STDLIB_PROTOS_H - -/****************************************************************************/ - -#ifndef EXEC_TASKS_H -#include -#endif /* EXEC_TASKS_H */ - -/****************************************************************************/ - -#ifndef _STDDEF_H -#include -#endif /* _STDDEF_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -/* math_init_exit.c */ -extern int __math_init(void); - -/****************************************************************************/ - -/* stdlib_machine_test.c */ -extern int __machine_test(void); - -/****************************************************************************/ - -/* stdio_init_exit.c */ -extern int __stdio_init(void); - -/****************************************************************************/ - -/* stdlib_init_exit.c */ -extern int __stdlib_init(void); -extern void __stdlib_exit(void); - -/****************************************************************************/ - -/* stdlib_atexit.c */ -extern void __exit_trap_trigger(void); - -/****************************************************************************/ - -/* socket_init_exit.c */ -extern int __socket_init(void); - -/****************************************************************************/ - -/* stdlib_showerror.c */ -extern void __show_error(const char * message); - -/****************************************************************************/ - -/* stdlib_swap_stack.c/stdlib_swap_stack.s/stdlib_swap_stack.asm */ -extern int __swap_stack_and_call(struct StackSwapStruct * stk,APTR function); - -/****************************************************************************/ - -/* stdlib_get_sp.c/stdlib_get_sp.s/stdlib_get_sp.asm */ -extern void * __get_sp(void); - -/****************************************************************************/ - -/* stdlib_wildcard_expand.c */ -extern int __wildcard_quote_parameter(unsigned int parameter); -extern int __wildcard_expand_init(void); - -/****************************************************************************/ - -/* stdlib_stackextension.c */ -extern int __stk_init(void); - -/****************************************************************************/ - -/* stdlib_stack_usage.c */ -extern void __stack_usage_init(struct StackSwapStruct * stk); -extern void __stack_usage_exit(void); - -/****************************************************************************/ - -/* stdlib_exit.c */ -extern void _exit(int return_code); - -/****************************************************************************/ - -/* stdlib_constructor_begin.c */ -void _init(void); -void _fini(void); - -/****************************************************************************/ - -/* stdlib_arg.c */ -extern int __arg_init(void); - -/****************************************************************************/ - -/* stdlib_malloc.c */ -extern size_t __get_allocation_size(size_t size); -extern void * __allocate_memory(size_t size,BOOL never_free,const char * file,int line); - -/* stdlib_free.c */ -extern struct MemoryNode * __find_memory_node(void * address); -extern void __force_free(void * ptr,const char * file,int line); -extern void __check_memory_allocations(const char * file,int line); -extern void __free_memory_node(struct MemoryNode * mn,const char * file,int line); - -/* stdlib_alloca.c */ -extern void __alloca_cleanup(const char * file,int line); - -/****************************************************************************/ - -/* signal_checkabort.c */ -extern void __check_abort(void); - -/****************************************************************************/ - -/* stdlib_red_black.c */ -extern void __initialize_red_black_tree(struct MemoryTree *new_tree); -extern void __red_black_tree_insert(struct MemoryTree * tree, struct MemoryNode *x); -extern struct MemoryNode * __red_black_tree_find(struct MemoryTree * tree,void * allocation); -extern void __red_black_tree_remove(struct MemoryTree * tree, struct MemoryNode * z); - -/****************************************************************************/ - -/* stdlib_main.c */ -extern int _main(void); - -/****************************************************************************/ - -/* stdlib_assertion_failure.c */ -extern void __assertion_failure(const char *file_name,int line_number,const char *expression); - -/****************************************************************************/ - -/* stdlib_stackoverflow.c */ -extern void __stkovf(void); - -/****************************************************************************/ - -/* stdlib_termination_message.c */ -extern void __print_termination_message(const char * termination_message); - -/****************************************************************************/ - -/* stdlib_set_process_window.c */ -extern APTR __set_process_window(APTR new_window_pointer); - -/****************************************************************************/ - -/* stdlib_set_errno.c */ -extern void __set_errno(int new_errno); - -/****************************************************************************/ - -/* stdlib_get_errno.c */ -extern int __get_errno(void); - -/****************************************************************************/ - -/* stdlib_semaphore.c */ -extern struct SignalSemaphore * __create_semaphore(void); -extern void __delete_semaphore(struct SignalSemaphore * semaphore); - -/****************************************************************************/ - -#endif /* _STDLIB_PROTOS_H */ diff --git a/library/stdlib_putenv.c b/library/stdlib_putenv.c deleted file mode 100644 index 4bc6ea7..0000000 --- a/library/stdlib_putenv.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * $Id: stdlib_putenv.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -putenv(const char *string) -{ - int result = ERROR; - - ENTER(); - - SHOWSTRING(string); - - assert( string != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(string == NULL) - { - SHOWMSG("invalid string"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = setenv(string,"",1); - - out: - - RETURN(result); - return(result); -} diff --git a/library/stdlib_qsort.c b/library/stdlib_qsort.c deleted file mode 100644 index 3a5f820..0000000 --- a/library/stdlib_qsort.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * $Id: stdlib_qsort.c,v 1.5 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -/****************************************************************** - * qsort.c -- Non-Recursive ANSI Quicksort function * - * * - * Public domain by Raymond Gardner, Englewood CO February 1991 * - * * - * Usage: * - * qsort(base, nbr_elements, width_bytes, compare_function); * - * void *base; * - * size_t nbr_elements, width_bytes; * - * int (*compare_function)(const void *, const void *); * - * * - * Sorts an array starting at base, of length nbr_elements, each * - * element of size width_bytes, ordered via compare_function, * - * which is called as (*compare_function)(ptr_to_element1, * - * ptr_to_element2) and returns < 0 if element1 < element2, * - * 0 if element1 = element2, > 0 if element1 > element2. * - * Most refinements are due to R. Sedgewick. See "Implementing * - * Quicksort Programs", Comm. ACM, Oct. 1978, and Corrigendum, * - * Comm. ACM, June 1979. * - ******************************************************************/ - -/******************************************************************/ - -#define SWAP(a, b, size) (swap((char *)(a), (char *)(b), size)) -#define COMPARE(a, b) ((*comp)((const void *)(a), (const void *)(b))) - -/******************************************************************/ - -/* subfiles of THRESHOLD or fewer elements will - be sorted by a simple insertion sort - Note! THRESHOLD must be at least 3 */ -#define THRESHOLD 7 - -/******************************************************************/ - -/* For an 68030 and beyond the alignment does not matter and you can skip the - second half of the test (everything beyond the 'nbytes >= sizeof(long)'). */ -#if defined(M68020) -#define IS_WORD_ALIGNED(a,b) (1) -#else -#define IS_WORD_ALIGNED(a,b) (((((unsigned long)(a)) | ((unsigned long)(b))) & 1) == 0) -#endif /* M68020 */ - -/******************************************************************/ - -/* swap nbytes between a and b */ -INLINE STATIC void -swap(char * a, char * b, size_t nbytes) -{ - char temp; - - assert( a != NULL && b != NULL && nbytes > 0 ); - - /* This is an attempt to use 'long' sized swapping, if possible. */ - if(nbytes >= sizeof(long) && IS_WORD_ALIGNED(a,b)) - { - long *_a = (long *)a; - long *_b = (long *)b; - long _temp; - - do - { - _temp = (*_a); - (*_a++) = (*_b); - (*_b++) = _temp; - - nbytes -= sizeof(long); - } - while(nbytes >= sizeof(long)); - - if(nbytes > 0) - { - a = (char *)_a; - b = (char *)_b; - - do - { - temp = (*a); - (*a++) = (*b); - (*b++) = temp; - } - while(--nbytes > 0); - } - } - else - { - do - { - temp = (*a); - (*a++) = (*b); - (*b++) = temp; - } - while(--nbytes > 0); - } -} - -/******************************************************************/ - -void -qsort(void * base, size_t count, size_t size, int (*comp)(const void * element1, const void * element2)) -{ - ENTER(); - - SHOWPOINTER(base); - SHOWVALUE(count); - SHOWVALUE(size); - SHOWPOINTER(comp); - - assert( (int)count >= 0 && (int)size >= 0 ); - - if(count > 1 && size > 0) - { - char *stack[32 * 2], **sp; /* stack and stack pointer */ - char *i, *j, *limit; /* scan and limit pointers */ - char *base_pointer; /* base pointer as (char *) */ - size_t threshold; /* size of THRESHOLD elements in bytes */ - - assert( base != NULL && comp != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(base == NULL || comp == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* set up (char *) base_pointer pointer */ - base_pointer = (char *)base; - - /* init threshold */ - threshold = THRESHOLD * size; /* ZZZ problematic if (THRESHOLD * size) > 0xffffffff */ - - /* init stack pointer */ - sp = stack; - - /* pointer past end of array */ - limit = base_pointer + count * size; /* ZZZ problematic if (count * size) > 0xffffffff or (base_pointer + count * size) > 0xffffffff */ - - /* repeat until break... */ - while(TRUE) - { - /* if more than THRESHOLD elements */ - if((size_t)(limit - base_pointer) > threshold) - { - /* swap base_pointer with middle */ - SWAP((((limit - base_pointer) / size) / 2) * size + base_pointer, base_pointer, size); - - /* i scans left to right */ - i = base_pointer + size; - - /* j scans right to left */ - j = limit - size; - - /* Sedgewick's three-element sort sets things up so that - (*i) <= (*base_pointer) <= (*j); (*base_pointer) is - pivot element */ - if(COMPARE(i, j) > 0) - SWAP(i, j, size); - - if(COMPARE(base_pointer, j) > 0) - SWAP(base_pointer, j, size); - - if(COMPARE(i, base_pointer) > 0) - SWAP(i, base_pointer, size); - - /* loop until break */ - while(TRUE) - { - /* move i right until (*i) >= pivot */ - do - i += size; - while(COMPARE(i, base_pointer) < 0); - - /* move j left until (*j) <= pivot */ - do - j -= size; - while(COMPARE(j, base_pointer) > 0); - - /* break loop if pointers crossed */ - if(i > j) - break; - - /* else swap elements, keep scanning */ - SWAP(i, j, size); - } - - /* move pivot into correct place */ - SWAP(base_pointer, j, size); - - /* if left subfile larger */ - if(j - base_pointer > limit - i) - { - /* stack left subfile base_pointer and limit */ - sp[0] = base_pointer; - sp[1] = j; - - /* sort the right subfile */ - base_pointer = i; - } - else /* else right subfile larger */ - { - /* stack right subfile base_pointer and limit */ - sp[0] = i; - sp[1] = limit; - - /* sort the left subfile */ - limit = j; - } - - /* increment stack pointer */ - sp += 2; - } - else /* else subfile is small, use insertion sort */ - { - for(j = base_pointer, i = j + size; i < limit; j = i, i += size) - { - for( ; COMPARE(j, j + size) > 0; j -= size ) - { - SWAP(j, j + size, size); - if(j == base_pointer) - break; - } - } - - /* if any entries on stack pop the base_pointer and limit, - else the stack is empty and we're done */ - if(sp == stack) - break; - - sp -= 2; - - base_pointer = sp[0]; - limit = sp[1]; - } - } - } - - out: - - LEAVE(); -} diff --git a/library/stdlib_rand.c b/library/stdlib_rand.c deleted file mode 100644 index 75f05a0..0000000 --- a/library/stdlib_rand.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: stdlib_rand.c,v 1.5 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -unsigned int NOCOMMON __random_seed = 1; - -/****************************************************************************/ - -int -rand(void) -{ - int result; - - result = rand_r(&__random_seed); - - return(result); -} diff --git a/library/stdlib_rand_r.c b/library/stdlib_rand_r.c deleted file mode 100644 index 90328a8..0000000 --- a/library/stdlib_rand_r.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * $Id: stdlib_rand_r.c,v 1.1 2005-02-27 18:09:11 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -/* Parameters of a pseudo-random-number generator from Knuth's - "The Art of Computer Programming, Volume 2: Seminumerical Algorithms" - (3rd edition), pp. 185-186. */ - -#define MM 2147483647 /* a Mersenne prime */ -#define AA 48271 /* this does well in the spectral test */ -#define QQ 44488 /* (long)(MM/AA) */ -#define RR 3399 /* MM % AA; it is important that RR < QQ */ - -/****************************************************************************/ - -int -rand_r(unsigned int * seed) -{ - int X; - - X = (int)((*seed) & 0x7fffffff); - if(X == 0) - X = 1; /* NOTE: for Knuth's algorithm the seed must not be zero. */ - - X = AA * (X % QQ) - RR * (long)(X / QQ); - if(X < 0) - X += MM; - - (*seed) = (unsigned int)X; - - return(X); -} diff --git a/library/stdlib_realloc.c b/library/stdlib_realloc.c deleted file mode 100644 index d89fd04..0000000 --- a/library/stdlib_realloc.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * $Id: stdlib_realloc.c,v 1.6 2005-03-18 12:38:24 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#undef realloc - -/****************************************************************************/ - -__static void * -__realloc(void *ptr,size_t size,const char * file,int line) -{ - void * result = NULL; - - ENTER(); - - SHOWPOINTER(ptr); - SHOWVALUE(size); - - assert( (int)size >= 0 ); - - if(ptr == NULL) - { - D(("calling malloc(%ld)",size)); - - result = __malloc(size,file,line); - } - else if (size == 0) - { - D(("calling free(0x%08lx)",ptr)); - - __free(ptr,file,line); - } - else - { - struct MemoryNode * mn; - BOOL reallocate; - - assert( ptr != NULL && size > 0 ); - - /* Try to find the allocation in the list. */ - mn = __find_memory_node(ptr); - - #ifdef __MEM_DEBUG - { - /* If we managed to find the memory allocation, - * reallocate it. - */ - if(mn == NULL) - { - SHOWMSG("allocation not found"); - - kprintf("[%s] %s:%ld:Address for realloc(0x%08lx,%ld) not known.\n",__program_name,file,line,ptr,size); - - /* Apparently, the address did not qualify for - * reallocation. - */ - __set_errno(ENOMEM); - goto out; - } - } - #else - { - assert( mn != NULL ); - } - #endif /* __MEM_DEBUG */ - - if(mn == NULL || mn->mn_NeverFree) - { - SHOWMSG("cannot free this chunk"); - - __set_errno(ENOMEM); - goto out; - } - - /* Don't do anything unless the size of the allocation has really - * changed. - */ - #if defined(__MEM_DEBUG) - { - reallocate = (mn->mn_Size != size); - } - #else - { - if(size > mn->mn_Size) - { - /* Allocation size should grow. */ - reallocate = TRUE; - } - else - { - size_t rounded_allocation_size; - - /* Round the total allocation size to the operating system - * granularity. - */ - rounded_allocation_size = __get_allocation_size(size); - - assert( rounded_allocation_size >= size ); - - /* Optimization: If the block size shrinks by less than half the - * original allocation size, do not reallocate the - * block and do not copy over the contents of the old - * allocation. We also take into account that the - * actual size of the allocation is affected by a - * certain operating system imposed granularity. - */ - reallocate = (rounded_allocation_size < mn->mn_Size && rounded_allocation_size <= mn->mn_Size / 2); - } - } - #endif /* __MEM_DEBUG */ - - if(reallocate) - { - void * new_ptr; - - D(("realloc() size has changed; old=%ld, new=%ld",mn->mn_Size,size)); - - /* We allocate the new memory chunk before we - attempt to replace the old. */ - new_ptr = __malloc(size,file,line); - if(new_ptr == NULL) - { - SHOWMSG("could not reallocate memory"); - - __set_errno(ENOMEM); - goto out; - } - - /* Copy the contents of the old allocation to the new buffer. */ - if(size > mn->mn_Size) - size = mn->mn_Size; - - memmove(new_ptr,ptr,size); - - /* Free the old allocation. Since we already know which memory - node is associated with it, we don't call __free() here. */ - __free_memory_node(mn,file,line); - - result = new_ptr; - } - else - { - D(("size didn't actually change that much (%ld -> %ld); returning memory block as is.",mn->mn_Size,size)); - - /* No change in size. */ - result = ptr; - } - } - - out: - - if(result == NULL) - SHOWMSG("ouch! realloc failed"); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -void * -realloc(void *ptr,size_t size) -{ - void * result; - - result = __realloc(ptr,size,NULL,0); - - return(result); -} diff --git a/library/stdlib_red_black.c b/library/stdlib_red_black.c deleted file mode 100644 index a2f114b..0000000 --- a/library/stdlib_red_black.c +++ /dev/null @@ -1,424 +0,0 @@ -/* - * $Id: stdlib_red_black.c,v 1.5 2005-03-20 11:18:06 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#if defined(__USE_MEM_TREES) && defined(__MEM_DEBUG) - -/****************************************************************************/ - -/* Red-Black Tree 'C' code adapted from Emin Martinian's implementation - (see ) */ - -/****************************************************************************/ - -STATIC VOID -help_insertion (struct MemoryTree * tree, struct MemoryNode * z) -{ - struct MemoryNode *nil = &tree->mt_NullNode; - struct MemoryNode *x; - struct MemoryNode *y; - - z->mn_Left = z->mn_Right = nil; - - y = tree->mt_Root; - x = tree->mt_Root->mn_Left; - - while (x != nil) - { - y = x; - - if (x->mn_Allocation > z->mn_Allocation) - x = x->mn_Left; - else - x = x->mn_Right; - } - - z->mn_Parent = y; - - if (y == tree->mt_Root || y->mn_Allocation > z->mn_Allocation) - y->mn_Left = z; - else - y->mn_Right = z; -} - -STATIC VOID -rotate_left (struct MemoryTree * tree, struct MemoryNode * x) -{ - struct MemoryNode *nil = &tree->mt_NullNode; - struct MemoryNode *y; - - y = x->mn_Right; - x->mn_Right = y->mn_Left; - - if (y->mn_Left != nil) - y->mn_Left->mn_Parent = x; - - y->mn_Parent = x->mn_Parent; - - if (x == x->mn_Parent->mn_Left) - x->mn_Parent->mn_Left = y; - else - x->mn_Parent->mn_Right = y; - - y->mn_Left = x; - x->mn_Parent = y; -} - -STATIC VOID -rotate_right (struct MemoryTree * tree, struct MemoryNode * y) -{ - struct MemoryNode *nil = &tree->mt_NullNode; - struct MemoryNode *x; - - x = y->mn_Left; - y->mn_Left = x->mn_Right; - - if (nil != x->mn_Right) - x->mn_Right->mn_Parent = y; - - x->mn_Parent = y->mn_Parent; - - if (y == y->mn_Parent->mn_Left) - y->mn_Parent->mn_Left = x; - else - y->mn_Parent->mn_Right = x; - - x->mn_Right = y; - y->mn_Parent = x; -} - -/****************************************************************************/ - -STATIC struct MemoryNode * -get_successor (struct MemoryTree * tree, struct MemoryNode * x) -{ - struct MemoryNode *nil = &tree->mt_NullNode; - struct MemoryNode *root = tree->mt_Root; - struct MemoryNode *result; - struct MemoryNode *y; - - if (nil != (y = x->mn_Right)) - { - while (y->mn_Left != nil) - y = y->mn_Left; - - result = y; - } - else - { - y = x->mn_Parent; - - while (x == y->mn_Right) - { - x = y; - y = y->mn_Parent; - } - - if (y == root) - result = nil; - else - result = y; - } - - return (result); -} - -STATIC VOID -remove_fixup (struct MemoryTree * tree, struct MemoryNode * x) -{ - struct MemoryNode *root = tree->mt_Root->mn_Left; - struct MemoryNode *w; - - while (NOT x->mn_IsRed && root != x) - { - if (x == x->mn_Parent->mn_Left) - { - w = x->mn_Parent->mn_Right; - - if (w->mn_IsRed) - { - w->mn_IsRed = FALSE; - x->mn_Parent->mn_IsRed = TRUE; - - rotate_left (tree, x->mn_Parent); - - w = x->mn_Parent->mn_Right; - } - - if (NOT w->mn_Right->mn_IsRed && NOT w->mn_Left->mn_IsRed) - { - w->mn_IsRed = TRUE; - - x = x->mn_Parent; - } - else - { - if (NOT w->mn_Right->mn_IsRed) - { - w->mn_Left->mn_IsRed = FALSE; - w->mn_IsRed = TRUE; - - rotate_right (tree, w); - - w = x->mn_Parent->mn_Right; - } - - w->mn_IsRed = x->mn_Parent->mn_IsRed; - x->mn_Parent->mn_IsRed = FALSE; - w->mn_Right->mn_IsRed = FALSE; - - rotate_left (tree, x->mn_Parent); - - x = root; - } - } - else - { - w = x->mn_Parent->mn_Left; - - if (w->mn_IsRed) - { - w->mn_IsRed = FALSE; - x->mn_Parent->mn_IsRed = TRUE; - - rotate_right (tree, x->mn_Parent); - - w = x->mn_Parent->mn_Left; - } - - if (NOT w->mn_Right->mn_IsRed && NOT w->mn_Left->mn_IsRed) - { - w->mn_IsRed = TRUE; - - x = x->mn_Parent; - } - else - { - if (NOT w->mn_Left->mn_IsRed) - { - w->mn_Right->mn_IsRed = FALSE; - w->mn_IsRed = TRUE; - - rotate_left (tree, w); - - w = x->mn_Parent->mn_Left; - } - - w->mn_IsRed = x->mn_Parent->mn_IsRed; - x->mn_Parent->mn_IsRed = FALSE; - w->mn_Left->mn_IsRed = FALSE; - - rotate_right (tree, x->mn_Parent); - - x = root; - } - } - } - - x->mn_IsRed = FALSE; -} - -/****************************************************************************/ - -void -__initialize_red_black_tree (struct MemoryTree *new_tree) -{ - struct MemoryNode *temp; - - temp = &new_tree->mt_NullNode; - temp->mn_Parent = temp->mn_Left = temp->mn_Right = temp; - temp->mn_IsRed = FALSE; - temp->mn_Allocation = NULL; - - temp = new_tree->mt_Root = &new_tree->mt_RootNode; - temp->mn_Parent = temp->mn_Left = temp->mn_Right = &new_tree->mt_NullNode; - temp->mn_IsRed = FALSE; - temp->mn_Allocation = NULL; -} - -/****************************************************************************/ - -void -__red_black_tree_insert (struct MemoryTree * tree, struct MemoryNode *x) -{ - struct MemoryNode *y; - - help_insertion (tree, x); - - x->mn_IsRed = TRUE; - - while (x->mn_Parent->mn_IsRed) - { - if (x->mn_Parent == x->mn_Parent->mn_Parent->mn_Left) - { - y = x->mn_Parent->mn_Parent->mn_Right; - - if (y->mn_IsRed) - { - x->mn_Parent->mn_IsRed = FALSE; - y->mn_IsRed = FALSE; - x->mn_Parent->mn_Parent->mn_IsRed = TRUE; - x = x->mn_Parent->mn_Parent; - } - else - { - if (x == x->mn_Parent->mn_Right) - { - x = x->mn_Parent; - - rotate_left (tree, x); - } - - x->mn_Parent->mn_IsRed = FALSE; - x->mn_Parent->mn_Parent->mn_IsRed = TRUE; - - rotate_right (tree, x->mn_Parent->mn_Parent); - } - } - else - { - y = x->mn_Parent->mn_Parent->mn_Left; - - if (y->mn_IsRed) - { - x->mn_Parent->mn_IsRed = FALSE; - y->mn_IsRed = FALSE; - x->mn_Parent->mn_Parent->mn_IsRed = TRUE; - x = x->mn_Parent->mn_Parent; - } - else - { - if (x == x->mn_Parent->mn_Left) - { - x = x->mn_Parent; - - rotate_right (tree, x); - } - - x->mn_Parent->mn_IsRed = FALSE; - x->mn_Parent->mn_Parent->mn_IsRed = TRUE; - - rotate_left (tree, x->mn_Parent->mn_Parent); - } - } - } - - tree->mt_Root->mn_Left->mn_IsRed = FALSE; -} - -/****************************************************************************/ - -struct MemoryNode * -__red_black_tree_find(struct MemoryTree * tree,void * allocation) -{ - struct MemoryNode * x = tree->mt_Root->mn_Left; - struct MemoryNode * nil = &tree->mt_NullNode; - struct MemoryNode * result = NULL; - - while(x != nil) - { - if(x->mn_Allocation > allocation) - { - x = x->mn_Left; - } - else if (x->mn_Allocation < allocation) - { - x = x->mn_Right; - } - else - { - result = x; - break; - } - } - - return(result); -} - -/****************************************************************************/ - -void -__red_black_tree_remove (struct MemoryTree * tree, struct MemoryNode * z) -{ - struct MemoryNode *nil = &tree->mt_NullNode; - struct MemoryNode *root = tree->mt_Root; - struct MemoryNode *y; - struct MemoryNode *x; - - y = (z->mn_Left == nil || z->mn_Right == nil) ? z : get_successor (tree, z); - x = (y->mn_Left == nil) ? y->mn_Right : y->mn_Left; - - if (root == (x->mn_Parent = y->mn_Parent)) - { - root->mn_Left = x; - } - else - { - if (y == y->mn_Parent->mn_Left) - y->mn_Parent->mn_Left = x; - else - y->mn_Parent->mn_Right = x; - } - - if (NOT y->mn_IsRed) - remove_fixup (tree, x); - - if (y != z) - { - y->mn_Left = z->mn_Left; - y->mn_Right = z->mn_Right; - y->mn_Parent = z->mn_Parent; - y->mn_IsRed = z->mn_IsRed; - z->mn_Left->mn_Parent = z->mn_Right->mn_Parent = y; - - if (z == z->mn_Parent->mn_Left) - z->mn_Parent->mn_Left = y; - else - z->mn_Parent->mn_Right = y; - } -} - -/****************************************************************************/ - -#endif /* __USE_MEM_TREES && __MEM_DEBUG */ diff --git a/library/stdlib_semaphore.c b/library/stdlib_semaphore.c deleted file mode 100644 index c56485d..0000000 --- a/library/stdlib_semaphore.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * $Id: stdlib_semaphore.c,v 1.1 2005-03-03 14:20:55 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 "stdlib_headers.h" - -/****************************************************************************/ - -struct SignalSemaphore * -__create_semaphore(void) -{ - struct SignalSemaphore * semaphore; - - #if defined(__amigaos4__) - { - semaphore = AllocSysObject(ASOT_SEMAPHORE,NULL); - } - #else - { - semaphore = AllocVec(sizeof(*semaphore),MEMF_ANY|MEMF_PUBLIC); - if(semaphore != NULL) - InitSemaphore(semaphore); - } - #endif /* __amigaos4 */ - - return(semaphore); -} - -/****************************************************************************/ - -void -__delete_semaphore(struct SignalSemaphore * semaphore) -{ - if(semaphore != NULL) - { - #if defined(__amigaos4__) - { - FreeSysObject(ASOT_SEMAPHORE,semaphore); - } - #else - { - assert( semaphore->ss_Owner == NULL ); - - #if defined(DEBUG) - { - /* Just in case somebody tries to reuse this data - structure; this should produce an alert if - attempted. */ - memset(semaphore,0,sizeof(*semaphore)); - } - #endif /* DEBUG */ - - FreeVec(semaphore); - } - #endif /* __amigaos4 */ - } -} diff --git a/library/stdlib_set_errno.c b/library/stdlib_set_errno.c deleted file mode 100644 index 9170daa..0000000 --- a/library/stdlib_set_errno.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: stdlib_set_errno.c,v 1.1 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -void -__set_errno(int new_errno) -{ - errno = new_errno; -} diff --git a/library/stdlib_set_process_window.c b/library/stdlib_set_process_window.c deleted file mode 100644 index e93ac21..0000000 --- a/library/stdlib_set_process_window.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * $Id: stdlib_set_process_window.c,v 1.2 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -APTR -__set_process_window(APTR new_window_pointer) -{ - APTR result; - - #if defined(__amigaos4__) - { - result = SetProcWindow(new_window_pointer); - } - #else - { - struct Process * this_process = (struct Process *)FindTask(NULL); - - result = this_process->pr_WindowPtr; - - this_process->pr_WindowPtr = new_window_pointer; - } - #endif /* __amigaos4__ */ - - return(result); -} diff --git a/library/stdlib_setenv.c b/library/stdlib_setenv.c deleted file mode 100644 index e65ae0d..0000000 --- a/library/stdlib_setenv.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * $Id: stdlib_setenv.c,v 1.9 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -struct LocalVariable -{ - struct LocalVariable * lv_Next; - char * lv_Name; -}; - -/****************************************************************************/ - -static struct LocalVariable * __lv_root; - -/****************************************************************************/ - -CLIB_DESTRUCTOR(__setenv_exit) -{ - ENTER(); - - /* Now for the local variables that may still be set. */ - if(__lv_root != NULL) - { - do - { - D(("deleting variable '%s'",__lv_root->lv_Name)); - - DeleteVar(__lv_root->lv_Name,0); - } - while((__lv_root = __lv_root->lv_Next) != NULL); - } - - LEAVE(); -} - -/****************************************************************************/ - -int -setenv(const char *original_name, const char *original_value, int overwrite) -{ - char * name = (char *)original_name; - char * value = (char *)original_value; - char * name_copy = NULL; - struct LocalVariable * lv = NULL; - struct LocalVar * found; - int status; - int result = ERROR; - size_t i; - - ENTER(); - - SHOWSTRING(original_name); - SHOWSTRING(original_value); - SHOWVALUE(overwrite); - - assert(original_name != NULL || original_value != NULL); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(original_name == NULL && original_value == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(name != NULL) - { - for(i = 0 ; i < strlen(name) ; i++) - { - if(name[i] == '=') - { - name_copy = malloc(i+1); - if(name_copy == NULL) - { - SHOWMSG("could not create copy of name"); - goto out; - } - - memmove(name_copy,name,i); - name_copy[i] = '\0'; - - value = &name[i+1]; - name = name_copy; - break; - } - } - } - else if (value != NULL) /* && name == NULL */ - { - for(i = 0 ; i < strlen(value) ; i++) - { - if(value[i] == '=') - { - name_copy = malloc(i+1); - if(name_copy == NULL) - { - SHOWMSG("could not create copy of name"); - goto out; - } - - memmove(name_copy,value,i); - name_copy[i] = '\0'; - - name = name_copy; - value = &value[i+1]; - break; - } - } - } - - if(name == NULL || name[0] == '\0' || value == NULL) - { - SHOWMSG("invalid name"); - - __set_errno(EINVAL); - goto out; - } - - if(NOT overwrite) - { - char buffer[10]; - - PROFILE_OFF(); - status = GetVar(name,buffer,sizeof(buffer),0); - PROFILE_ON(); - - if(status != -1) - { - SHOWMSG("variable already exists; leaving..."); - - result = OK; - goto out; - } - } - - PROFILE_OFF(); - found = FindVar(name,0); - PROFILE_ON(); - - if(found == NULL) - { - SHOWMSG("the local variable is not yet set; remembering that"); - - lv = malloc(sizeof(*lv) + strlen(name)+1); - if(lv == NULL) - { - SHOWMSG("not enough memory to remember local variable to be deleted"); - goto out; - } - - lv->lv_Next = __lv_root; - __lv_root = lv; - - lv->lv_Name = (char *)(lv+1); - strcpy(lv->lv_Name,name); - } - - if(value == NULL) - value = ""; - - SHOWSTRING(name); - SHOWSTRING(value); - - PROFILE_OFF(); - status = SetVar(name,value,(LONG)strlen(value),0); - PROFILE_ON(); - - if(status == DOSFALSE) - { - SHOWMSG("could not set variable"); - - if(lv != NULL) - { - __lv_root = lv->lv_Next; - free(lv); - } - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - result = OK; - - out: - - if(name_copy != NULL) - free(name_copy); - - RETURN(result); - return(result); -} diff --git a/library/stdlib_setjmp.asm b/library/stdlib_setjmp.asm deleted file mode 100644 index 8cfb2e8..0000000 --- a/library/stdlib_setjmp.asm +++ /dev/null @@ -1,98 +0,0 @@ -* -* $Id: stdlib_setjmp.asm,v 1.2 2005-01-02 09:07:18 obarthel Exp $ -* -* :ts=8 -* -* Portable ISO 'C' (1994) runtime library for the Amiga computer -* Copyright (c) 2002-2005 by Olaf Barthel -* 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 "stdlib_setjmp.i" - -****************************************************************************** - - section text,code - -****************************************************************************** - - xref _SysBase - -****************************************************************************** - - xdef @setjmp - xdef _setjmp - -@setjmp: - move.l a0,-(sp) ; "save" A0 - bra.b l1 ; we don't need to load A0 from the stack - -_setjmp: - move.l a0,-(sp) ; save A0 - move.l 8(sp),a0 ; (struct __jmp_buf *) env - -l1 move.l 4(sp),JB_RETURNADDRESS(a0) ; remember the return address - movem.l d1-d7/a0-a6,JB_D1(a0) ; save all registers, except for D0 and A7 - move.l (sp)+,JB_A0(a0) ; put the old A0 where it belongs - move.l sp,JB_A7(a0) ; put the old A7 where it belongs - - move.l _SysBase,a1 - btst #AFB_68881,AttnFlags+1(a1) ; is there an FPU installed? - beq.b l2 ; skip the following if not - - fmovem.x fp0-fp7,JB_FP0(a0) ; save all floating point registers - -l2 moveq #0,d0 ; always return 0 - rts - -****************************************************************************** - - xdef _longjmp - xdef @longjmp - -_longjmp: - move.l 4(sp),a0 ; (struct __jmp_buf *) env - move.l 8(sp),d0 ; (int) status -@longjmp: - tst.l d0 - bne.b l3 - moveq #1,d0 ; make sure that the result is always non-zero - -l3 move.l _SysBase,a1 - btst #AFB_68881,AttnFlags+1(a1) ; is there an FPU installed? - beq.b l4 ; skip the following if not - - fmovem.x JB_FP0(a0),fp0-fp7 - -l4 movem.l JB_D1(a0),d1-d7 ; restore all data registers - movem.l JB_A1(a0),a1-a7 ; restore almost all address registers, except for A0 - move.l JB_RETURNADDRESS(a0),(sp) ; fix up the return address - move.l JB_A0(a0),a0 ; restore A0 - rts ; and return to the address SetJump() was called from - -****************************************************************************** - - end diff --git a/library/stdlib_setjmp.c b/library/stdlib_setjmp.c deleted file mode 100644 index dec46bd..0000000 --- a/library/stdlib_setjmp.c +++ /dev/null @@ -1,414 +0,0 @@ -/* - * $Id: stdlib_setjmp.c,v 1.3 2005-01-02 09:07:18 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -#if defined(__mc68020__) - -/****************************************************************************/ - -asm(" \n\ - \n\ -AFB_68881 = 4 \n\ -AttnFlags = 297 \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl _setjmp \n\ - \n\ -_setjmp: \n\ - \n\ - movel a0,sp@- | save A0 \n\ - moveal sp@(8),a0 | (struct __jmp_buf *) env \n\ - movel sp@(4),a0@ | remember the return address \n\ - moveml d1-a6,a0@(4:W) | save all registers, except for D0 and A7 \n\ - movel sp@+,a0@(32:W) | put the old A0 where it belongs \n\ - movel sp,a0@(60:W) | put the old A7 where it belongs \n\ - \n\ - moveal "A4(_SysBase)",a1 \n\ - btst #AFB_68881,a1@(AttnFlags:W) | is there an FPU installed? \n\ - beq l0 | skip the following if not \n\ - \n\ - fmovemx fp0-fp7,a0@(64:W) | save all floating point registers \n\ - \n\ -l0: moveq #0,d0 | always return 0 \n\ - rts \n\ - \n\ -"); - -/****************************************************************************/ - -#if defined(STACK_EXTENSION) - -/****************************************************************************/ - -asm(" \n\ - \n\ -AFB_68881 = 4 \n\ -AttnFlags = 297 \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl _longjmp \n\ - .globl ___stkrst \n\ - \n\ -_longjmp: \n\ - \n\ - moveal sp@(4),a0 | (struct __jmp_buf *) env \n\ - movel sp@(8),d2 | (int) status \n\ - \n\ - tstl d2 \n\ - bne l1 | skip the following if result is non-zero \n\ - \n\ - moveq #1,d2 | make sure that the result is always non-zero \n\ - \n\ -l1: movel a0@(60:W),d0 | get the stack pointer address to restore \n\ - jbsr ___stkrst | restore the stack frame \n\ - movel d2,d0 | get the return code back \n\ - \n\ - moveal "A4(_SysBase)",a1 \n\ - btst #AFB_68881,a1@(AttnFlags:W) | is there an FPU installed? \n\ - beq l2 | skip the following if not \n\ - \n\ - fmovemx a0@(64:W),fp0-fp7 | restore all floating point registers \n\ - \n\ -l2: moveml a0@(4:W),d1-d7 | restore all data registers \n\ - moveml a0@(36:W),a1-a7 | restore almost all address registers, except for A0 \n\ - movel a0@,sp@ | restore A0 \n\ - moveal a0@(32:W),a0 | and return to the address setjmp() was called from \n\ - rts \n\ - \n\ -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -asm(" \n\ - \n\ -AFB_68881 = 4 \n\ -AttnFlags = 297 \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl _longjmp \n\ - \n\ -_longjmp: \n\ - \n\ - moveal sp@(4),a0 | (struct __jmp_buf *) env \n\ - movel sp@(8),d0 | (int) status \n\ - \n\ - tstl d0 \n\ - bne l1 | skip the following if result is non-zero\n\ - \n\ - moveq #1,d0 | make sure that the result is always non-zero\n\ - \n\ -l1: moveal "A4(_SysBase)",a1 \n\ - btst #AFB_68881,a1@(AttnFlags:W) | is there an FPU installed? \n\ - beq l2 | skip the following if not \n\ - \n\ - fmovemx a0@(64:W),fp0-fp7 | restore all floating point registers \n\ - \n\ -l2: moveml a0@(4:W),d1-d7 | restore all data registers \n\ - moveml a0@(36:W),a1-a7 | restore almost all address registers, except for A0\n\ - movel a0@,sp@ | restore A0 \n\ - moveal a0@(32:W),a0 | and return to the address setjmp() was called from\n\ - rts \n\ - \n\ -"); - -/****************************************************************************/ - -#endif /* STACK_EXTENSION */ - -/****************************************************************************/ - -#elif defined(__mc68000__) - -/****************************************************************************/ - -asm(" \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl _setjmp \n\ - \n\ -_setjmp: \n\ - \n\ - movel a0,sp@- | save A0 \n\ - moveal sp@(8),a0 | (struct __jmp_buf *) env \n\ - movel sp@(4),a0@ | remember the return address \n\ - moveml d1-a6,a0@(4:W) | save all registers, except for D0 and A7\n\ - movel sp@+,a0@(32:W) | put the old A0 where it belongs \n\ - movel sp,a0@(60:W) | put the old A7 where it belongs \n\ - moveq #0,d0 | always return 0 \n\ - rts \n\ - \n\ -"); - -/****************************************************************************/ - -#if defined(STACK_EXTENSION) - -/****************************************************************************/ - -asm(" \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl _longjmp \n\ - .globl ___stkrst \n\ - \n\ -_longjmp: \n\ - \n\ - moveal sp@(4),a0 | (struct __jmp_buf *) env \n\ - movel sp@(8),d2 | (int) status \n\ - \n\ - tstl d2 \n\ - bne l1 | skip the following if result is non-zero\n\ - \n\ - moveq #1,d2 | make sure that the result is always non-zero\n\ - \n\ -l1: movel a0@(60:W),d0 | get the stack pointer address to restore\n\ - jbsr ___stkrst | restore the stack frame \n\ - movel d2,d0 | get the return code back \n\ - \n\ - moveml a0@(4:W),d1-d7 | restore all data registers \n\ - moveml a0@(36:W),a1-a7 | restore almost all address registers, except for A0\n\ - movel a0@,sp@ | restore A0 \n\ - moveal a0@(32:W),a0 | and return to the address setjmp() was called from\n\ - rts \n\ - \n\ -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -asm(" \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl _longjmp \n\ - \n\ -_longjmp: \n\ - \n\ - moveal sp@(4),a0 | (struct __jmp_buf *) env \n\ - movel sp@(8),d0 | (int) status \n\ - \n\ - tstl d0 \n\ - bne l1 | skip the following if result is non-zero\n\ - \n\ - moveq #1,d0 | make sure that the result is always non-zero\n\ - \n\ -l1: moveml a0@(4:W),d1-d7 | restore all data registers \n\ - moveml a0@(36:W),a1-a7 | restore almost all address registers, except for A0\n\ - movel a0@,sp@ | restore A0 \n\ - moveal a0@(32:W),a0 | and return to the address setjmp() was called from\n\ - rts \n\ - \n\ -"); - -/****************************************************************************/ - -#endif /* STACK_EXTENSION */ - -/****************************************************************************/ - -#elif defined(__PPC__) - -/****************************************************************************/ - -#if defined(STACK_EXTENSION) - -/****************************************************************************/ - -#error "STACK_EXTENSION is not supported on the PowerPC" - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#ifdef PPC_FLOATING_POINT_SUPPORT - -__asm(" \n\ - \n\ - .text \n\ - .align 2 \n\ - \n\ - .globl setjmp \n\ - \n\ -setjmp: \n\ - \n\ - mflr r10 \n\ - mfcr r11 \n\ - mr r12, r1 \n\ - stmw r10, 0(r3) \n\ - stfd f14, 88(r3) \n\ - stfd f15, 96(r3) \n\ - stfd f16, 104(r3) \n\ - stfd f17, 112(r3) \n\ - stfd f18, 120(r3) \n\ - stfd f19, 128(r3) \n\ - stfd f20, 136(r3) \n\ - stfd f21, 144(r3) \n\ - stfd f22, 152(r3) \n\ - stfd f23, 160(r3) \n\ - stfd f24, 168(r3) \n\ - stfd f25, 176(r3) \n\ - stfd f26, 184(r3) \n\ - stfd f27, 192(r3) \n\ - stfd f28, 200(r3) \n\ - stfd f29, 208(r3) \n\ - stfd f30, 216(r3) \n\ - stfd f31, 224(r3) \n\ - li r3, 0 \n\ - blr \n\ - \n\ -"); - -__asm(" \n\ - .text \n\ - .align 2 \n\ - \n\ - .globl longjmp \n\ - \n\ -longjmp: \n\ - \n\ - lmw r10,0(r3) \n\ - mtlr r10 \n\ - mtcr r11 \n\ - mr r1,r12 \n\ - lfd f14, 88(r3) \n\ - lfd f15, 96(r3) \n\ - lfd f16, 104(r3) \n\ - lfd f17, 112(r3) \n\ - lfd f18, 120(r3) \n\ - lfd f19, 128(r3) \n\ - lfd f20, 136(r3) \n\ - lfd f21, 144(r3) \n\ - lfd f22, 152(r3) \n\ - lfd f23, 160(r3) \n\ - lfd f24, 168(r3) \n\ - lfd f25, 176(r3) \n\ - lfd f26, 184(r3) \n\ - lfd f27, 192(r3) \n\ - lfd f28, 200(r3) \n\ - lfd f29, 208(r3) \n\ - lfd f30, 216(r3) \n\ - lfd f31, 224(r3) \n\ - cmpwi r4, 0 \n\ - bne 1f \n\ - li r3,1 \n\ - blr \n\ -1: \n\ - mr r3, r4 \n\ - blr \n\ - \n\ -"); -#else -__asm(" \n\ - \n\ - .text \n\ - .align 2 \n\ - \n\ - .globl setjmp \n\ - \n\ -setjmp: \n\ - \n\ - mflr r10 \n\ - mfcr r11 \n\ - mr r12, r1 \n\ - stmw r10, 0(r3) \n\ - li r3, 0 \n\ - blr \n\ - \n\ -"); - -__asm(" \n\ - .text \n\ - .align 2 \n\ - \n\ - .globl longjmp \n\ - \n\ -longjmp: \n\ - \n\ - lmw r10,0(r3) \n\ - mtlr r10 \n\ - mtcr r11 \n\ - mr r1,r12 \n\ - cmpwi r4, 0 \n\ - bne 1f \n\ - li r3,1 \n\ - blr \n\ -1: \n\ - mr r3, r4 \n\ - blr \n\ - \n\ -"); - -#endif /* defined PPC_FLOATING_POINT_SUPPORT */ - -#endif /* defined STACK_EXTENSION */ - -/****************************************************************************/ - -#endif /* PPC */ - -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_setjmp.i b/library/stdlib_setjmp.i deleted file mode 100644 index 15c0937..0000000 --- a/library/stdlib_setjmp.i +++ /dev/null @@ -1,70 +0,0 @@ -* -* $Id: stdlib_setjmp.i,v 1.2 2005-01-02 09:07:18 obarthel Exp $ -* -* :ts=8 -* -* Portable ISO 'C' (1994) runtime library for the Amiga computer -* Copyright (c) 2002-2005 by Olaf Barthel -* 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.i" - include "exec/execbase.i" - -****************************************************************************** - - STRUCTURE FPR,0 - LONG FPR_0 - LONG FPR_1 - LONG FPR_2 - LABEL FPR_SIZE - - STRUCTURE JB,0 - APTR JB_RETURNADDRESS - LONG JB_D1 - LONG JB_D2 - LONG JB_D3 - LONG JB_D4 - LONG JB_D5 - LONG JB_D6 - LONG JB_D7 - APTR JB_A0 - APTR JB_A1 - APTR JB_A2 - APTR JB_A3 - APTR JB_A4 - APTR JB_A5 - APTR JB_A6 - APTR JB_A7 - STRUCT JB_FP0,FPR_SIZE - STRUCT JB_FP1,FPR_SIZE - STRUCT JB_FP2,FPR_SIZE - STRUCT JB_FP3,FPR_SIZE - STRUCT JB_FP4,FPR_SIZE - STRUCT JB_FP5,FPR_SIZE - STRUCT JB_FP6,FPR_SIZE - STRUCT JB_FP7,FPR_SIZE - LABEL JB_SIZE diff --git a/library/stdlib_shell_escape.c b/library/stdlib_shell_escape.c deleted file mode 100644 index a7228d6..0000000 --- a/library/stdlib_shell_escape.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * $Id: stdlib_shell_escape.c,v 1.4 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_GCC_HELP_H -#include "stdlib_gcc_help.h" -#endif /* _STDLIB_GCC_HELP_H */ - -/****************************************************************************/ - -#ifndef EXEC_TYPES_H -#include -#endif /* EXEC_TYPES_H */ - -/****************************************************************************/ - -#include "macros.h" - -/****************************************************************************/ - -/* Quick "hack" to help GCC compile itself */ -#if defined(GCC_HELP_SUPPORT) - -/******************************************************************************/ - -UBYTE NOCOMMON __shell_escape_character = '\\'; - -/******************************************************************************/ - -#else - -/******************************************************************************/ - -UBYTE NOCOMMON __shell_escape_character = '*'; - -/******************************************************************************/ - -#endif /* GCC_HELP_SUPPORT */ diff --git a/library/stdlib_showerror.c b/library/stdlib_showerror.c deleted file mode 100644 index de24c8e..0000000 --- a/library/stdlib_showerror.c +++ /dev/null @@ -1,265 +0,0 @@ -/* - * $Id: stdlib_showerror.c,v 1.12 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 EXEC_LIBRARIES_H -#include -#endif /* EXEC_LIBRARIES_H */ - -#ifndef INTUITION_INTUITION_H -#include -#endif /* INTUITION_INTUITION_H */ - -#ifndef DOS_DOS_H -#include -#endif /* DOS_DOS_H */ - -#ifndef WORKBENCH_STARTUP_H -#include -#endif /* WORKBENCH_STARTUP_H */ - -/****************************************************************************/ - -#ifndef PROTO_EXEC_H -#include -#endif /* PROTO_EXEC_H */ - -#define __NOLIBBASE__ -#define __NOGLOBALIFACE__ - -#ifndef PROTO_INTUITION_H -#include -#endif /* PROTO_INTUITION_H */ - -#ifndef PROTO_DOS_H -#include -#endif /* PROTO_DOS_H */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#if NOT defined(__amigaos4__) - -/****************************************************************************/ - -/* We use these short local versions of strlen() and bzero() so that this - module does not need to depend upon other library code which, so it happens, - might be built for the "wrong" CPU type. This is not a problem for the - PowerPC build, but it is for the 68k build. */ - -/****************************************************************************/ - -INLINE STATIC size_t -local_strlen(const char *s) -{ - const char * start = s; - size_t result = 0; - - while((*s) != '\0') - s++; - - result = (size_t)(s - start); - - return(result); -} - -/****************************************************************************/ - -INLINE STATIC void -local_bzero(void *ptr, size_t len) -{ - unsigned char * m = ptr; - - while(len-- > 0) - (*m++) = 0; -} - -/****************************************************************************/ - -#define strlen(s) local_strlen(s) -#define memset(ptr,val,len) local_bzero((ptr),(len)) - -/****************************************************************************/ - -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -void -__show_error(const char * message) -{ - #if defined(__amigaos4__) - struct IntuitionIFace * IIntuition = NULL; - struct DOSIFace * IDOS = NULL; - #endif /* __amigaos4__ */ - - struct Library * IntuitionBase = NULL; - struct Library * DOSBase = NULL; - - PROFILE_OFF(); - - /* Don't show anything if this is the thread-safe library and - we were invoked indirectly by shared library startup code. */ - #if defined(__THREAD_SAFE) - { - if(__lib_startup) - goto out; - } - #endif /* __THREAD_SAFE */ - - DOSBase = OpenLibrary("dos.library",0); - IntuitionBase = OpenLibrary("intuition.library",0); - - if(DOSBase == NULL || IntuitionBase == NULL) - goto out; - - #if defined(__amigaos4__) - { - IDOS = (struct DOSIFace *)GetInterface(DOSBase, "main", 1, 0); - if (IDOS == NULL) - goto out; - - IIntuition = (struct IntuitionIFace *)GetInterface(IntuitionBase, "main", 1, 0); - if (IIntuition == NULL) - goto out; - } - #endif /* __amigaos4__ */ - - /* If we can't hope to print the error message, show a requester instead. */ - if(__no_standard_io || __WBenchMsg != NULL) - { - UBYTE program_name[256]; - struct EasyStruct es; - STRPTR title_string; - - /* The following does not make great sense on OS4. */ - #if NOT defined(__amigaos4__) - { - if(IntuitionBase->lib_Version < 37) - { - static struct TextAttr default_font = { (STRPTR)"topaz.font",8,FS_NORMAL,FPF_ROMFONT|FPF_DESIGNED }; - static struct IntuiText sorry_text = {0,1,JAM1,6,3,(struct TextAttr *)NULL,(STRPTR)"Sorry",(struct IntuiText *)NULL}; - static struct IntuiText body_text = {0,1,JAM1,5,3,(struct TextAttr *)NULL,(STRPTR)NULL,(struct IntuiText *)NULL}; - - sorry_text.ITextFont = &default_font; - body_text.ITextFont = &default_font; - - body_text.IText = (STRPTR)message; - - AutoRequest(NULL,&body_text,NULL,&sorry_text,0,0,37 + 8 * strlen(message),46); - - goto out; - } - } - #endif /* __amigaos4__ */ - - if(__WBenchMsg != NULL) - { - title_string = (STRPTR)FilePart(__WBenchMsg->sm_ArgList[0].wa_Name); - } - else - { - if(GetProgramName(program_name,sizeof(program_name))) - title_string = FilePart((STRPTR)program_name); - else - title_string = (STRPTR)"Error"; - } - - memset(&es,0,sizeof(es)); - - es.es_StructSize = sizeof(es); - es.es_Title = title_string; - es.es_TextFormat = (STRPTR)message; - es.es_GadgetFormat = (STRPTR)"Sorry"; - - EasyRequestArgs(NULL,&es,NULL,NULL); - } - else - { - BPTR output; - - #if defined(__amigaos4__) - { - /* Try to print the error message on the default error output stream. */ - output = ErrorOutput(); - } - #else - { - struct Process * this_process = (struct Process *)FindTask(NULL); - - output = this_process->pr_CES; - } - #endif /* __amigaos4__ */ - - if(output == ZERO) - output = Output(); - - if(output != ZERO) - { - Write(output,(STRPTR)message,(LONG)strlen(message)); - Write(output,"\n",1); - } - } - - out: - - #if defined(__amigaos4__) - { - if(IIntuition != NULL) - DropInterface((struct Interface *)IIntuition); - - if(IDOS != NULL) - DropInterface((struct Interface *)IDOS); - } - #endif /* __amigaos4__ */ - - if (IntuitionBase != NULL) - CloseLibrary(IntuitionBase); - - if (DOSBase != NULL) - CloseLibrary(DOSBase); - - PROFILE_ON(); -} diff --git a/library/stdlib_srand.c b/library/stdlib_srand.c deleted file mode 100644 index e14bfc5..0000000 --- a/library/stdlib_srand.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: stdlib_srand.c,v 1.3 2005-02-27 18:09:11 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -void -srand(unsigned seed) -{ - __random_seed = seed; -} diff --git a/library/stdlib_stack_usage.c b/library/stdlib_stack_usage.c deleted file mode 100644 index 472e517..0000000 --- a/library/stdlib_stack_usage.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * $Id: stdlib_stack_usage.c,v 1.6 2005-04-24 14:04:36 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 NDEBUG - -/****************************************************************************/ - -#include "stdlib_headers.h" - -/****************************************************************************/ - -static struct StackSwapStruct stack_swap_struct; - -/****************************************************************************/ - -ULONG __stk_extensions; /* number of stack extensions performed */ -ULONG __stk_maxsize; /* maximum amount of memory allocated for stack extension */ - -/****************************************************************************/ - -#define STACK_FILL_COOKIE 0xA1 - -/****************************************************************************/ - -void -__stack_usage_init(struct StackSwapStruct * stk) -{ - if(stk != NULL) - { - size_t stack_size = ((ULONG)stk->stk_Upper - (ULONG)stk->stk_Lower); - - memset(stk->stk_Lower,STACK_FILL_COOKIE,stack_size); - - stack_swap_struct = (*stk); - } -} - -/****************************************************************************/ - -void -__stack_usage_exit(void) -{ - if(stack_swap_struct.stk_Lower != NULL && stack_swap_struct.stk_Upper != 0) - { - const UBYTE * m = (const UBYTE *)stack_swap_struct.stk_Lower; - size_t stack_size = ((ULONG)stack_swap_struct.stk_Upper - (ULONG)stack_swap_struct.stk_Lower); - size_t total,i; - - total = 0; - - /* Figure out how much of the stack was used by checking - if the fill pattern was overwritten. */ - for(i = 0 ; i < stack_size ; i++) - { - /* Strangely, the first long word is always trashed, - even if the stack doesn't grow down this far... */ - if(i > sizeof(LONG) && m[i] != STACK_FILL_COOKIE) - break; - - total++; - } - - kprintf("[%s] total amount of stack space used = %ld bytes\n", - __program_name,stack_size - total); - - stack_swap_struct.stk_Lower = NULL; - stack_swap_struct.stk_Upper = 0; - } - - if(__stk_maxsize == 0) - { - kprintf("[%s] no stack extension was performed\n", - __program_name); - } - else - { - kprintf("[%s] maximum size of extended stack = %ld bytes, stack was extended %ld times\n", - __program_name,__stk_maxsize,__stk_extensions); - } -} - -/****************************************************************************/ - -#endif /* NDEBUG */ diff --git a/library/stdlib_stackargbytes.c b/library/stdlib_stackargbytes.c deleted file mode 100644 index 68d9e32..0000000 --- a/library/stdlib_stackargbytes.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: stdlib_stackargbytes.c,v 1.3 2005-03-18 12:38:25 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 EXEC_TYPES_H -#include -#endif /* EXEC_TYPES_H */ - -/****************************************************************************/ - -ULONG __stk_argbytes = 256; diff --git a/library/stdlib_stackcheck.c b/library/stdlib_stackcheck.c deleted file mode 100644 index 04f12b9..0000000 --- a/library/stdlib_stackcheck.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * $Id: stdlib_stackcheck.c,v 1.9 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -#if (defined(__GNUC__) && !defined(__PPC__)) - -/****************************************************************************/ - -/* The stack extension code has its own set of these routines. */ -#ifndef STACK_EXTENSION - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl ___stkovf \n\ - .globl ___stk_limit \n\ - \n\ - .globl ___stkchk_d0 \n\ - \n\ -___stkchk_d0: \n\ - \n\ - negl d0 \n\ - addl sp,d0 \n\ - cmpl "A4(___stk_limit)",d0 \n\ - jcs overflow | if (sp-d0) < __stk_limit then we have an overflow\n\ - rts \n\ - \n\ - .globl ___stkchk_0 \n\ - \n\ -___stkchk_0: \n\ - \n\ - cmpl "A4(___stk_limit)",sp \n\ - jcs overflow | if sp < __stk_limit then we have an overflow\n\ - rts \n\ - \n\ -overflow: \n\ - \n\ - movel #0,"A4(___stk_limit)" | disable stack checking \n\ - jra ___stkovf \n\ - \n\ -"); - -/****************************************************************************/ - -#endif /* STACK_EXTENSION && !__PPC__ */ - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -UBYTE * NOCOMMON __stk_limit; - -/****************************************************************************/ - -#if defined(__SASC) - -UBYTE * __base; - -#endif /* __SASC */ - -/****************************************************************************/ - -STK_CONSTRUCTOR(stk_init) -{ - struct Task * this_task = FindTask(NULL); - ULONG lower = (ULONG)this_task->tc_SPLower; - - ENTER(); - - #if defined(__GNUC__) - { - __stk_limit = (UBYTE *)(lower + __stk_safezone + __stk_argbytes); - } - #endif /* __GNUC__ */ - - #if defined(__SASC) - { - __base = (UBYTE *)(lower + __stk_safezone + __stk_argbytes); - } - #endif /* __SASC */ - - LEAVE(); - - CONSTRUCTOR_SUCCEED(); -} diff --git a/library/stdlib_stackextension.c b/library/stdlib_stackextension.c deleted file mode 100644 index 617cf42..0000000 --- a/library/stdlib_stackextension.c +++ /dev/null @@ -1,649 +0,0 @@ -/* - * $Id: stdlib_stackextension.c,v 1.12 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -#if (defined(__GNUC__) && !defined(__PPC__)) - -/****************************************************************************/ - -#if defined(STACK_EXTENSION) - -/****************************************************************************/ - -/* internal structure used by the stackextend code */ -struct stackframe -{ - struct stackframe * next; /* NULL if there is no next one */ - void * savesp; /* stored sp for next underlying stackframe */ - void * upper; /* end of this stackframe+1 */ -}; - -/****************************************************************************/ - -/* Local stack extension variables */ -static void * __stk_sp_lower; /* original entries of task structure */ -static void * __stk_sp_upper; /* to restore them at exit */ -static void * __stk_initial_sp_lower; /* original stackborders */ -static void * __stk_initial_sp_upper; -static struct stackframe * __stk_used; /* used stackframes */ -static struct stackframe * __stk_spare; /* spare stackframes */ - -/****************************************************************************/ - -ULONG NOCOMMON __stk_extensions; /* number of stack extensions performed */ -ULONG NOCOMMON __stk_maxsize; /* maximum amount of memory allocated for stack extension */ - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -/* Glue code */ -asm(" - -_LVOStackSwap = -0x2dc -StackSwapStruct_SIZEOF = 12 - - .globl _SysBase - .globl ___stk_limit - -|----------------------------------------------------------------------------- - - .globl ___link_a5_0_f - -___link_a5_0_f: - - movel sp@+,a0 | load the return address into A0 - cmpl "A4(___stk_limit)",sp - jcc l0 | if SP >= __stk_limit then we are well within bounds - jbsr l2 | try to extend the stack -l0: link a5,#0:W | restore frame pointer - jmp a0@ | go to the return address - -|----------------------------------------------------------------------------- - - .globl ___sub_0_sp_f - -___sub_0_sp_f: - movel sp@+,a0 | load the return address into A0 - cmpl "A4(___stk_limit)",sp - jcc l1 | if SP >= __stk_limit then we are well within bounds - jbsr l2 | try to extend the stack -l1: jmp a0@ | go to the return address - -l2: moveq #0,d0 - moveq #0,d1 - jra ___stkext_f | try stack extension - -|----------------------------------------------------------------------------- - - .globl ___link_a5_d0_f - -___link_a5_d0_f: - movel sp@+,a0 | load the return address into A0 - movel sp,d1 - subl d0,d1 | D0 holds size of stack adjustment to make - cmpl "A4(___stk_limit)",d1 - jcc l3 | if (SP-D0) >= __stk_limit then we are well within bounds - jbsr l5 | try stack extension -l3: link a5,#0:W | restore the frame pointer - subl d0,sp | adjust the stack pointer, as required - jmp a0@ | go to the return address - -|----------------------------------------------------------------------------- - - .globl ___sub_d0_sp_f - -___sub_d0_sp_f: - movel sp@+,a0 | load the return address into A0 - movel sp,d1 - subl d0,d1 | D0 holds size of stack adjustment to make - cmpl "A4(___stk_limit)",d1 - jcc l4 | if (SP-D0) >= __stk_limit then we are well within bounds - jbsr l5 | try stack extension -l4: subl d0,sp | adjust the stack pointer, as required - jmp a0@ | go to the return address - -l5: moveq #0,d1 - jra ___stkext_f | try stack extension - -|----------------------------------------------------------------------------- - - .globl ___sub_d0_sp - -___sub_d0_sp: - movel sp@+,a0 | load the return address into A0 - movel sp,d1 - subl d0,d1 | D0 holds size of stack adjustment to make - cmpl "A4(___stk_limit)",d1 - jcc l6 | if (SP-D0) >= __stk_limit then we are well within bounds - jbsr ___stkext | try stack extension -l6: subl d0,sp | adjust the stack pointer, as required - jmp a0@ | go to the return address - -|----------------------------------------------------------------------------- - - .globl ___move_d0_sp - -___move_d0_sp: - jra ___stkrst | Straight jump into ___stkrst - -|----------------------------------------------------------------------------- - - .globl ___unlk_a5_rts - -___unlk_a5_rts: - movel d0,a0 | Preserve D0 - movel a5,d0 | A5 is stack pointer to be restored - jbsr ___stkrst - movel a0,d0 | Restore D0 - movel sp@+,a5 | Restore A5, thus performing 'unlink A5' - rts - -|----------------------------------------------------------------------------- - - .globl ___stkext - -___stkext: - moveml d0/d1/a0/a1/a6,sp@- - subw #StackSwapStruct_SIZEOF,sp - jbsr _stkext - tstl d0 - jeq s_noext - movel "A4(_SysBase)",a6 - movel sp,a0 - jsr a6@(_LVOStackSwap) -s_ret: - moveml sp@+,d0/d1/a0/a1/a6 - rts -s_noext: - addw #StackSwapStruct_SIZEOF,sp - jra s_ret - -|----------------------------------------------------------------------------- - - .globl ___stkext_f - -___stkext_f: - moveml d0/d1/a0/a1/a6,sp@- - subw #StackSwapStruct_SIZEOF,sp - jbsr _stkext_f - tstl d0 - jeq sf_noext - movel "A4(_SysBase)",a6 - movel sp,a0 - jsr a6@(_LVOStackSwap) -sf_ret: - moveml sp@+,d0/d1/a0/a1/a6 - rts -sf_noext: - addw #StackSwapStruct_SIZEOF,sp - jra sf_ret - -|----------------------------------------------------------------------------- - - .globl ___stkrst_f - -___stkrst_f: - moveml d0/d1/a0/a1/a6,sp@- - subw #StackSwapStruct_SIZEOF,sp - jbsr _stkrst_f - movel "A4(_SysBase)",a6 - movel sp,a0 - jsr a6@(_LVOStackSwap) - moveml sp@+,d0/d1/a0/a1/a6 - rts - -|----------------------------------------------------------------------------- - - .globl ___stkrst - -___stkrst: - moveml d0/d1/a0/a1/a6,sp@- - subw #StackSwapStruct_SIZEOF,sp - jbsr _stkrst | calculate either target sp or StackSwapStruct - tstl d0 | set target sp? - jeq swpfrm | jump if not - movel d0,a0 | I have a lot of preserved registers and - | returnadresses on the stack. It's necessary - | to copy them to the new location - moveq #6,d0 | 1 rts, 5 regs and 1 signal mask to copy (1+5+1)-1=6 - lea sp@(40:W),a1 | get address of uppermost byte+1 (1+5+1)*4+StackSwapStruct_SIZEOF=40 - cmpl a0,a1 | compare with target location - jls lp1 | jump if source<=target - lea a0@(-28:W),a0 | else start at lower bound (1+5+1)*4=28 - lea a1@(-28:W),a1 - movel a0,sp | set sp to reserve the room -lp0: - movel a1@+,a0@+ | copy with raising addresses - dbra d0,lp0 | as long as d0>=0. - jra endlp | ready -lp1: - movel a1@-,a0@- | copy with falling addresses - dbra d0,lp1 | as long as d0>=0 - movel a0,sp | finally set sp - jra endlp | ready -swpfrm: - movel "A4(_SysBase)",a6 - movel sp,a0 - jsr a6@(_LVOStackSwap) -endlp: - moveml sp@+,d0/d1/a0/a1/a6 | restore registers - rts | and return - -"); - -/****************************************************************************/ - -UBYTE * __stk_limit; -ULONG __stk_size; - -/****************************************************************************/ - -STK_CONSTRUCTOR(stk_init) -{ - struct Task *task = FindTask(NULL); - - ENTER(); - - __stk_initial_sp_lower = __stk_sp_lower = task->tc_SPLower; /* Lower stack bound */ - __stk_initial_sp_upper = __stk_sp_upper = task->tc_SPUpper; /* Upper stack bound +1 */ - - SHOWPOINTER(__stk_sp_lower); - SHOWPOINTER(__stk_sp_upper); - - D(("stack size = %ld",(ULONG)__stk_sp_upper - (ULONG)__stk_sp_lower)); - - LEAVE(); - - CONSTRUCTOR_SUCCEED(); -} - -/****************************************************************************/ - -/* Free all spare stackframes */ -STK_DESTRUCTOR(stk_exit) -{ - ENTER(); - - if(__memory_pool == NULL) - { - struct stackframe *sf, *sf_next; - - SHOWMSG("we don't have a memory pool; cleaning up the stack frames manually"); - - for(sf = __stk_spare ; sf != NULL ; sf = sf_next) - { - sf_next = sf->next; - - FreeMem(sf, (char *)sf->upper - (char *)sf); - } - } - - __stk_spare = NULL; - - LEAVE(); -} - -/****************************************************************************/ - -/* Move a stackframe with a minimum of requiredstack bytes to the used list - and fill the StackSwapStruct structure. */ -STATIC VOID -pushframe(ULONG requiredstack, struct StackSwapStruct *sss) -{ - struct stackframe *sf; - ULONG recommendedstack; - - ENTER(); - - requiredstack += __stk_safezone + __stk_argbytes; - if (requiredstack < __stk_minframe) - requiredstack = __stk_minframe; - - SHOWVALUE(requiredstack); - - recommendedstack = __stk_maxsize - __stk_size; - if (recommendedstack < requiredstack) - recommendedstack = requiredstack; - - SHOWVALUE(recommendedstack); - - for (;;) - { - sf = __stk_spare; /* get a stackframe from the spares list */ - if (sf == NULL) /* stack overflown */ - { - for ( ; recommendedstack >= requiredstack ; recommendedstack /= 2) - { - D(("allocating %ld bytes for a stack frame",recommendedstack + sizeof(struct stackframe))); - - if(__memory_pool != NULL) - { - __memory_lock(); - - sf = AllocPooled(__memory_pool,recommendedstack + sizeof(struct stackframe)); - - __memory_unlock(); - } - else - { - sf = AllocMem(recommendedstack + sizeof(struct stackframe), MEMF_ANY); - } - - if (sf != NULL) - break; - - SHOWMSG("that didn't work"); - } - - if (sf == NULL) /* and we have no way to extend it :-| */ - { - SHOWMSG("bad luck... stack overflow!"); - __stkovf(); - } - - sf->upper = (char *)(sf + 1) + recommendedstack; - break; - } - - __stk_spare = sf->next; - if ((ULONG)((char *)sf->upper - (char *)(sf + 1)) >= recommendedstack) - break; - - if(__memory_pool != NULL) - { - __memory_lock(); - - FreePooled(__memory_pool, sf, (char *)sf->upper - (char *)sf); - - __memory_unlock(); - } - else - { - FreeMem(sf, (char *)sf->upper - (char *)sf); - } - } - - /* Add stackframe to the used list */ - sf->next = __stk_used; - __stk_used = sf; - __stk_limit = (char *)(sf + 1) + __stk_safezone + __stk_argbytes; - - /* prepare StackSwapStruct */ - (void *)sss->stk_Pointer = (void *)sf->upper; - sss->stk_Lower = sf + 1; - (ULONG)sss->stk_Upper = (ULONG)sf->upper; - - /* Update stack statistics. */ - __stk_size += (char *)sf->upper - (char *)(sf + 1); - if (__stk_size > __stk_maxsize) - __stk_maxsize = __stk_size; - - __stk_extensions++; - - SHOWVALUE(__stk_size); - SHOWVALUE(__stk_maxsize); - SHOWVALUE(__stk_extensions); - - LEAVE(); -} - -/****************************************************************************/ - -#define STK_UPPER (__stk_used != NULL ? __stk_used->upper : __stk_initial_sp_upper) -#define STK_LOWER (__stk_used != NULL ? (void *)(__stk_used + 1) : __stk_initial_sp_lower) - -/****************************************************************************/ - -/* Allocate a new stackframe with d0 bytes minimum. */ -int -stkext(struct StackSwapStruct sss, long d0, long d1, long a0, long a1, long a6, long ret1) -{ - void *callsp = &ret1 + 1; - int cpsize = (char *)callsp - (char *)&d0; - int result; - - ENTER(); - - D(("new stack frame with at least %ld bytes space is required", d0)); - - if (callsp >= STK_UPPER || callsp < STK_LOWER) - { - SHOWMSG("that didn't turn out right"); - - result = 0; /* User intentionally left area of stackextension */ - } - else - { - pushframe((ULONG)d0, &sss); - *(char **)&sss.stk_Pointer -= cpsize; - CopyMem(&d0, sss.stk_Pointer, cpsize); - - SHOWMSG("done"); - - result = 1; - } - - RETURN (result); - return (result); -} - -/****************************************************************************/ - -/* Defined in the glue code above. */ -extern void __stkrst_f(void); - -/****************************************************************************/ - -/* Allocate a new stackframe with d0 bytes minimum, copy the callers arguments - and set his returnaddress (offset d1 from the sp when called) to stk_rst_f */ -int -stkext_f(struct StackSwapStruct sss, long d0, long d1, long a0, long a1, long a6, long ret1) -{ - void *argtop, *callsp = &ret1 + 1; - int cpsize; - int result; - - ENTER(); - - D(("new stack frame with at least %ld bytes space is required", d0)); - - if (callsp >= STK_UPPER || callsp < STK_LOWER) - { - SHOWMSG("that didn't turn out right"); - - result = 0; /* User intentionally left area of stackextension */ - } - else - { - argtop = (char *)callsp + __stk_argbytes; /* Top of area with arguments */ - if (argtop > STK_UPPER) - argtop = STK_UPPER; - - cpsize = (char *)argtop - (char *)&d0; - - pushframe((ULONG)d0, &sss); - *(char **)&sss.stk_Pointer -= cpsize; - CopyMem(&d0, sss.stk_Pointer, cpsize); - - __stk_used->savesp = (char *)callsp + d1; /* store sp */ - *(void **)((char *)sss.stk_Upper - ((char *)argtop - (char *)callsp) + d1) = &__stkrst_f; /* set returnaddress */ - - SHOWMSG("done"); - - result = 1; - } - - RETURN (result); - return (result); -} - -/****************************************************************************/ - -/* Move all used stackframes upto (and including) sf to the spares list - and fill the StackSwapStruct structure. */ -STATIC VOID -popframes(struct stackframe *sf, struct StackSwapStruct *sss) -{ - struct stackframe *sf2; - - ENTER(); - - if (sf->next != NULL) - { - sss->stk_Lower = sf->next + 1; - (ULONG)sss->stk_Upper = (ULONG)sf->next->upper; - __stk_limit = (char *)(sf->next + 1) + __stk_safezone + __stk_argbytes; - } - else - { - sss->stk_Lower = __stk_sp_lower; - (ULONG)sss->stk_Upper = (ULONG)__stk_sp_upper; - __stk_limit = (char *)__stk_initial_sp_lower + __stk_safezone + __stk_argbytes; - } - - sf2 = __stk_spare; - __stk_spare = __stk_used; - __stk_used = sf->next; - sf->next = sf2; - - /* Update stack statistics. */ - for (sf2 = __stk_spare ; sf2 != sf->next ; sf2 = sf2->next) - __stk_size -= (char *)sf2->upper - (char *)(sf2 + 1); - - SHOWVALUE(__stk_size); - - LEAVE(); -} - -/****************************************************************************/ - -/* Set stackpointer back to some previous value - != NULL: on the same stackframe (returns sp) - == NULL: on another stackframe */ -void * -stkrst(struct StackSwapStruct sss, void *d0, long d1, long a0, long a1, long a6, long ret1) -{ - void *callsp = &ret1 + 1; - int cpsize = (char *)callsp - (char *)&d0; - struct stackframe *sf1, *sf2; - void * result = d0; - - ENTER(); - - if (d0 >= STK_LOWER && d0 < STK_UPPER) - goto out; - - sf1 = __stk_used; - if (sf1 == NULL) - goto out; - - for (;;) - { - sf2 = sf1->next; - if (sf2 == NULL) - { - if (d0 < __stk_initial_sp_lower || d0 >= __stk_initial_sp_upper) - goto out; - - break; - } - - if (d0 >= (void *)(sf2 + 1) && d0 < sf2->upper) /* This stackframe fits */ - break; - - sf1 = sf2; - } - - popframes(sf1, &sss); - sss.stk_Pointer = (char *)d0 - cpsize; - CopyMem(&d0, sss.stk_Pointer,cpsize); - - result = NULL; - - out: - - RETURN (result); - return (result); -} - -/****************************************************************************/ - -/* return to last stackframe */ -void -stkrst_f(struct StackSwapStruct sss, long d0, long d1, long a0, long a1, long a6) -{ - void *callsp = &a6 + 1; /* This one has no returnaddress - it's a fallback for rts */ - int cpsize = (char *)callsp - (char *)&d0; - - ENTER(); - - sss.stk_Pointer = (char *)__stk_used->savesp - cpsize; - popframes(__stk_used, &sss); - CopyMem(&d0, sss.stk_Pointer, cpsize); - - LEAVE(); -} - -/****************************************************************************/ - -#endif /* STACK_EXTENSION */ - -/****************************************************************************/ - -#endif /* __GNUC__ && !__PPC__ */ diff --git a/library/stdlib_stackminframe.c b/library/stdlib_stackminframe.c deleted file mode 100644 index 3f853f2..0000000 --- a/library/stdlib_stackminframe.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: stdlib_stackminframe.c,v 1.3 2005-03-18 12:38:25 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 EXEC_TYPES_H -#include -#endif /* EXEC_TYPES_H */ - -/****************************************************************************/ - -ULONG __stk_minframe = 32768; diff --git a/library/stdlib_stackoverflow.c b/library/stdlib_stackoverflow.c deleted file mode 100644 index d2b9d70..0000000 --- a/library/stdlib_stackoverflow.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * $Id: stdlib_stackoverflow.c,v 1.3 2005-03-11 09:37:29 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -extern BOOL NOCOMMON __stack_overflow; - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -void -__stkovf(void) -{ - /* We're in trouble. */ - __stack_overflow = TRUE; - - /* This will restore things to a sane state, display an - * error requester and drop into _exit(). - */ - longjmp(__exit_jmp_buf,1); -} - -/****************************************************************************/ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#if defined(__SASC) - -/****************************************************************************/ - -VOID -_XCOVF(VOID) -{ - /* We're in trouble. */ - __stack_overflow = TRUE; - - /* This will restore things to a sane state, display an - * error requester and drop into _exit(). - */ - longjmp(__exit_jmp_buf,1); -} - -/****************************************************************************/ - -#endif /* __SASC */ diff --git a/library/stdlib_stacksafezone.c b/library/stdlib_stacksafezone.c deleted file mode 100644 index c806cbf..0000000 --- a/library/stdlib_stacksafezone.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: stdlib_stacksafezone.c,v 1.3 2005-03-18 12:38:25 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 EXEC_TYPES_H -#include -#endif /* EXEC_TYPES_H */ - -/****************************************************************************/ - -ULONG __stk_safezone = 2048; diff --git a/library/stdlib_stacksize.c b/library/stdlib_stacksize.c deleted file mode 100644 index e0b09e9..0000000 --- a/library/stdlib_stacksize.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * $Id: stdlib_stacksize.c,v 1.4 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_GCC_HELP_H -#include "stdlib_gcc_help.h" -#endif /* _STDLIB_GCC_HELP_H */ - -/****************************************************************************/ - -#include "macros.h" - -/****************************************************************************/ - -/* Quick "hack" to help GCC compile itself */ -#if defined(GCC_HELP_SUPPORT) - -/******************************************************************************/ - -#include "stdlib_headers.h" - -/******************************************************************************/ - -STATIC unsigned int -get_default_stack_size(void) -{ - unsigned int result = 0; - char buffer[40]; - - if(GetVar("GCC_STACK_SIZE",buffer,sizeof(buffer)-1,0) > 0) - { - LONG n; - - if((StrToLong(buffer,&n) > 0) && (n > 0)) - result = (unsigned int)n; - } - - return(result); -} - -/******************************************************************************/ - -unsigned int (* __get_default_stack_size)(void) = get_default_stack_size; -char * __stack_size_string = "$STACK: 200000"; -unsigned int __stack_size = 200000; - -#else - -/******************************************************************************/ - -unsigned int NOCOMMON __stack_size; - -/******************************************************************************/ - -#endif /* GCC_HELP_SUPPORT */ diff --git a/library/stdlib_stdio_window_spec.c b/library/stdlib_stdio_window_spec.c deleted file mode 100644 index 6b1ac5b..0000000 --- a/library/stdlib_stdio_window_spec.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * $Id: stdlib_stdio_window_spec.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -char * __stdio_window_specification; diff --git a/library/stdlib_strtod.c b/library/stdlib_strtod.c deleted file mode 100644 index 750e584..0000000 --- a/library/stdlib_strtod.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * $Id: stdlib_strtod.c,v 1.8 2005-05-29 08:19:36 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _MATH_FP_SUPPORT_H -#include "math_fp_support.h" -#endif /* _MATH_FP_SUPPORT_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -double -strtod(const char *str, char ** ptr) -{ - double sum = 0.0; - double result; - int is_negative; - char c; - - ENTER(); - - SHOWSTRING(str); - SHOWPOINTER(ptr); - - assert( str != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(str == NULL) - { - SHOWMSG("invalid str parameter"); - - __set_errno(EFAULT); - - result = __get_huge_val(); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* Skip all leading blanks. */ - while((c = (*str)) != '\0') - { - if(NOT isspace(c)) - break; - - str++; - } - - /* The first character may be a sign. */ - if((*str) == '-') - { - /* It's a negative number. */ - is_negative = 1; - - str++; - } - else - { - /* It's not going to be negative. */ - is_negative = 0; - - /* But there may be a sign we will choose to - ignore. */ - if((*str) == '+') - str++; - } - - /* We begin by checking for the "inf" and "nan" strings. */ - if(strcasecmp(str,"inf") == SAME || strcasecmp(str,"infinity") == SAME) - { - SHOWMSG("infinity"); - - str += strlen(str); - - sum = __inf(); - } - else if (strncasecmp(str,"nan",3) == SAME && (str[3] == '(' || str[3] == '\0')) - { - SHOWMSG("not a number"); - - str += 3; - - /* Does NaN data follow the header? If so, skip it. */ - if((*str) == '(') - { - while((*str) != '\0' && (*str) != ')') - str++; - - if((*str) == ')') - str++; - } - - sum = nan(NULL); - } - else - { - int decimal_point_matches; - double new_sum; - int error = 0; - int radix; - - /* Check for the hex prefix. */ - if(strncasecmp(str,"0x",2) == SAME) - { - str += 2; - - radix = 16; - } - else - { - radix = 10; - } - - /* Convert all the digits preceding the decimal point. */ - while((c = (*str)) != '\0') - { - if ('0' <= c && c <= '9') - c = c - '0'; - else if ('a' <= c && c <= 'f') - c = c - 'a' + 10; - else if ('A' <= c && c <= 'F') - c = c - 'A' + 10; - else - c = radix; - - if(c >= radix) - break; - - str++; - - if(error == 0) - { - new_sum = (radix * sum) + c; - if(new_sum < sum) /* overflow? */ - error = ERANGE; - else - sum = new_sum; - } - } - - /* Did we find the decimal point? We accept both the - locale configured decimal point and the plain old - dot. */ - decimal_point_matches = 0; - - __locale_lock(); - - if(__locale_table[LC_NUMERIC] != NULL) - { - char * point; - - point = (char *)__locale_table[LC_NUMERIC]->loc_DecimalPoint; - if((*point) == (*str)) - { - decimal_point_matches = 1; - - /* Skip the decimal point. */ - str++; - } - } - - __locale_unlock(); - - if(NOT decimal_point_matches) - { - if((*str) == '.') - { - decimal_point_matches = 1; - - /* Skip the decimal point. */ - str++; - } - } - - if(decimal_point_matches) - { - double divisor = 1.0 / radix; - - /* Process all digits following the decimal point. */ - while((c = (*str)) != '\0') - { - if ('0' <= c && c <= '9') - c = c - '0'; - else if ('a' <= c && c <= 'f') - c = c - 'a' + 10; - else if ('A' <= c && c <= 'F') - c = c - 'A' + 10; - else - c = radix; - - if(c >= radix) - break; - - str++; - - if(error == 0 && divisor != 0.0) - { - new_sum = sum + c * divisor; - if(new_sum < sum) /* overflow? */ - error = ERANGE; - else - sum = new_sum; - - divisor = divisor / radix; - } - } - } - - /* If there is a scale indicator attached, process it. */ - if((radix == 10 && ((*str) == 'e' || (*str) == 'E')) || - (radix == 16 && ((*str) == 'p' || (*str) == 'P'))) - { - int exponent_is_negative; - int new_exponent; - int exponent = 0; - int exponent_radix; - - /* If we are processing a hexadecimal encoded - floating point number, switch to a binary - exponent. */ - if(radix == 16) - exponent_radix = 2; - else - exponent_radix = 10; - - /* Skip the indicator. */ - str++; - - /* Take care of the exponent's sign. */ - if((*str) == '-') - { - exponent_is_negative = 1; - str++; - } - else - { - exponent_is_negative = 0; - - if((*str) == '+') - str++; - } - - /* Again, process all digits to follow. */ - while((c = (*str)) != '\0') - { - if('0' <= c && c <= '9') - c -= '0'; - else - c = exponent_radix; - - if(c >= exponent_radix) - break; - - str++; - - if(error == 0) - { - new_exponent = (exponent_radix * exponent) + c; - if(new_exponent < exponent) /* overflow? */ - error = ERANGE; - else - exponent = new_exponent; - } - } - - /* If the exponent is valid, scale the number accordingly. */ - if(exponent != 0) - { - if(exponent_is_negative) - { - double divisor; - - /* A negative exponent means division. */ - divisor = pow((double)radix,(double)exponent); - if(divisor != 0.0) - { - new_sum = sum / divisor; - if(new_sum == 0.0 && sum != 0.0) - error = ERANGE; - else - sum = new_sum; - } - else - { - error = ERANGE; - } - } - else - { - /* A positive exponent means multiplication. */ - new_sum = sum * pow((double)radix,(double)exponent); - if(new_sum < sum) - error = ERANGE; - else - sum = new_sum; - } - } - } - - if(error != 0) - { - __set_errno(error); - - sum = __get_huge_val(); - } - } - - if(is_negative) - sum = (-sum); - - result = sum; - - /* If desired, remember where we stopped reading the - number from the buffer. */ - if(ptr != NULL) - (*ptr) = (char *)str; - - out: - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/stdlib_strtof.c b/library/stdlib_strtof.c deleted file mode 100644 index 1f487da..0000000 --- a/library/stdlib_strtof.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * $Id: stdlib_strtof.c,v 1.8 2005-05-30 18:28:45 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _MATH_FP_SUPPORT_H -#include "math_fp_support.h" -#endif /* _MATH_FP_SUPPORT_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -#ifndef _MATH_HEADERS_H -#include "math_headers.h" -#endif /* _MATH_HEADERS_H */ - -/****************************************************************************/ - -float -strtof(const char *str, char ** ptr) -{ - float sum = 0.0; - float result; - int is_negative; - char c; - - ENTER(); - - SHOWSTRING(str); - SHOWPOINTER(ptr); - - assert( str != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(str == NULL) - { - SHOWMSG("invalid str parameter"); - - __set_errno(EFAULT); - - result = __get_huge_valf(); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* Skip all leading blanks. */ - while((c = (*str)) != '\0') - { - if(NOT isspace(c)) - break; - - str++; - } - - /* The first character may be a sign. */ - if((*str) == '-') - { - /* It's a negative number. */ - is_negative = 1; - - str++; - } - else - { - /* It's not going to be negative. */ - is_negative = 0; - - /* But there may be a sign we will choose to - ignore. */ - if((*str) == '+') - str++; - } - - /* We begin by checking for the "inf" and "nan" strings. */ - if(strcasecmp(str,"inf") == SAME || strcasecmp(str,"infinity") == SAME) - { - SHOWMSG("infinity"); - - str += strlen(str); - - sum = __inff(); - } - else if (strncasecmp(str,"nan",3) == SAME && (str[3] == '(' || str[3] == '\0')) - { - SHOWMSG("not a number"); - - str += 3; - - /* Does NaN data follow the header? If so, skip it. */ - if((*str) == '(') - { - while((*str) != '\0' && (*str) != ')') - str++; - - if((*str) == ')') - str++; - } - - sum = nanf(NULL); - } - else - { - int decimal_point_matches; - float new_sum; - int error = 0; - int radix; - - /* Check for the hex prefix. */ - if(strncasecmp(str,"0x",2) == SAME) - { - str += 2; - - radix = 16; - } - else - { - radix = 10; - } - - /* Convert all the digits preceding the decimal point. */ - while((c = (*str)) != '\0') - { - if ('0' <= c && c <= '9') - c = c - '0'; - else if ('a' <= c && c <= 'f') - c = c - 'a' + 10; - else if ('A' <= c && c <= 'F') - c = c - 'A' + 10; - else - c = radix; - - if(c >= radix) - break; - - str++; - - if(error == 0) - { - new_sum = (radix * sum) + c; - if(new_sum < sum) /* overflow? */ - error = ERANGE; - else - sum = new_sum; - } - } - - /* Did we find the decimal point? We accept both the - locale configured decimal point and the plain old - dot. */ - decimal_point_matches = 0; - - __locale_lock(); - - if(__locale_table[LC_NUMERIC] != NULL) - { - char * point; - - point = (char *)__locale_table[LC_NUMERIC]->loc_DecimalPoint; - if((*point) == (*str)) - { - decimal_point_matches = 1; - - /* Skip the decimal point. */ - str++; - } - } - - __locale_unlock(); - - if(NOT decimal_point_matches) - { - if((*str) == '.') - { - decimal_point_matches = 1; - - /* Skip the decimal point. */ - str++; - } - } - - if(decimal_point_matches) - { - float divisor = 1.0 / radix; - - /* Process all digits following the decimal point. */ - while((c = (*str)) != '\0') - { - if ('0' <= c && c <= '9') - c = c - '0'; - else if ('a' <= c && c <= 'f') - c = c - 'a' + 10; - else if ('A' <= c && c <= 'F') - c = c - 'A' + 10; - else - c = radix; - - if(c >= radix) - break; - - str++; - - if(error == 0 && divisor != 0.0) - { - new_sum = sum + c * divisor; - if(new_sum < sum) /* overflow? */ - error = ERANGE; - else - sum = new_sum; - - divisor = divisor / radix; - } - } - } - - /* If there is a scale indicator attached, process it. */ - if((radix == 10 && ((*str) == 'e' || (*str) == 'E')) || - (radix == 16 && ((*str) == 'p' || (*str) == 'P'))) - { - int exponent_is_negative; - int new_exponent; - int exponent = 0; - int exponent_radix; - - /* If we are processing a hexadecimal encoded - floating point number, switch to a binary - exponent. */ - if(radix == 16) - exponent_radix = 2; - else - exponent_radix = 10; - - /* Skip the indicator. */ - str++; - - /* Take care of the exponent's sign. */ - if((*str) == '-') - { - exponent_is_negative = 1; - str++; - } - else - { - exponent_is_negative = 0; - - if((*str) == '+') - str++; - } - - /* Again, process all digits to follow. */ - while((c = (*str)) != '\0') - { - if('0' <= c && c <= '9') - c -= '0'; - else - c = exponent_radix; - - if(c >= exponent_radix) - break; - - str++; - - if(error == 0) - { - new_exponent = (exponent_radix * exponent) + c; - if(new_exponent < exponent) /* overflow? */ - error = ERANGE; - else - exponent = new_exponent; - } - } - - /* If the exponent is valid, scale the number accordingly. */ - if(exponent != 0) - { - if(exponent_is_negative) - { - float divisor; - - /* A negative exponent means division. */ - divisor = powf((float)radix,(float)exponent); - if(divisor != 0.0) - { - new_sum = sum / divisor; - if(new_sum == 0.0 && sum != 0.0) - error = ERANGE; - else - sum = new_sum; - } - else - { - error = ERANGE; - } - } - else - { - /* A positive exponent means multiplication. */ - new_sum = sum * powf((float)radix,(float)exponent); - if(new_sum < sum) - error = ERANGE; - else - sum = new_sum; - } - } - } - - if(error != 0) - { - __set_errno(error); - - sum = __get_huge_valf(); - } - } - - if(is_negative) - sum = (-sum); - - result = sum; - - /* If desired, remember where we stopped reading the - number from the buffer. */ - if(ptr != NULL) - (*ptr) = (char *)str; - - out: - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/stdlib_strtol.c b/library/stdlib_strtol.c deleted file mode 100644 index e978d51..0000000 --- a/library/stdlib_strtol.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * $Id: stdlib_strtol.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -long -strtol(const char *str, char **ptr, int base) -{ - BOOL is_negative; - long result = 0; - long new_sum; - long sum; - char c; - - ENTER(); - - SHOWSTRING(str); - SHOWPOINTER(ptr); - SHOWVALUE(base); - - assert(str != NULL && base >= 0); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(str == NULL) - { - SHOWMSG("invalid str parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(base < 0) - { - SHOWMSG("invalid base parameter"); - - __set_errno(ERANGE); - goto out; - } - - /* Skip all leading blanks. */ - while((c = (*str)) != '\0') - { - if(NOT isspace(c)) - break; - - str++; - } - - /* The first character may be a sign. */ - if(c == '-') - { - /* It's a negative number. */ - is_negative = TRUE; - - str++; - } - else - { - /* It's not going to be negative. */ - is_negative = FALSE; - - /* But there may be a sign we will choose to - * ignore. - */ - if(c == '+') - str++; - } - - c = (*str); - - /* There may be a leading '0x' to indicate that what - * follows is a hexadecimal number. - */ - if(base == 0 || base == 16) - { - if((c == '0') && (str[1] == 'x' || str[1] == 'X')) - { - base = 16; - - str += 2; - - c = (*str); - } - } - - /* If we still don't know what base to use and the - * next letter to follow is a zero then this is - * probably a number in octal notation. - */ - if(base == 0) - { - if(c == '0') - base = 8; - else - base = 10; - } - - sum = 0; - - if(1 <= base && base <= 36) - { - while(c != '\0') - { - if('0' <= c && c <= '9') - c -= '0'; - else if ('a' <= c) - c -= 'a' - 10; - else if ('A' <= c) - c -= 'A' - 10; - else - break; - - /* Ignore invalid numbers. */ - if(c >= base) - break; - - new_sum = base * sum + c; - if(new_sum < sum) /* overflow? */ - { - __set_errno(ERANGE); - - if(is_negative) - result = LONG_MIN; - else - result = LONG_MAX; - - goto out; - } - - sum = new_sum; - - str++; - - c = (*str); - } - } - - if(is_negative) - result = (-sum); - else - result = sum; - - out: - - /* If desired, remember where we stopped reading the - * number from the buffer. - */ - if(ptr != NULL) - (*ptr) = (char *)str; - - RETURN(result); - return(result); -} diff --git a/library/stdlib_strtoll.c b/library/stdlib_strtoll.c deleted file mode 100644 index 59570a1..0000000 --- a/library/stdlib_strtoll.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * $Id: stdlib_strtoll.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#if defined(USE_64_BIT_INTS) - -/****************************************************************************/ - -long long -strtoll(const char *str, char **ptr, int base) -{ - BOOL is_negative; - long long result = 0; - long long new_sum; - long long sum; - char c; - - ENTER(); - - SHOWSTRING(str); - SHOWPOINTER(ptr); - SHOWVALUE(base); - - assert(str != NULL && base >= 0); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(str == NULL) - { - SHOWMSG("invalid str parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(base < 0) - { - SHOWMSG("invalid base parameter"); - - __set_errno(ERANGE); - goto out; - } - - /* Skip all leading blanks. */ - while((c = (*str)) != '\0') - { - if(NOT isspace(c)) - break; - - str++; - } - - /* The first character may be a sign. */ - if(c == '-') - { - /* It's a negative number. */ - is_negative = TRUE; - - str++; - } - else - { - /* It's not going to be negative. */ - is_negative = FALSE; - - /* But there may be a sign we will choose to - * ignore. - */ - if(c == '+') - str++; - } - - c = (*str); - - /* There may be a leading '0x' to indicate that what - * follows is a hexadecimal number. - */ - if(base == 0 || base == 16) - { - if((c == '0') && (str[1] == 'x' || str[1] == 'X')) - { - base = 16; - - str += 2; - - c = (*str); - } - } - - /* If we still don't know what base to use and the - * next letter to follow is a zero then this is - * probably a number in octal notation. - */ - if(base == 0) - { - if(c == '0') - base = 8; - else - base = 10; - } - - sum = 0; - - if(1 <= base && base <= 36) - { - while(c != '\0') - { - if('0' <= c && c <= '9') - c -= '0'; - else if ('a' <= c) - c -= 'a' - 10; - else if ('A' <= c) - c -= 'A' - 10; - else - break; - - /* Ignore invalid numbers. */ - if(c >= base) - break; - - new_sum = base * sum + c; - if(new_sum < sum) /* overflow? */ - { - __set_errno(ERANGE); - - if(is_negative) - result = LONG_MIN; - else - result = LONG_MAX; - - goto out; - } - - sum = new_sum; - - str++; - - c = (*str); - } - } - - if(is_negative) - result = (-sum); - else - result = sum; - - out: - - /* If desired, remember where we stopped reading the - * number from the buffer. - */ - if(ptr != NULL) - (*ptr) = (char *)str; - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USE_64_BIT_INTS */ diff --git a/library/stdlib_strtoul.c b/library/stdlib_strtoul.c deleted file mode 100644 index 4f8f596..0000000 --- a/library/stdlib_strtoul.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * $Id: stdlib_strtoul.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -unsigned long -strtoul(const char *str, char **ptr, int base) -{ - BOOL is_negative; - unsigned long result = 0; - unsigned long new_sum; - unsigned long sum; - char c; - - ENTER(); - - SHOWSTRING(str); - SHOWPOINTER(ptr); - SHOWVALUE(base); - - assert(str != NULL && base >= 0); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(str == NULL) - { - SHOWMSG("invalid str parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(base < 0) - { - SHOWMSG("invalid base parameter"); - - __set_errno(ERANGE); - goto out; - } - - /* Skip all leading blanks. */ - while((c = (*str)) != '\0') - { - if(NOT isspace(c)) - break; - - str++; - } - - /* The first character may be a sign. */ - if(c == '-') - { - /* It's a negative number. */ - is_negative = TRUE; - - str++; - } - else - { - /* It's not going to be negative. */ - is_negative = FALSE; - - /* But there may be a sign we will choose to - * ignore. - */ - if(c == '+') - str++; - } - - c = (*str); - - /* There may be a leading '0x' to indicate that what - * follows is a hexadecimal number. - */ - if(base == 0 || base == 16) - { - if((c == '0') && (str[1] == 'x' || str[1] == 'X')) - { - base = 16; - - str += 2; - - c = (*str); - } - } - - /* If we still don't know what base to use and the - * next letter to follow is a zero then this is - * probably a number in octal notation. - */ - if(base == 0) - { - if(c == '0') - base = 8; - else - base = 10; - } - - sum = 0; - - if(1 <= base && base <= 36) - { - while(c != '\0') - { - if('0' <= c && c <= '9') - c -= '0'; - else if ('a' <= c) - c -= 'a' - 10; - else if ('A' <= c) - c -= 'A' - 10; - else - break; - - /* Ignore invalid numbers. */ - if(c >= base) - break; - - new_sum = base * sum + c; - if(new_sum < sum) /* overflow? */ - { - __set_errno(ERANGE); - - result = ULONG_MAX; - - goto out; - } - - sum = new_sum; - - str++; - - c = (*str); - } - } - - if(is_negative) - result = (-sum); - else - result = sum; - - out: - - /* If desired, remember where we stopped reading the - * number from the buffer. - */ - if(ptr != NULL) - (*ptr) = (char *)str; - - RETURN(result); - return(result); -} diff --git a/library/stdlib_strtoull.c b/library/stdlib_strtoull.c deleted file mode 100644 index c44d2a8..0000000 --- a/library/stdlib_strtoull.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * $Id: stdlib_strtoull.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#if defined(USE_64_BIT_INTS) - -/****************************************************************************/ - -unsigned long long -strtoull(const char *str, char **ptr, int base) -{ - BOOL is_negative; - unsigned long long result = 0; - unsigned long long new_sum; - unsigned long long sum; - char c; - - ENTER(); - - SHOWSTRING(str); - SHOWPOINTER(ptr); - SHOWVALUE(base); - - assert(str != NULL && base >= 0); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(str == NULL) - { - SHOWMSG("invalid str parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(base < 0) - { - SHOWMSG("invalid base parameter"); - - __set_errno(ERANGE); - goto out; - } - - /* Skip all leading blanks. */ - while((c = (*str)) != '\0') - { - if(NOT isspace(c)) - break; - - str++; - } - - /* The first character may be a sign. */ - if(c == '-') - { - /* It's a negative number. */ - is_negative = TRUE; - - str++; - } - else - { - /* It's not going to be negative. */ - is_negative = FALSE; - - /* But there may be a sign we will choose to - * ignore. - */ - if(c == '+') - str++; - } - - c = (*str); - - /* There may be a leading '0x' to indicate that what - * follows is a hexadecimal number. - */ - if(base == 0 || base == 16) - { - if((c == '0') && (str[1] == 'x' || str[1] == 'X')) - { - base = 16; - - str += 2; - - c = (*str); - } - } - - /* If we still don't know what base to use and the - * next letter to follow is a zero then this is - * probably a number in octal notation. - */ - if(base == 0) - { - if(c == '0') - base = 8; - else - base = 10; - } - - sum = 0; - - if(1 <= base && base <= 36) - { - while(c != '\0') - { - if('0' <= c && c <= '9') - c -= '0'; - else if ('a' <= c) - c -= 'a' - 10; - else if ('A' <= c) - c -= 'A' - 10; - else - break; - - /* Ignore invalid numbers. */ - if(c >= base) - break; - - new_sum = base * sum + c; - if(new_sum < sum) /* overflow? */ - { - __set_errno(ERANGE); - - result = ULONG_MAX; - - goto out; - } - - sum = new_sum; - - str++; - - c = (*str); - } - } - - if(is_negative) - result = (-sum); - else - result = sum; - - out: - - /* If desired, remember where we stopped reading the - * number from the buffer. - */ - if(ptr != NULL) - (*ptr) = (char *)str; - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USE_64_BIT_INTS */ diff --git a/library/stdlib_swapstack.asm b/library/stdlib_swapstack.asm deleted file mode 100644 index c6a59f6..0000000 --- a/library/stdlib_swapstack.asm +++ /dev/null @@ -1,67 +0,0 @@ -* -* $Id: stdlib_swapstack.asm,v 1.2 2005-01-02 09:07:19 obarthel Exp $ -* -* :ts=8 -* -* Portable ISO 'C' (1994) runtime library for the Amiga computer -* Copyright (c) 2002-2005 by Olaf Barthel -* 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/macros.i" - - section text,code - -_LVOStackSwap equ -732 - - xref _SysBase - - xdef ___swap_stack_and_call - -___swap_stack_and_call: - - movem.l d2/a2/a3/a6,-(sp) - - move.l _SysBase,a6 - - move.l 20(sp),a2 - move.l 24(sp),a3 - - move.l a2,a0 - jsr _LVOStackSwap(a6) - - jsr (a3) - move.l d0,d2 - - move.l a2,a0 - jsr _LVOStackSwap(a6) - - move.l d2,d0 - - movem.l (sp)+,d2/a2/a3/a6 - rts - - end diff --git a/library/stdlib_swapstack.c b/library/stdlib_swapstack.c deleted file mode 100644 index 66ceeb8..0000000 --- a/library/stdlib_swapstack.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * $Id: stdlib_swapstack.c,v 1.3 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#if defined(__GNUC__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -#ifndef __PPC__ - -/****************************************************************************/ - -asm(" \n\ - .text \n\ - .even \n\ - \n\ -_LVOStackSwap = -732 \n\ - \n\ - .globl _SysBase \n\ - .globl ___swap_stack_and_call \n\ - \n\ -___swap_stack_and_call: \n\ - \n\ - moveml d2/a2/a3/a6,sp@- \n\ - movel sp@(20),a2 \n\ - movel sp@(24),a3 \n\ - movel "A4(_SysBase)",a6 \n\ - \n\ - movel a2,a0 \n\ - jsr a6@(_LVOStackSwap:W) \n\ - \n\ - jsr a3@ \n\ - movel d0,d2 \n\ - \n\ - movel a2,a0 \n\ - jsr a6@(_LVOStackSwap:W) \n\ - \n\ - movel d2,d0 \n\ - \n\ - moveml sp@+,d2/a2/a3/a6 \n\ - \n\ - rts \n\ - \n\ -"); - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -/* Swap the current stack configuration out, call a function provided, - swap the stack configuration back and return. */ -int -__swap_stack_and_call(struct StackSwapStruct * stk,APTR function) -{ - register int result; - - StackSwap(stk); - result = ((int (*)(void))function)(); - StackSwap(stk); - - return(result); -} - -/****************************************************************************/ - -#endif /* __PPC__ */ - -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_sysbase.c b/library/stdlib_sysbase.c deleted file mode 100644 index fd89b1b..0000000 --- a/library/stdlib_sysbase.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * $Id: stdlib_sysbase.c,v 1.4 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 __NOLIBBASE__ - -#ifndef PROTO_EXEC_H -#include -#endif /* PROTO_EXEC_H */ - -/****************************************************************************/ - -#include "macros.h" - -/****************************************************************************/ - -struct ExecBase * NOCOMMON SysBase; - -/****************************************************************************/ - -#if defined(__amigaos4__) - -struct ExecIFace * NOCOMMON IExec; - -#endif /* __amigaos4__ */ diff --git a/library/stdlib_system.c b/library/stdlib_system.c deleted file mode 100644 index e0c6aa9..0000000 --- a/library/stdlib_system.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * $Id: stdlib_system.c,v 1.9 2005-04-28 15:38:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -#ifndef _STIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -int -system(const char * command) -{ - char * command_copy = NULL; - int result; - - ENTER(); - - if(command == NULL) - SHOWPOINTER(command); - else - SHOWSTRING(command); - - if(__check_abort_enabled) - __check_abort(); - - /* A NULL pointer for the name of the command to execute is - * really a query to find out whether a shell is available. - * We return 1 (TRUE). - */ - if(command == NULL) - { - result = 1; - } - else - { - static const struct TagItem system_tags[2] = - { - { SYS_UserShell, TRUE }, - { TAG_END, 0 } - }; - - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info command_nti; - #endif /* UNIX_PATH_SEMANTICS */ - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - char just_the_command_name[MAXPATHLEN+1]; - BOOL need_quotes = FALSE; - char * command_name; - size_t command_len; - BOOL have_quote; - size_t len; - size_t i; - - /* We may need to replace the path specified for the command, - so let's figure out first how long the command name, - including everything, really is. */ - len = strlen(command); - command_len = len; - - have_quote = FALSE; - for(i = 0 ; i < len ; i++) - { - if(command[i] == '\"') - { - need_quotes = TRUE; - have_quote ^= TRUE; - } - - if((command[i] == ' ' || command[i] == '\t') && NOT have_quote) - { - command_len = i; - break; - } - } - - /* This may be too long for proper translation... */ - if(command_len > MAXPATHLEN) - { - __set_errno(ENAMETOOLONG); - - result = ERROR; - goto out; - } - - /* Grab the command name itself, then have it translated. */ - command_name = just_the_command_name; - for(i = 0 ; i < command_len ; i++) - { - if(command[i] != '\"') - (*command_name++) = command[i]; - } - - (*command_name) = '\0'; - - command_name = just_the_command_name; - - /* Don't try to translate the name of the command unless it has - path name separator characters in it. */ - if(strchr(command_name,'/') != NULL && __translate_unix_to_amiga_path_name((const char **)&command_name,&command_nti) != 0) - { - result = ERROR; - goto out; - } - - /* Now put it all together again */ - command_copy = malloc(1 + strlen(command_name) + 1 + strlen(&command[command_len]) + 1); - if(command_copy == NULL) - { - __set_errno(ENOMEM); - - result = ERROR; - goto out; - } - - if(need_quotes) - { - command_copy[0] = '\"'; - - strcpy(&command_copy[1],command_name); - strcat(command_copy,"\""); - } - else - { - strcpy(command_copy,command_name); - } - - strcat(command_copy,&command[command_len]); - - command = command_copy; - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - SHOWSTRING(command); - - PROFILE_OFF(); - - /* Push all currently buffered output towards the file handles, - in case the program to be launched writes to these files - or the console, too. */ - __flush_all_files(-1); - - result = SystemTagList((STRPTR)command, (struct TagItem *)system_tags); - - PROFILE_ON(); - } - - out: - - if(command_copy != NULL) - free(command_copy); - - RETURN(result); - return(result); -} diff --git a/library/stdlib_termination_message.c b/library/stdlib_termination_message.c deleted file mode 100644 index f417ac1..0000000 --- a/library/stdlib_termination_message.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * $Id: stdlib_termination_message.c,v 1.5 2005-03-19 11:06:57 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -#ifndef _SIGNAL_HEADERS_H -#include "signal_headers.h" -#endif /* _SIGNAL_HEADERS_H */ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -void -__print_termination_message(const char * termination_message) -{ - static BOOL termination_message_printed = FALSE; - - if(NOT termination_message_printed) - { - termination_message_printed = TRUE; - - if(NOT __no_standard_io && __num_iob > STDERR_FILENO) - { - fputs((termination_message != NULL) ? termination_message : "Abnormal program termination",stderr); - - fputc('\n',stderr); - } - } -} diff --git a/library/stdlib_threshold.c b/library/stdlib_threshold.c deleted file mode 100644 index a2fba0f..0000000 --- a/library/stdlib_threshold.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: stdlib_threshold.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -ULONG __free_memory_threshold; diff --git a/library/stdlib_udivmodsi3.c b/library/stdlib_udivmodsi3.c deleted file mode 100644 index 85537cf..0000000 --- a/library/stdlib_udivmodsi3.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * $Id: stdlib_udivmodsi3.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ - -asm(" - - .text - .even - - .globl ___umodsi3 - .globl ___UtilityBase - -| D1.L = D0.L % D1.L unsigned - -___umodsi3: - - moveml sp@(4:W),d0/d1 - jbsr ___udivsi4 - movel d1,d0 - rts - - .globl ___udivsi3 - -| D0.L = D0.L / D1.L unsigned - -___udivsi3: - moveml sp@(4:W),d0/d1 -___udivsi4: - movel "A4(___UtilityBase)",a0 - jmp a0@(-156:W) - -"); - -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_udivsi3.c b/library/stdlib_udivsi3.c deleted file mode 100644 index af06b77..0000000 --- a/library/stdlib_udivsi3.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * $Id: stdlib_udivsi3.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__) - -/****************************************************************************/ -#ifndef __PPC__ -asm(" \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl ___udivsi3 \n\ - .globl ___udivsi4 \n\ - \n\ -| D0.L = D0.L / D1.L unsigned \n\ - \n\ -___udivsi3: \n\ - \n\ - moveml sp@(4:W),d0/d1 \n\ - jbra ___udivsi4 \n\ - \n\ -"); -#else -__asm(" \n\ - .text \n\ - .align 2 \n\ - \n\ - .globl __udivsi3 \n\ -__udivsi3: \n\ - divwu r3, r3, r4 \n\ - blr \n\ -"); -#endif - -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_udivsi4.c b/library/stdlib_udivsi4.c deleted file mode 100644 index e63c444..0000000 --- a/library/stdlib_udivsi4.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * $Id: stdlib_udivsi4.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__) - -/****************************************************************************/ - -#if defined(SMALL_DATA) -#define A4(x) "a4@(" #x ":W)" -#elif defined(SMALL_DATA32) -#define A4(x) "a4@(" #x ":L)" -#else -#define A4(x) #x -#endif /* SMALL_DATA */ - -/****************************************************************************/ -#ifndef __PPC__ -asm(" \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl ___udivsi4 \n\ - .globl ___UtilityBase \n\ - \n\ -___udivsi4: \n\ - \n\ - movel "A4(___UtilityBase)",a0 \n\ - jmp a0@(-156:W) \n\ - \n\ -"); -#else -__asm(" \n\ - .text \n\ - .align 2 \n\ - \n\ - .globl __udivsi4 \n\ -__udivsi4: \n\ - divwu r3, r3, r4 \n\ - blr \n\ -"); -#endif - -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_umodsi3.c b/library/stdlib_umodsi3.c deleted file mode 100644 index bab93e9..0000000 --- a/library/stdlib_umodsi3.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * $Id: stdlib_umodsi3.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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__) - -/****************************************************************************/ - -#ifndef __PPC__ -asm(" \n\ - \n\ - .text \n\ - .even \n\ - \n\ - .globl ___umodsi3 \n\ - .globl ___udivsi4 \n\ - \n\ -| D1.L = D0.L % D1.L unsigned \n\ - \n\ -___umodsi3: \n\ - \n\ - moveml sp@(4:W),d0/d1 \n\ - jbsr ___udivsi4 \n\ - movel d1,d0 \n\ - rts \n\ - \n\ -"); -#else -__asm(" \n\ - .text \n\ - .align 2 \n\ - \n\ - .globl __umodsi3 \n\ - \n\ -__umodsi3: \n\ - divwu r0,r3,r4 \n\ - mullw r0,r0,r4 \n\ - subf r3,r0,r3 \n\ - blr \n\ -"); - -#endif -/****************************************************************************/ - -#endif /* __GNUC__ */ diff --git a/library/stdlib_unsetenv.c b/library/stdlib_unsetenv.c deleted file mode 100644 index ba0d5ee..0000000 --- a/library/stdlib_unsetenv.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * $Id: stdlib_unsetenv.c,v 1.6 2005-03-18 12:38:25 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -void -unsetenv(const char *original_name) -{ - char * name = (char *)original_name; - char * name_copy = NULL; - unsigned i; - - if(__check_abort_enabled) - __check_abort(); - - assert( name != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - for(i = 0 ; i < strlen(name) ; i++) - { - if(name[i] == '=') - { - name_copy = malloc(i+1); - if(name_copy == NULL) - goto out; - - memmove(name_copy,name,i); - name_copy[i] = '\0'; - - name = name_copy; - break; - } - } - - PROFILE_OFF(); - DeleteVar(name,0); - PROFILE_ON(); - - out: - - if(name_copy != NULL) - free(name_copy); -} diff --git a/library/stdlib_utilitybase.c b/library/stdlib_utilitybase.c deleted file mode 100644 index 8bd048a..0000000 --- a/library/stdlib_utilitybase.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * $Id: stdlib_utilitybase.c,v 1.2 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 __NOLIBBASE__ - -#ifndef PROTO_UTILITY_H -#include -#endif /* PROTO_UTILITY_H */ - -/****************************************************************************/ - -#include "macros.h" - -/****************************************************************************/ - -struct Library * NOCOMMON __UtilityBase; - -/****************************************************************************/ - -#if defined(__amigaos4__) - -struct UtilityIFace * NOCOMMON __IUtility; - -#endif /* __amigaos4__ */ diff --git a/library/stdlib_utilitybase.h b/library/stdlib_utilitybase.h deleted file mode 100644 index d455bf4..0000000 --- a/library/stdlib_utilitybase.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * $Id: stdlib_utilitybase.h,v 1.1 2005-03-30 19:37:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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_UTILITYBASE_H -#define _STDLIB_UTILITYBASE_H - -/****************************************************************************/ - -#ifndef __NOLIBBASE__ -#define __NOLIBBASE__ -#endif /* __NOLIBBASE__ */ - -#ifndef __NOGLOBALIFACE__ -#define __NOGLOBALIFACE__ -#endif /* __NOGLOBALIFACE__ */ - -#include - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_H */ - -/****************************************************************************/ - -extern struct Library * NOCOMMON __UtilityBase; - -/****************************************************************************/ - -#if defined(__amigaos4__) - -/****************************************************************************/ - -extern struct UtilityIFace NOCOMMON * __IUtility; - -/****************************************************************************/ - -#define DECLARE_UTILITYBASE() \ - struct Library * UNUSED UtilityBase = __UtilityBase; \ - struct UtilityIFace * IUtility = __IUtility - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -#define DECLARE_UTILITYBASE() \ - struct Library * UtilityBase = __UtilityBase - -/****************************************************************************/ - -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -#endif /* _STDLIB_UTILITYBASE_H */ diff --git a/library/stdlib_wcstombs.c b/library/stdlib_wcstombs.c deleted file mode 100644 index 77da28c..0000000 --- a/library/stdlib_wcstombs.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: stdlib_wcstombs.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -size_t -wcstombs(char *s, const wchar_t *pwcs, size_t n) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/stdlib_wctomb.c b/library/stdlib_wctomb.c deleted file mode 100644 index 3f8ce5c..0000000 --- a/library/stdlib_wctomb.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: stdlib_wctomb.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -int -wctomb(char *s, wchar_t wchar) -{ - /* ZZZ unimplemented */ - return(-1); -} diff --git a/library/string_bcmp.c b/library/string_bcmp.c deleted file mode 100644 index f136887..0000000 --- a/library/string_bcmp.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * $Id: string_bcmp.c,v 1.3 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -bcmp(const void *a,const void *b,size_t len) -{ - int result; - - assert( a != NULL && b != NULL ); - assert( (int)len >= 0 ); - - result = memcmp(a,b,len); - - return(result); -} diff --git a/library/string_bcopy.c b/library/string_bcopy.c deleted file mode 100644 index b1e8618..0000000 --- a/library/string_bcopy.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * $Id: string_bcopy.c,v 1.3 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -void -bcopy(const void *src,void *dest,size_t len) -{ - assert( (len == 0) || (src != NULL && dest != NULL && (int)len > 0) ); - - memmove(dest,src,len); -} diff --git a/library/string_bzero.c b/library/string_bzero.c deleted file mode 100644 index 5413e73..0000000 --- a/library/string_bzero.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * $Id: string_bzero.c,v 1.3 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -void -bzero(void *m,size_t len) -{ - assert( (len == 0) || (m != NULL && (int)len > 0) ); - - memset(m,0,len); -} diff --git a/library/string_headers.h b/library/string_headers.h deleted file mode 100644 index 30858f5..0000000 --- a/library/string_headers.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * $Id: string_headers.h,v 1.6 2005-03-30 19:37:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#define _STRING_HEADERS_H - -/****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -/****************************************************************************/ - -#ifndef _STDLIB_LOCALEBASE_H -#include "stdlib_localebase.h" -#endif /* _STDLIB_LOCALEBASE_H */ - -#ifndef _STDLIB_UTILITYBASE_H -#include "stdlib_utilitybase.h" -#endif /* _STDLIB_UTILITYBASE_H */ - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_H */ - -#ifndef _DEBUG_H -#include "debug.h" -#endif /* _DEBUG_H */ - -/****************************************************************************/ - -/* Address is neither aligned to a word or long word boundary. */ -#define IS_UNALIGNED(a) ((((unsigned long)(a)) & 1) != 0) - -/* Address is aligned to a word boundary, but not to a long - word boundary. */ -#define IS_SHORT_ALIGNED(a) ((((unsigned long)(a)) & 3) == 2) - -/* Address is aligned to a long word boundary. For an 68030 and beyond the - alignment does not matter. */ -#if defined(M68020) -#define IS_LONG_ALIGNED(a) (1) -#else -#define IS_LONG_ALIGNED(a) ((((unsigned long)(a)) & 3) == 0) -#endif /* M68020 */ - -/****************************************************************************/ - -#endif /* _STRING_HEADERS_H */ diff --git a/library/string_index.c b/library/string_index.c deleted file mode 100644 index 30be746..0000000 --- a/library/string_index.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: string_index.c,v 1.3 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -char * -index(const char *s, int c) -{ - char * result; - - result = strchr(s,c); - - return(result); -} diff --git a/library/string_memchr.c b/library/string_memchr.c deleted file mode 100644 index 40bbd76..0000000 --- a/library/string_memchr.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * $Id: string_memchr.c,v 1.5 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -/* Check if one of the four bytes which make up a long word is zero. */ -#define LONG_CONTAINS_ZERO_OCTET(x) (((x) + 0xfefefeff) & ~((x) | 0x7f7f7f7f)) - -/****************************************************************************/ - -INLINE STATIC void * -__memchr(const unsigned char * m,unsigned char val,size_t len) -{ - void * result = NULL; - - assert( m != NULL && len > 0 ); - - /* The setup below is intended to speed up searching in larger - * memory blocks. This can be very elaborate and should not be - * done unless a payoff can be expected. - */ - if(len > 4 * sizeof(long)) - { - /* Try to align the memory block to an even address. */ - if(IS_UNALIGNED(m)) - { - len--; - - if((*m) == val) - { - result = (void *)m; - goto out; - } - - m++; - } - - /* Try to align the memory block to an address which is - * a multiple of a long word. - */ - if(len >= sizeof(short) && IS_SHORT_ALIGNED(m)) - { - len--; - - if((*m) == val) - { - result = (void *)m; - goto out; - } - - m++; - - len--; - - if((*m) == val) - { - result = (void *)m; - goto out; - } - - m++; - } - - /* If the memory block is aligned to an address from which - * data can be read one long word at a time, perform the - * search in this manner. - */ - if(len >= sizeof(long) && IS_LONG_ALIGNED(m)) - { - const unsigned long * _m = (const unsigned long *)m; - unsigned long _val = val; - unsigned long x; - - /* Build a long word which contains the byte value to - * find, repeated four times. - */ - _val |= (_val << 8); - _val |= (_val << 16); - - do - { - /* Technically, what we want to achieve is to look - * at a single long word and be able to tell whether - * it contains the value we are looking for in one - * of the octets which it consists of. This is - * achieved by an XOR operation which sets those - * octets to zero which match the search value. The - * result of this operation is then tested to see - * whether it contains any zero octets. - */ - x = (*_m) ^ _val; - if(LONG_CONTAINS_ZERO_OCTET(x)) - { - /* We got what we wanted. Now figure out which byte - * would match the value we were looking for. - */ - m = (const unsigned char *)_m; - goto out; - } - - _m++; - len -= sizeof(long); - } - while(len >= sizeof(long)); - - m = (const unsigned char *)_m; - } - } - - out: - - /* If there are bytes left in need of comparison, take - * care of them here. This also includes 'aborted' - * comparison attempts from above. - */ - while(len-- > 0) - { - if((*m) == val) - { - result = (void *)m; - break; - } - - m++; - } - - return(result); -} - -/****************************************************************************/ - -void * -memchr(const void * ptr, int val, size_t len) -{ - const unsigned char * m = ptr; - void * result = NULL; - - assert( ptr != NULL ); - assert( (int)len >= 0 ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(len > 0) - { - #if 0 - { - val &= 255; - - do - { - if((*m) == val) - { - result = (void *)m; - break; - } - - m++; - } - while(--len > 0); - } - #else - { - result = __memchr(m,(unsigned char)(val & 255),len); - } - #endif - } - - out: - - return(result); -} diff --git a/library/string_memcmp.c b/library/string_memcmp.c deleted file mode 100644 index b258786..0000000 --- a/library/string_memcmp.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * $Id: string_memcmp.c,v 1.6 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -INLINE STATIC int -__memcmp(const char *m1,const char *m2,size_t len) -{ - int result = 0; - - assert( m1 != NULL && m2 != NULL && len > 0 ); - - /* The setup below is intended to speed up searching in larger - * memory blocks. This can be very elaborate and should not be - * done unless a payoff can be expected. - */ - if(len > 4 * sizeof(long)) - { - /* Try to align both memory blocks to even addresses. */ - if(IS_UNALIGNED(m1) && IS_UNALIGNED(m2)) - { - len--; - - if((*m1) != (*m2)) - { - result = (*m1) - (*m2); - goto out; - } - - m1++; - m2++; - } - - /* Try to align both memory blocks to addresses which are a - * long word multiple. - */ - if(len >= sizeof(short) && IS_SHORT_ALIGNED(m1) && IS_SHORT_ALIGNED(m2)) - { - const short * _m1 = (const short *)m1; - const short * _m2 = (const short *)m2; - - /* Check if the two words are different, and if they are, - * figure out down below which of the bytes were different. - */ - if((*_m1++) != (*_m2++)) - goto out; - - m1 = (const char *)_m1; - m2 = (const char *)_m2; - - len -= sizeof(short); - } - - /* If both memory blocks are aligned to addresses which can be - * read directly one long word at a time, perform the comparison - * in that manner. - */ - if(len >= sizeof(long) && IS_LONG_ALIGNED(m1) && IS_LONG_ALIGNED(m2)) - { - const long * _m1 = (const long *)m1; - const long * _m2 = (const long *)m2; - - do - { - /* If the two long words are different, figure out down - * below which of the bytes were different. - */ - if((*_m1) != (*_m2)) - { - m1 = (const char *)_m1; - m2 = (const char *)_m2; - - goto out; - } - - _m1++; - _m2++; - - len -= sizeof(long); - } - while(len >= sizeof(long)); - - m1 = (const char *)_m1; - m2 = (const char *)_m2; - } - } - - out: - - /* If there are bytes left in need of comparison, take - * care of them here. This also includes 'aborted' - * comparison attempts from above. - */ - while(len-- > 0) - { - if((*m1) != (*m2)) - { - result = (*m1) - (*m2); - break; - } - - m1++; - m2++; - } - - return(result); -} - -/****************************************************************************/ - -/* This is ugly: GCC 2.95.x assumes that 'unsigned long' is used in the built-in - memcmp/memcpy/memset functions instead of 'size_t'. This can produce warnings - where none are necessary. */ -#if defined(__GNUC__) && (__GNUC__ < 3) -int -memcmp(const void *ptr1, const void *ptr2, unsigned long len) -#else -int -memcmp(const void *ptr1, const void *ptr2, size_t len) -#endif /* __GNUC__ && __GNUC__ < 3 */ -{ - int result = 0; - - assert( ptr1 != NULL && ptr2 != NULL ); - assert( (int)len >= 0 ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(ptr1 == NULL || ptr2 == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(ptr1 != ptr2 && len > 0) - { - const char * m1 = ptr1; - const char * m2 = ptr2; - - #if 0 - { - do - { - if((*m1) != (*m2)) - { - result = (*m1) - (*m2); - break; - } - - m1++; - m2++; - } - while(--len > 0); - } - #else - { - result = __memcmp(m1,m2,len); - } - #endif - } - - out: - - return(result); -} diff --git a/library/string_memcpy.c b/library/string_memcpy.c deleted file mode 100644 index 4588b2c..0000000 --- a/library/string_memcpy.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - * $Id: string_memcpy.c,v 1.6 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -#if (defined(__GNUC__) && defined(__mc68020__) && defined(NDEBUG) && defined(undefined)) - -/****************************************************************************/ - -asm(" - .text - .even - - .globl ___bcopy - -___bcopy: - - moveml sp@(4),a0-a1 - movel sp@(12),d0 - - movew a0,d1 | Make sure that A0 is long word aligned. - andiw #3,d1 - beq already_aligned - - notw d1 | This may de-align A1, but that's life. - andiw #3,d1 - -align_loop: - - moveb a0@+,a1@+ | Move from one to four bytes to long - subql #1,d0 | word align A0. - dbeq d1,align_loop - beq done - -already_aligned: - - movew d0,d1 - andiw #511,d1 - movew d1,sp@- - moveq #9,d1 - lsrl d1,d0 - beq no_big_chunks_to_move - - moveml d2-d7/a2-a6,sp@- - swap d0 - movew d0,sp@- - swap d0 - bra move_big_chunk_end - -move_big_chunk: - - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@ - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(48) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(96) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(144) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(192) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(240) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(288) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(336) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(384) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(432) - moveml a0@+,d1-d7/a2 - moveml d1-d7/a2,a1@(480) - addaw #512,a1 - -move_big_chunk_end: - - dbf d0,move_big_chunk - subqw #1,sp@ - bge move_big_chunk - - addqw #2,sp - - moveml sp@+,d2-d7/a2-a6 - -no_big_chunks_to_move: - - movew sp@+,d0 - - movew d0,d1 - lsrw #5,d1 | D1 now holds numbytes / 32 and - andiw #31,d0 | D0 holds numbytes % 32. - - bra move_eight_longs_end - -move_eight_longs: - - movel a0@+,a1@+ - movel a0@+,a1@+ - movel a0@+,a1@+ - movel a0@+,a1@+ - movel a0@+,a1@+ - movel a0@+,a1@+ - movel a0@+,a1@+ - movel a0@+,a1@+ - -move_eight_longs_end: - - dbf d1,move_eight_longs - - movew d0,d1 - lsrw #2,d1 | D1 now holds numbytes / 4 and - - bra move_long_end - -move_long: - - movel a0@+,a1@+ - -move_long_end: - - dbf d1,move_long - - andiw #3,d0 | D0 holds numbytes % 4. - bra move_byte_end - -move_byte: - - moveb a0@+,a1@+ - -move_byte_end: - - dbf d0,move_byte - -done: - - rts - -"); - -/****************************************************************************/ - -extern void __bcopy(const void *src,void *dst,size_t len); - -/****************************************************************************/ - -/* This is ugly: GCC 2.95.x assumes that 'unsigned long' is used in the built-in - memcmp/memcpy/memset functions instead of 'size_t'. This can produce warnings - where none are necessary. */ -#if defined(__GNUC__) && (__GNUC__ < 3) -void * -memcpy(void *dst, const void *src, unsigned long len) -#else -void * -memcpy(void *dst, const void *src, size_t len) -#endif /* __GNUC__ && __GNUC__ < 3 */ -{ - void * result = dst; - - assert( (len == 0) || (dst != NULL && src != NULL && (int)len > 0) ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(dst == NULL || src == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(len > 0 && dst != src) - { - /* The two memory regions may not overlap. */ - assert((dst) >= (src)+len || - (src) >= (dst)+len); - - __bcopy(src,dst,len); - } - - out: - - return(result); -} - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC VOID -__memcpy(unsigned char * to,unsigned char * from,size_t len) -{ - /* The setup below is intended to speed up copying larger - * memory blocks. This can be very elaborate and should not be - * done unless a payoff can be expected. - */ - if(len > 4 * sizeof(long)) - { - /* Try to align both source and destination to an even address. */ - if(IS_UNALIGNED(to) && IS_UNALIGNED(from)) - { - (*to++) = (*from++); - len--; - } - - /* Try to align both source and destination to addresses which are - * multiples of four. - */ - if(len >= sizeof(short) && IS_SHORT_ALIGNED(to) && IS_SHORT_ALIGNED(from)) - { - (*to++) = (*from++); - (*to++) = (*from++); - - len -= sizeof(short); - } - - /* If both source and destination are aligned to addresses which are - * multiples of four and there is still enough data left to be copied, - * try to move it in larger chunks. - */ - if(len >= sizeof(long) && IS_LONG_ALIGNED(to) && IS_LONG_ALIGNED(from)) - { - unsigned long * _to = (unsigned long *)to; - unsigned long * _from = (unsigned long *)from; - - /* An unrolled transfer loop, which shifts 32 bytes per iteration. */ - while(len >= 8 * sizeof(long)) - { - /* The following should translate into load/store - opcodes which encode the access offsets (0..7) - into the respective displacement values. This - should help the PowerPC by avoiding pipeline - stalls (removing the postincrement on the address - will do that) but has no noticeable impact on the - 68k platform (I checked). */ - - _to[0] = _from[0]; - _to[1] = _from[1]; - _to[2] = _from[2]; - _to[3] = _from[3]; - _to[4] = _from[4]; - _to[5] = _from[5]; - _to[6] = _from[6]; - _to[7] = _from[7]; - - _to += 8; - _from += 8; - - /* - (*_to++) = (*_from++); - (*_to++) = (*_from++); - (*_to++) = (*_from++); - (*_to++) = (*_from++); - (*_to++) = (*_from++); - (*_to++) = (*_from++); - (*_to++) = (*_from++); - (*_to++) = (*_from++); - */ - - len -= 8 * sizeof(long); - } - - /* Try to mop up any small amounts of data still in need of - * copying... - */ - while(len >= sizeof(long)) - { - (*_to++) = (*_from++); - - len -= sizeof(long); - } - - to = (char *)_to; - from = (char *)_from; - } - } - - /* If there's anything left, copy the rest. */ - while(len-- > 0) - (*to++) = (*from++); -} - -/****************************************************************************/ - -/* This is ugly: GCC 2.95.x assumes that 'unsigned long' is used in the built-in - memcmp/memcpy/memset functions instead of 'size_t'. This can produce warnings - where none are necessary. */ -#if defined(__GNUC__) && (__GNUC__ < 3) -void * -memcpy(void *dst, const void *src, unsigned long len) -#else -void * -memcpy(void *dst, const void *src, size_t len) -#endif /* __GNUC__ && __GNUC__ < 3 */ -{ - void * result = dst; - - assert( (len == 0) || (dst != NULL && src != NULL && (int)len > 0) ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(dst == NULL || src == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(len > 0 && dst != src) - { - char * to = dst; - const char * from = src; - - /* The two memory regions may not overlap. */ - assert((to) >= (from)+len || - (from) >= (to )+len); - - #if 0 - { - while(len-- > 0) - (*to++) = (*from++); - } - #else - { - __memcpy((unsigned char *)to,(unsigned char *)from,len); - } - #endif - } - - out: - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ && __mc68020__ */ diff --git a/library/string_memmove.c b/library/string_memmove.c deleted file mode 100644 index 6c0b0fe..0000000 --- a/library/string_memmove.c +++ /dev/null @@ -1,617 +0,0 @@ -/* - * $Id: string_memmove.c,v 1.5 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -#if (defined(__GNUC__) && defined(__mc68020__) && defined(NDEBUG) && defined(undefined)) - -/****************************************************************************/ - -asm(" - .text - .even - - .globl ___ovbcopy - -___ovbcopy: - - moveml sp@(4),a0-a1 - movel sp@(12),d0 - - movel a2,sp@- - cmpal a0,a1 - bcs forwards - -| If A0 is less than A1 then we _may_ have to do the memory move -| backwards. However, since doing the memory move backwards is less -| efficient if we have to do any byte moves, I'll first check to see -| whether there is actually any overlap. - - lea a0@(0,d0:l),a2 - cmpal a2,a1 | If A2 is greater than A1 then there is overlap, - bcs backwards | and we'd better do the move backwards. - -forwards: - - movew a0,d1 | Make sure that A0 is long word aligned. - notw d1 | This may de-align A1, but that's life. - andiw #3,d1 - -align_loop1: - - moveb a0@+,a1@+ | Move from one to four bytes to long - subql #1,d0 | word align A0. - dbeq d1,align_loop1 - beq done - - movew d0,d1 - andiw #511,d1 - movew d1,sp@- - moveq #9,d1 - lsrl d1,d0 - beq no_big_chunks_to_move1 - - moveml d2-d7/a3-a6,sp@- - swap d0 - movew d0,sp@- - swap d0 - - bras move_big_chunk_end1 - -move_big_chunk1: - - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@ - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(48) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(96) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(144) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(192) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(240) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(288) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(336) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(384) - moveml a0@+,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@(432) - moveml a0@+,d1-d7/a2 - moveml d1-d7/a2,a1@(480) - addaw #512,a1 - -move_big_chunk_end1: - - dbf d0,move_big_chunk1 - - subqw #1,sp@ - bge move_big_chunk1 - - addqw #2,sp - - moveml sp@+,d2-d7/a3-a6 - -no_big_chunks_to_move1: - - movew sp@+,d0 - - movew d0,d1 - lsrw #5,d1 | D1 now holds numbytes / 32 and - andiw #31,d0 | D0 holds numbytes % 32. - - bras move_eight_longs_end1 - -move_eight_longs1: - - movel a0@+,a1@+ - movel a0@+,a1@+ - movel a0@+,a1@+ - movel a0@+,a1@+ - movel a0@+,a1@+ - movel a0@+,a1@+ - movel a0@+,a1@+ - movel a0@+,a1@+ - -move_eight_longs_end1: - - dbf d1,move_eight_longs1 - - movew d0,d1 - lsrw #2,d1 | D1 now holds numbytes / 4 - - bras move_long_end1 - -move_long1: - - movel a0@+,a1@+ - -move_long_end1: - - dbf d1,move_long1 - - andiw #3,d0 | D0 now holds numbytes % 4. - - bra move_byte_end1 - -move_byte1: - - moveb a0@+,a1@+ - -move_byte_end1: - - dbf d0,move_byte1 - -done: - - movel sp@+,a2 - rts - -backwards: - - addal d0,a0 - addal d0,a1 - - movew a0,d1 | Make sure that A0 is long word aligned. - subqw #1,d1 | This may de-align A1, but that's life. - andiw #3,d1 - -align_loop2: - - moveb a0@-,a1@- - subql #1,d0 - dbeq d1,align_loop2 - beq done - - movew d0,d1 - andiw #511,d1 - movew d1,sp@- - moveq #9,d1 - lsrl d1,d0 - beq no_big_chunks_to_move2 - - moveml d2-d7/a3-a6,sp@- - swap d0 - movew d0,sp@- - swap d0 - - subaw #48,a0 - bras move_big_chunk_end2 - -move_big_chunk2: - - moveml a0@,d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@- - moveml a0@(-48),d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@- - moveml a0@(-96),d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@- - moveml a0@(-144),d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@- - moveml a0@(-192),d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@- - moveml a0@(-240),d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@- - moveml a0@(-288),d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@- - moveml a0@(-336),d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@- - moveml a0@(-384),d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@- - moveml a0@(-432),d1-d7/a2-a6 - moveml d1-d7/a2-a6,a1@- - moveml a0@(-464),d1-d7/a2 - moveml d1-d7/a2,a1@- - subaw #512,a0 - -move_big_chunk_end2: - - dbf d0,move_big_chunk2 - - subqw #1,sp@ - bge move_big_chunk2 - - addaw #48,a0 - - addqw #2,sp - - moveml sp@+,d2-d7/a3-a6 - -no_big_chunks_to_move2: - - movew sp@+,d0 - - movew d0,d1 - lsrw #5,d1 | D1 now holds numbytes / 32 and - andiw #31,d0 | D0 holds numbytes % 32. - - bras move_eight_longs_end2 - -move_eight_longs2: - - movel a0@-,a1@- - movel a0@-,a1@- - movel a0@-,a1@- - movel a0@-,a1@- - movel a0@-,a1@- - movel a0@-,a1@- - movel a0@-,a1@- - movel a0@-,a1@- - -move_eight_longs_end2: - - dbf d1,move_eight_longs2 - - movew d0,d1 - lsrw #2,d1 | D1 now holds numbytes / 4 - - bra move_long_end2 - -move_long2: - - movel a0@-,a1@- - -move_long_end2: - - dbf d1,move_long2 - - andiw #3,d0 | D0 now holds numbytes % 4. - bra move_byte_end2 - -move_byte2: - - moveb a0@-,a1@- - -move_byte_end2: - - dbf d0,move_byte2 - - movel sp@+,a2 - rts - -"); - -/****************************************************************************/ - -extern void __ovbcopy(const void * src,void * dest,size_t len); - -/****************************************************************************/ - -void * -memmove(void *dest, const void * src, size_t len) -{ - void * result = dest; - - assert( (len == 0) || (dest != NULL && src != NULL && (int)len > 0) ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(dest == NULL || src == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(len > 0 && dest != src) - __ovbcopy(src,dest,len); - - out: - - return(result); -} - -/****************************************************************************/ - -#else - -/****************************************************************************/ - -INLINE STATIC VOID -__memmove(unsigned char * to,unsigned char * from,size_t len) -{ - if(from < to && to < from + len) - { - to += len; - from += len; - - /* The setup below is intended to speed up copying larger - * memory blocks. This can be very elaborate and should not be - * done unless a payoff can be expected. - */ - if(len > 4 * sizeof(long)) - { - size_t distance; - - /* Try to align both source and destination to an even address. */ - if(IS_UNALIGNED(to) && IS_UNALIGNED(from)) - { - (*--to) = (*--from); - len--; - } - - /* Try to align both source and destination to addresses which are - * multiples of four. - */ - if(len >= sizeof(short) && IS_SHORT_ALIGNED(to) && IS_SHORT_ALIGNED(from)) - { - (*--to) = (*--from); - (*--to) = (*--from); - - len -= sizeof(short); - } - - /* Check the distance between source and destination. If it's shorter - * than a long word, don't dive into the copying routine below since - * the overlapping copying may clobber data. - */ - distance = (size_t)(to - from); - - /* If both source and destination are aligned to addresses which are - * multiples of four and there is still enough data left to be copied, - * try to move it in larger chunks. - */ - if(distance >= sizeof(long) && len >= sizeof(long) && IS_LONG_ALIGNED(to) && IS_LONG_ALIGNED(from)) - { - unsigned long * _to = (unsigned long *)to; - unsigned long * _from = (unsigned long *)from; - - /* An unrolled transfer loop, which shifts 32 bytes per iteration. */ - while(len >= 8 * sizeof(long)) - { - /* The following should translate into load/store - opcodes which encode the access offsets (-1..-8) - into the respective displacement values. This - should help the PowerPC by avoiding pipeline - stalls (removing the predecrement on the address - will do that) but has no noticeable impact on the - 68k platform (I checked). */ - - _to[-1] = _from[-1]; - _to[-2] = _from[-2]; - _to[-3] = _from[-3]; - _to[-4] = _from[-4]; - _to[-5] = _from[-5]; - _to[-6] = _from[-6]; - _to[-7] = _from[-7]; - _to[-8] = _from[-8]; - - _to -= 8; - _from -= 8; - - /* - (*--_to) = (*--_from); - (*--_to) = (*--_from); - (*--_to) = (*--_from); - (*--_to) = (*--_from); - (*--_to) = (*--_from); - (*--_to) = (*--_from); - (*--_to) = (*--_from); - (*--_to) = (*--_from); - */ - - len -= 8 * sizeof(long); - } - - /* Try to mop up any small amounts of data still in need of - * copying... - */ - while(len >= sizeof(long)) - { - (*--_to) = (*--_from); - - len -= sizeof(long); - } - - to = (char *)_to; - from = (char *)_from; - } - } - - /* If there's anything left, copy the rest. */ - while(len-- > 0) - (*--to) = (*--from); - } - else - { - /* The setup below is intended to speed up copying larger - * memory blocks. This can be very elaborate and should not be - * done unless a payoff can be expected. - */ - if(len > 4 * sizeof(long)) - { - size_t distance; - - /* Try to align both source and destination to an even address. */ - if(IS_UNALIGNED(to) && IS_UNALIGNED(from)) - { - (*to++) = (*from++); - len--; - } - - /* Try to align both source and destination to addresses which are - * multiples of four. - */ - if(len >= sizeof(short) && IS_SHORT_ALIGNED(to) && IS_SHORT_ALIGNED(from)) - { - (*to++) = (*from++); - (*to++) = (*from++); - - len -= sizeof(short); - } - - /* Check the distance between source and destination. If it's shorter - * than a long word, don't dive into the copying routine below since - * the overlapping copying may clobber data. - */ - if(to >= from) - distance = (size_t)(to - from); - else - distance = (size_t)(from - to); - - /* If both source and destination are aligned to addresses which are - * multiples of four and there is still enough data left to be copied, - * try to move it in larger chunks. - */ - if(distance >= sizeof(long) && len >= sizeof(long) && IS_LONG_ALIGNED(to) && IS_LONG_ALIGNED(from)) - { - unsigned long * _to = (unsigned long *)to; - unsigned long * _from = (unsigned long *)from; - - /* An unrolled transfer loop, which shifts 32 bytes per iteration. */ - while(len >= 8 * sizeof(long)) - { - /* The following should translate into load/store - opcodes which encode the access offsets (0..7) - into the respective displacement values. This - should help the PowerPC by avoiding pipeline - stalls (removing the postincrement on the address - will do that) but has no noticeable impact on the - 68k platform (I checked). */ - - _to[0] = _from[0]; - _to[1] = _from[1]; - _to[2] = _from[2]; - _to[3] = _from[3]; - _to[4] = _from[4]; - _to[5] = _from[5]; - _to[6] = _from[6]; - _to[7] = _from[7]; - - _to += 8; - _from += 8; - - /* - (*_to++) = (*_from++); - (*_to++) = (*_from++); - (*_to++) = (*_from++); - (*_to++) = (*_from++); - (*_to++) = (*_from++); - (*_to++) = (*_from++); - (*_to++) = (*_from++); - (*_to++) = (*_from++); - */ - - len -= 8 * sizeof(long); - } - - /* Try to mop up any small amounts of data still in need of - * copying... - */ - while(len >= sizeof(long)) - { - (*_to++) = (*_from++); - - len -= sizeof(long); - } - - to = (char *)_to; - from = (char *)_from; - } - } - - /* If there's anything left, copy the rest. */ - while(len-- > 0) - (*to++) = (*from++); - } -} - -/****************************************************************************/ - -void * -memmove(void *dest, const void * src, size_t len) -{ - void * result = dest; - - assert( (len == 0) || (dest != NULL && src != NULL && (int)len > 0) ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(dest == NULL || src == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(len > 0 && dest != src) - { - char * to = dest; - const char * from = src; - - #if 0 - { - if(from < to && to < from + len) - { - to += len; - from += len; - - while(len-- > 0) - (*--to) = (*--from); - } - else - { - while(len-- > 0) - (*to++) = (*from++); - } - } - #else - { - __memmove((unsigned char *)to,(unsigned char *)from,len); - } - #endif - } - - out: - - return(result); -} - -/****************************************************************************/ - -#endif /* __GNUC__ && __mc68020__ */ diff --git a/library/string_memset.c b/library/string_memset.c deleted file mode 100644 index f99c56f..0000000 --- a/library/string_memset.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * $Id: string_memset.c,v 1.6 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -INLINE STATIC VOID -__memset(unsigned char * to,unsigned char value,size_t len) -{ - /* The setup below is intended to speed up changing larger - * memory blocks. This can be very elaborate and should not be - * done unless a payoff can be expected. - */ - if(len > 4 * sizeof(long)) - { - if(IS_UNALIGNED(to)) - { - (*to++) = value; - len--; - } - - if(len >= sizeof(short) && IS_SHORT_ALIGNED(to)) - { - (*to++) = value; - (*to++) = value; - - len -= sizeof(short); - } - - if(len >= sizeof(long) && IS_LONG_ALIGNED(to)) - { - unsigned long * _to = (unsigned long *)to; - unsigned long _value = value; - - _value |= (_value << 8); - _value |= (_value << 16); - - while(len >= 8 * sizeof(long)) - { - /* The following should translate into load/store - opcodes which encode the access offsets (0..7) - into the respective displacement values. This - should help the PowerPC by avoiding pipeline - stalls (removing the postincrement on the address - will do that) but has no noticeable impact on the - 68k platform (I checked). */ - - _to[0] = _value; - _to[1] = _value; - _to[2] = _value; - _to[3] = _value; - _to[4] = _value; - _to[5] = _value; - _to[6] = _value; - _to[7] = _value; - - _to += 8; - - /* - (*_to++) = _value; - (*_to++) = _value; - (*_to++) = _value; - (*_to++) = _value; - (*_to++) = _value; - (*_to++) = _value; - (*_to++) = _value; - (*_to++) = _value; - */ - - len -= 8 * sizeof(long); - } - - while(len >= sizeof(long)) - { - (*_to++) = _value; - - len -= sizeof(long); - } - - to = (char *)_to; - } - } - - while(len-- > 0) - (*to++) = value; -} - -/****************************************************************************/ - -/* This is ugly: GCC 2.95.x assumes that 'unsigned long' is used in the built-in - memcmp/memcpy/memset functions instead of 'size_t'. This can produce warnings - where none are necessary. */ -#if defined(__GNUC__) && (__GNUC__ < 3) -void * -memset(void *ptr, int val, unsigned long len) -#else -void * -memset(void *ptr, int val, size_t len) -#endif /* __GNUC__ && __GNUC__ < 3 */ -{ - void * result = ptr; - unsigned char * m = ptr; - - assert( (len == 0) || (ptr != NULL && (int)len > 0) ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if 0 - { - while(len-- > 0) - (*m++) = val; - } - #else - { - __memset(m,(unsigned char)(val & 255),len); - } - #endif - - out: - - return(result); -} diff --git a/library/string_rindex.c b/library/string_rindex.c deleted file mode 100644 index 56c864d..0000000 --- a/library/string_rindex.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id: string_rindex.c,v 1.3 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -char * -rindex(const char *s, int c) -{ - char * result; - - result = strrchr(s,c); - - return(result); -} diff --git a/library/string_strcat.c b/library/string_strcat.c deleted file mode 100644 index 16de5bd..0000000 --- a/library/string_strcat.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: string_strcat.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -char * -strcat(char *dest, const char *src) -{ - char * result = dest; - - assert( dest != NULL && src != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(dest == NULL || src == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - while((*dest) != '\0') - dest++; - - while(((*dest++) = (*src++)) != '\0') - DO_NOTHING; - - out: - - return(result); -} diff --git a/library/string_strchr.c b/library/string_strchr.c deleted file mode 100644 index a90d7df..0000000 --- a/library/string_strchr.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * $Id: string_strchr.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -char * -strchr(const char *s, int c) -{ - const unsigned char * us = (const unsigned char *)s; - char * result = NULL; - unsigned char us_c; - unsigned char find_this = (c & 0xff); - - assert( s != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(us == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - while(TRUE) - { - us_c = (*us); - if(us_c == find_this) - { - result = (char *)us; - break; - } - - if(us_c == '\0') - break; - - us++; - } - - out: - - return(result); -} diff --git a/library/string_strcmp.c b/library/string_strcmp.c deleted file mode 100644 index 584ad39..0000000 --- a/library/string_strcmp.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * $Id: string_strcmp.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -int -strcmp(const char *s1, const char * s2) -{ - int result = 0; - - assert( s1 != NULL && s2 != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s1 == NULL || s2 == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(s1 != s2) - { - while((*s1) == (*s2)) - { - if((*s1) == '\0') - break; - - s1++; - s2++; - } - - result = (*s1) - (*s2); - } - - out: - - return(result); -} diff --git a/library/string_strcoll.c b/library/string_strcoll.c deleted file mode 100644 index bb71bc7..0000000 --- a/library/string_strcoll.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * $Id: string_strcoll.c,v 1.4 2005-02-27 21:58:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -int -strcoll(const char *s1, const char *s2) -{ - DECLARE_LOCALEBASE(); - int result = 0; - - assert( s1 != NULL && s2 != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s1 == NULL || s2 == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - __locale_lock(); - - if(__locale_table[LC_COLLATE] != NULL) - { - assert( LocaleBase != NULL ); - - result = StrnCmp(__locale_table[LC_COLLATE],(STRPTR)s1,(STRPTR)s2,-1,SC_COLLATE1); - } - else - { - result = strcmp(s1,s2); - } - - __locale_unlock(); - - out: - - return(result); -} diff --git a/library/string_strcpy.c b/library/string_strcpy.c deleted file mode 100644 index c93b058..0000000 --- a/library/string_strcpy.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: string_strcpy.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -char * -strcpy(char *dest, const char *src) -{ - char * result = dest; - - assert( dest != NULL && src != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(dest == NULL || src == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(dest != src) - { - while(((*dest++) = (*src++)) != '\0') - DO_NOTHING; - } - - out: - - return(result); -} diff --git a/library/string_strcspn.c b/library/string_strcspn.c deleted file mode 100644 index f868964..0000000 --- a/library/string_strcspn.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * $Id: string_strcspn.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -size_t -strcspn(const char *s, const char *set) -{ - const char * start = s; - size_t result = 0; - char c; - - assert(s != NULL && set != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s == NULL || set == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - while((c = (*s)) != '\0') - { - /* Is this character found in the set? */ - if(strchr(set,c) != NULL) - break; /* Stop if it's in there. */ - - s++; - } - - result = (size_t)(s - start); - - out: - - return(result); -} diff --git a/library/string_strdup.c b/library/string_strdup.c deleted file mode 100644 index e36cbab..0000000 --- a/library/string_strdup.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * $Id: string_strdup.c,v 1.8 2005-03-19 10:15:56 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#undef strdup - -/****************************************************************************/ - -__static char * -__strdup(const char *s,const char * file,int line) -{ - char * result = NULL; - size_t total_size; - - assert( s != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - total_size = strlen(s)+1; - - result = __malloc(total_size,file,line); - if(result == NULL) - goto out; - - memmove(result,s,total_size); - - out: - - return(result); -} - -/****************************************************************************/ - -char * -strdup(const char *s) -{ - char * result; - - result = __strdup(s,NULL,0); - - return(result); -} diff --git a/library/string_strerror.c b/library/string_strerror.c deleted file mode 100644 index 4ab4043..0000000 --- a/library/string_strerror.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * $Id: string_strerror.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -static char * error_table[EILSEQ - EPERM + 1] = -{ - "Operation not permitted", - "No such file or directory", - "No such process", - "Interrupted system call", - "Input/output error", - "Device not configured", - "Argument list too long", - "Exec format error", - "Bad file descriptor", - "No child processes", - "Resource deadlock avoided", - "Cannot allocate memory", - "Permission denied", - "Bad address", - "Block device required", - "Device busy", - "File exists", - "Cross-device link", - "Operation not supported by device", - "Not a directory", - "Is a directory", - "Invalid argument", - "Too many open files in system", - "Too many open files", - "Inappropriate ioctl for device", - "Text file busy", - "File too large", - "No space left on device", - "Illegal seek", - "Read-only file system", - "Too many links", - "Broken pipe", - "Numerical argument out of domain", - "Result too large", - "Resource temporarily unavailable", - "Operation now in progress", - "Operation already in progress", - "Socket operation on non-socket", - "Destination address required", - "Message too long", - "Protocol wrong type for socket", - "Protocol not available", - "Protocol not supported", - "Socket type not supported", - "Operation not supported on socket", - "Protocol family not supported", - "Address family not supported by protocol family", - "Address already in use", - "Can't assign requested address", - "Network is down", - "Network is unreachable", - "Network dropped connection on reset", - "Software caused connection abort", - "Connection reset by peer", - "No buffer space available", - "Socket is already connected", - "Socket is not connected", - "Can't send after socket shutdown", - "Too many references: can't splice", - "Connection timed out", - "Connection refused", - "Too many levels of symbolic links", - "File name too long", - "Host is down", - "No route to host", - "Directory not empty", - "Too many processes", - "Too many users", - "Disc quota exceeded", - "Stale NFS file handle", - "Too many levels of remote in path", - "RPC struct is bad", - "RPC version wrong", - "RPC program not available", - "Program version wrong", - "Bad procedure for program", - "No locks available", - "Function not implemented", - "Inappropriate file type or format", - "Authentication error", - "Need authenticator", - "Identifier removed", - "No message of the desired type.", - "Value too large to be stored in data type.", - "Encoding error detected" -}; - -/****************************************************************************/ - -char * -strerror(int error_number) -{ - char * result; - - if(error_number < EPERM || error_number > EILSEQ) - { - static char error_buffer[80]; - char number[30]; - char *s = number; - int is_negative = 0; - unsigned int n; - int i,len,c; - - /* We convert the error number into in an unsigned - integer, so that numbers such as 0x80000000 - can come out of the conversion. */ - if(error_number < 0) - { - is_negative = 1; - - n = (-error_number); - } - else - { - n = error_number; - } - - /* Convert the error number into a string of digits. */ - len = 0; - - do - { - (*s++) = '0' + (n % 10); - n /= 10; - len++; - } - while(n > 0 && len < (int)sizeof(number)-1); - - /* Add the sign, if necessary. */ - if(is_negative && len < (int)sizeof(number)-1) - { - (*s++) = '-'; - len++; - } - - (*s) = '\0'; - - /* Reverse the string in place. */ - for(i = 0 ; i < len / 2 ; i++) - { - c = number[len-1-i]; - number[len-1-i] = number[i]; - number[i] = c; - } - - strcpy(error_buffer,"Unknown error "); - strcat(error_buffer,number); - - result = error_buffer; - } - else - { - result = error_table[error_number - EPERM]; - } - - return(result); -} diff --git a/library/string_strlcat.c b/library/string_strlcat.c deleted file mode 100644 index 26ffb45..0000000 --- a/library/string_strlcat.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * $Id: string_strlcat.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -/****************************************************************************/ - -/* - * Copyright (c) 1998 Todd C. Miller - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -/* - * Appends src to string dst of size siz (unlike strncat, siz is the - * full size of dst, not space left). At most siz-1 characters - * will be copied. Always NUL terminates (unless siz <= strlen(dst)). - * Returns strlen(src) + MIN(siz, strlen(initial dst)). - * If retval >= siz, truncation occurred. - */ -size_t -strlcat(char *dst, const char *src, size_t siz) -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - size_t result; - size_t dlen; - - assert( src != NULL && (siz == 0 || dst != NULL) ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(src == NULL || (siz != 0 && dst == NULL)) - { - __set_errno(EFAULT); - - result = 0; - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* Find the end of dst and adjust bytes left but don't go past end */ - while(n-- != 0 && (*d) != '\0') - d++; - - dlen = d - dst; - n = siz - dlen; - - if (n == 0) - { - result = dlen + strlen(s); - } - else - { - while((*s) != '\0') - { - if(n != 1) - { - (*d++) = (*s); - - n--; - } - - s++; - } - - (*d) = '\0'; - - result = dlen + (s - src); /* count does not include NUL */ - } - - out: - - return(result); -} diff --git a/library/string_strlcpy.c b/library/string_strlcpy.c deleted file mode 100644 index 2da4ca3..0000000 --- a/library/string_strlcpy.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * $Id: string_strlcpy.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -/****************************************************************************/ - -/* - * Copyright (c) 1998 Todd C. Miller - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -/* - * Copy src to string dst of size siz. At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. - */ -size_t -strlcpy(char *dst, const char *src, size_t siz) -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - size_t result; - - assert( siz == 0 || (dst != NULL && src != NULL) ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(siz != 0 && (dst == NULL || src == NULL)) - { - __set_errno(EFAULT); - - result = 0; - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* Copy as many bytes as will fit */ - if(n != 0 && --n != 0) - { - do - { - if(((*d++) = (*s++)) == '\0') - break; - } - while(--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if(n == 0) - { - if(siz != 0) - (*d) = '\0'; /* NUL-terminate dst */ - - while (*s++) - ; - } - - result = (s - src - 1); /* count does not include NUL */ - - out: - - return(result); -} diff --git a/library/string_strlen.c b/library/string_strlen.c deleted file mode 100644 index c62d1f7..0000000 --- a/library/string_strlen.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: string_strlen.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -size_t -strlen(const char *s) -{ - const char * start = s; - size_t result = 0; - - assert( s != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - while((*s) != '\0') - s++; - - result = (size_t)(s - start); - - out: - - return(result); -} diff --git a/library/string_strncat.c b/library/string_strncat.c deleted file mode 100644 index 6eb5c20..0000000 --- a/library/string_strncat.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * $Id: string_strncat.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -char * -strncat(char *dest, const char *src, size_t n) -{ - char * result = dest; - - assert( dest != NULL && src != NULL ); - assert( (int)n >= 0 ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(dest == NULL || src == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* If the number of characters is 0 or negative, then this - * function is supposed to have no effect. - */ - if((int)n > 0) - { - while((*dest) != '\0') - dest++; - - while(n-- > 0) - { - if(((*dest++) = (*src++)) == '\0') - { - /* Back up one character so that the - terminating NUL is written in the - correct location. */ - dest--; - break; - } - } - - /* Always NUL-terminate the destination string. */ - (*dest) = '\0'; - } - - out: - - return(result); -} diff --git a/library/string_strncmp.c b/library/string_strncmp.c deleted file mode 100644 index 4a0b4e1..0000000 --- a/library/string_strncmp.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * $Id: string_strncmp.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -int -strncmp(const char *s1, const char *s2, size_t n) -{ - int result = 0; - - assert( s1 != NULL && s2 != NULL ); - assert( (int)n >= 0 ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s1 == NULL || s2 == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* If the number of characters is 0 or negative, then this - * function is supposed to have no effect. - */ - if(s1 != s2 && (int)n > 0) - { - while(n-- > 0) - { - if((*s1) == (*s2)) - { - if((*s1) == '\0') - break; - - s1++; - s2++; - } - else - { - result = (*s1) - (*s2); - break; - } - } - } - - out: - - return(result); -} diff --git a/library/string_strncpy.c b/library/string_strncpy.c deleted file mode 100644 index 0a58b3e..0000000 --- a/library/string_strncpy.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * $Id: string_strncpy.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -char * -strncpy(char *dest, const char *src, size_t n) -{ - char * result = dest; - - assert( dest != NULL && src != NULL ); - assert( (int)n >= 0 ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(dest == NULL || src == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* If the number of characters is 0 or negative, then this - * function is supposed to have no effect. - */ - if((int)n > 0) - { - while(n-- > 0) - { - if(((*dest++) = (*src++)) == '\0') - { - /* Fill the rest with NUL bytes... */ - while(n-- > 0) - (*dest++) = '\0'; - - break; - } - } - } - - out: - - return(result); -} diff --git a/library/string_strpbrk.c b/library/string_strpbrk.c deleted file mode 100644 index 138c723..0000000 --- a/library/string_strpbrk.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * $Id: string_strpbrk.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -char * -strpbrk(const char *s, const char *set) -{ - char *result = NULL; - char c; - - assert(s != NULL && set != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s == NULL || set == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - while((c = (*s)) != '\0') - { - /* Is this character found in the set? */ - if(strchr(set,c) != NULL) - { - /* If it's in there, remember where we found it. */ - result = (char *)s; - break; - } - - s++; - } - - out: - - return(result); -} diff --git a/library/string_strrchr.c b/library/string_strrchr.c deleted file mode 100644 index 8e10d77..0000000 --- a/library/string_strrchr.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * $Id: string_strrchr.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -char * -strrchr(const char *s, int c) -{ - const unsigned char * us = (const unsigned char *)s; - char * result = NULL; - unsigned char us_c; - unsigned char find_this = (c & 0xff); - - assert( s != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(us == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* This is technically the opposite of strchr(), but the - * implementation is very similar. However, instead of - * stopping on the first location that holds the desired - * value we just remember where we found it. When the - * end of the string finally arrives we will thus be - * able to return a pointer to the last occurence of - * the character. - */ - while(TRUE) - { - us_c = (*us); - if(us_c == find_this) - result = (char *)us; - - if(us_c == '\0') - break; - - us++; - } - - out: - - return(result); -} diff --git a/library/string_strspn.c b/library/string_strspn.c deleted file mode 100644 index 02aa030..0000000 --- a/library/string_strspn.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * $Id: string_strspn.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -size_t -strspn(const char *s, const char *set) -{ - const char * start = s; - size_t result = 0; - char c; - - assert(s != NULL && set != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s == NULL || set == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - while((c = (*s)) != '\0') - { - /* Is this character found in the set? */ - if(strchr(set,c) == NULL) - break; /* Stop if it's not in there. */ - - s++; - } - - result = (size_t)(s - start); - - out: - - return(result); -} diff --git a/library/string_strstr.c b/library/string_strstr.c deleted file mode 100644 index 4b0a9a3..0000000 --- a/library/string_strstr.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * $Id: string_strstr.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -char * -strstr(const char *src, const char *sub) -{ - char * result = NULL; - - assert( src != NULL && sub != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(src == NULL || sub == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* If 'sub' points to a string with zero length, then - * we must return 'src'. - */ - if((*sub) == '\0') - { - result = (char *)src; - } - else - { - size_t i; - char c; - - /* Try to find 'sub' in 'src'. Watch how we avoid calling - * strlen() even once... - */ - while((*src) != '\0') - { - for(i = 0 ; ; i++) - { - c = sub[i]; - - /* End of substring? We got a match... */ - if(c == '\0') - { - result = (char *)src; - goto out; - } - - if(c != src[i]) - break; - } - - src++; - } - } - - out: - - return(result); -} diff --git a/library/string_strtok.c b/library/string_strtok.c deleted file mode 100644 index 6e84aad..0000000 --- a/library/string_strtok.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * $Id: string_strtok.c,v 1.5 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -char * -strtok(char *str, const char *separator_set) -{ - static char * last; - - char * result; - - ENTER(); - - result = strtok_r(str,separator_set,&last); - - RETURN(result); - return(result); -} diff --git a/library/string_strtok_r.c b/library/string_strtok_r.c deleted file mode 100644 index b0918d9..0000000 --- a/library/string_strtok_r.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * $Id: string_strtok_r.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -/****************************************************************************/ - -char * -strtok_r(char *str, const char *separator_set,char ** state_ptr) -{ - char * result = NULL; - char * last; - size_t size; - - assert( separator_set != NULL && state_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(separator_set == NULL || state_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - last = (*state_ptr); - - /* Did we get called before? Restart at the last valid position. */ - if(str == NULL) - { - str = last; - - /* However, we may have hit the end of the - string already. */ - if(str == NULL) - goto out; - } - - last = NULL; - - /* Skip the characters which count as - separators. */ - str += strspn(str, separator_set); - if((*str) == '\0') - goto out; - - /* Count the number of characters which aren't - separators. */ - size = strcspn(str, separator_set); - if(size == 0) - goto out; - - /* This is where the search can resume later. */ - last = &str[size]; - - /* If we didn't hit the end of the string already, - skip the separator. */ - if((*last) != '\0') - last++; - - /* This is the token we found; make sure that - it looks like a valid string. */ - str[size] = '\0'; - - result = str; - - out: - - if(state_ptr != NULL) - (*state_ptr) = last; - - return(result); -} diff --git a/library/string_strxfrm.c b/library/string_strxfrm.c deleted file mode 100644 index 611a242..0000000 --- a/library/string_strxfrm.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * $Id: string_strxfrm.c,v 1.4 2005-02-27 21:58:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRING_HEADERS_H -#include "string_headers.h" -#endif /* _STRING_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -size_t -strxfrm(char *dest, const char *src, size_t len) -{ - DECLARE_LOCALEBASE(); - size_t result = 0; - - ENTER(); - - SHOWPOINTER(dest); - SHOWSTRING(src); - SHOWVALUE(len); - - assert( src != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(src == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - __locale_lock(); - - if(__locale_table[LC_COLLATE] != NULL) - { - assert( LocaleBase != NULL ); - - result = StrConvert(__locale_table[LC_COLLATE],(STRPTR)src,dest,len,SC_COLLATE1); - } - else - { - if(len > 0 && dest != NULL) - { - char c; - - result = 0; - - while((c = (*src++)) != '\0') - { - result++; - - if(len > 0) - { - len--; - - (*dest++) = c; - } - } - - (*dest) = '\0'; - } - else - { - result = strlen(src); - } - } - - __locale_unlock(); - - out: - - RETURN(result); - return(result); -} diff --git a/library/strings_ffs.c b/library/strings_ffs.c deleted file mode 100644 index f286514..0000000 --- a/library/strings_ffs.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * $Id: strings_ffs.c,v 1.1 2005-03-02 12:57:53 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRINGS_HEADERS_H -#include "strings_headers.h" -#endif /* _STRINGS_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* Return the index of the lowest set bit. (Counted from one) */ -int -ffs(int i) -{ - int result = 0; - - if(i != 0) - { - int x; - - x = (i & (-i)) - 1; - x -= ((x >> 1) & 0x55555555); - x = ((x >> 2) & 0x33333333) + (x & 0x33333333); - x = ((x >> 4) + x) & 0x0f0f0f0f; - x += (x >> 8); - x += (x >> 16); - - result = 1 + (x & 0x3f); /* The first bit has index 1. */ - } - - return(result); -} diff --git a/library/strings_headers.h b/library/strings_headers.h deleted file mode 100644 index 66f62c7..0000000 --- a/library/strings_headers.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * $Id: strings_headers.h,v 1.3 2005-03-18 12:38:25 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRINGS_HEADERS_H -#define _STRINGS_HEADERS_H - -/****************************************************************************/ - -#include -#include -#include -#include -#include - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_H */ - -#ifndef _DEBUG_H -#include "debug.h" -#endif /* _DEBUG_H */ - -/****************************************************************************/ - -#endif /* _STRINGS_HEADERS_H */ diff --git a/library/strings_strcasecmp.c b/library/strings_strcasecmp.c deleted file mode 100644 index 202575b..0000000 --- a/library/strings_strcasecmp.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * $Id: strings_strcasecmp.c,v 1.4 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRINGS_HEADERS_H -#include "strings_headers.h" -#endif /* _STRINGS_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -strcasecmp(const char * _s1, const char * _s2) -{ - const unsigned char *s1 = (const unsigned char *)_s1; - const unsigned char *s2 = (const unsigned char *)_s2; - int result = 0; - - assert( s1 != NULL && s2 != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s1 == NULL || s2 == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(s1 != s2) - { - unsigned char c1,c2; - - while((c1 = toupper(*s1++)) == (c2 = toupper(*s2++))) - { - if(c1 == '\0') - break; - } - - result = (int)c1 - (int)c2; - } - - out: - - return(result); -} diff --git a/library/strings_strncasecmp.c b/library/strings_strncasecmp.c deleted file mode 100644 index 395f0ac..0000000 --- a/library/strings_strncasecmp.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * $Id: strings_strncasecmp.c,v 1.4 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _STRINGS_HEADERS_H -#include "strings_headers.h" -#endif /* _STRINGS_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -strncasecmp(const char * _s1, const char * _s2,size_t n) -{ - const unsigned char *s1 = (const unsigned char *)_s1; - const unsigned char *s2 = (const unsigned char *)_s2; - unsigned char c1,c2; - int result = 0; - - assert( s1 != NULL && s2 != NULL ); - assert( (int)n >= 0 ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s1 == NULL || s2 == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(s1 != s2) - { - while(n-- > 0) - { - c1 = toupper(*s1++); - c2 = toupper(*s2++); - - if(c1 == c2) - { - if(c1 == '\0') - break; - } - else - { - result = (int)c1 - (int)c2; - break; - } - } - } - - out: - - return(result); -} diff --git a/library/termios_cfgetispeed.c b/library/termios_cfgetispeed.c deleted file mode 100755 index 86e84ef..0000000 --- a/library/termios_cfgetispeed.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * $Id: termios_cfgetispeed.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TERMIOS_HEADERS_H -#include "termios_headers.h" -#endif /* _TERMIOS_HEADERS_H */ - -/****************************************************************************/ - -speed_t -cfgetispeed(struct termios *tios) -{ - speed_t result = ERROR; - - ENTER(); - - SHOWPOINTER(tios); - - if(tios == NULL) - { - __set_errno(EFAULT); - goto out; - } - - result = tios->c_ispeed; - - out: - - RETURN(result); - return(result); -} diff --git a/library/termios_cfgetospeed.c b/library/termios_cfgetospeed.c deleted file mode 100755 index 87af915..0000000 --- a/library/termios_cfgetospeed.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * $Id: termios_cfgetospeed.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TERMIOS_HEADERS_H -#include "termios_headers.h" -#endif /* _TERMIOS_HEADERS_H */ - -/****************************************************************************/ - -speed_t -cfgetospeed(struct termios *tios) -{ - speed_t result = ERROR; - - ENTER(); - - SHOWPOINTER(tios); - - if(tios == NULL) - { - __set_errno(EFAULT); - goto out; - } - - result = tios->c_ospeed; - - out: - - RETURN(result); - return(result); -} diff --git a/library/termios_cfmakeraw.c b/library/termios_cfmakeraw.c deleted file mode 100755 index 8bc0494..0000000 --- a/library/termios_cfmakeraw.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id: termios_cfmakeraw.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TERMIOS_HEADERS_H -#include "termios_headers.h" -#endif /* _TERMIOS_HEADERS_H */ - -/****************************************************************************/ - -int -cfmakeraw(struct termios *tios) -{ - int result = ERROR; - - ENTER(); - - SHOWPOINTER(tios); - - if(tios == NULL) - { - __set_errno(EFAULT); - goto out; - } - - tios->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); - tios->c_oflag &= ~OPOST; - tios->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - tios->c_cflag &= ~(CSIZE|PARENB); - tios->c_cflag |= CS8; - - result = OK; - - out: - - return(result); -} diff --git a/library/termios_cfsetispeed.c b/library/termios_cfsetispeed.c deleted file mode 100755 index 62f61fa..0000000 --- a/library/termios_cfsetispeed.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * $Id: termios_cfsetispeed.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TERMIOS_HEADERS_H -#include "termios_headers.h" -#endif /* _TERMIOS_HEADERS_H */ - -/****************************************************************************/ - -int -cfsetispeed(struct termios *tios,speed_t ispeed) -{ - int result = ERROR; - - ENTER(); - - SHOWPOINTER(tios); - SHOWVALUE(ispeed); - - if(tios == NULL) - { - __set_errno(EFAULT); - goto out; - } - - switch(ispeed) - { - case B0: - case B50: - case B75: - case B110: - case B134: - case B150: - case B200: - case B300: - case B600: - case B1200: - case B1800: - case B2400: - case B4800: - case B9600: - case B19200: - case B31250: - case B38400: - case B57600: - case B115200: - case B230400: - case B460800: - case B576000: - case B1152000: - - tios->c_ispeed = ispeed; - break; - - default: - - __set_errno(EINVAL); - goto out; - } - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/termios_cfsetospeed.c b/library/termios_cfsetospeed.c deleted file mode 100755 index 1b28213..0000000 --- a/library/termios_cfsetospeed.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * $Id: termios_cfsetospeed.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TERMIOS_HEADERS_H -#include "termios_headers.h" -#endif /* _TERMIOS_HEADERS_H */ - -/****************************************************************************/ - -int -cfsetospeed(struct termios *tios,speed_t ospeed) -{ - int result = ERROR; - - ENTER(); - - SHOWPOINTER(tios); - SHOWVALUE(ospeed); - - if(tios == NULL) - { - __set_errno(EFAULT); - goto out; - } - - switch(ospeed) - { - case B0: - case B50: - case B75: - case B110: - case B134: - case B150: - case B200: - case B300: - case B600: - case B1200: - case B1800: - case B2400: - case B4800: - case B9600: - case B19200: - case B31250: - case B38400: - case B57600: - case B115200: - case B230400: - case B460800: - case B576000: - case B1152000: - - tios->c_ospeed = ospeed; - break; - - default: - - __set_errno(EINVAL); - goto out; - } - - result = OK; - - out: - - return(result); -} diff --git a/library/termios_console_fdhookentry.c b/library/termios_console_fdhookentry.c deleted file mode 100755 index cdb4522..0000000 --- a/library/termios_console_fdhookentry.c +++ /dev/null @@ -1,654 +0,0 @@ -/* - * $Id: termios_console_fdhookentry.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TERMIOS_HEADERS_H -#include "termios_headers.h" -#endif /* _TERMIOS_HEADERS_H */ - -/****************************************************************************/ - -/* - * Hook for termios emulation on a console. This can probably be cleaned up a bit - * by removing things which will (should) never happen on a console. - */ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -#ifndef _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -/* - * Emulate canonical no-echo mode with a simple line-editor in raw mode. - */ -static int -LineEditor(BPTR file,char *buf,const int buflen,struct termios *tios) -{ - int pos = 0,len = 0; - unsigned char z; - int do_edit = 1; - int shift_mode = 0; - - SetMode(file,DOSTRUE); /* Set raw mode. */ - - while(do_edit && len < buflen) - { - if(WaitForChar(file,5000000) != DOSFALSE) /* 5 seconds. */ - { - if(Read(file,&z,1) == ERROR) - { - len = -1; - break; - } - - if(z == tios->c_cc[VQUIT]) - break; - - switch(z) - { - case '\n': /* NL */ - case '\r': /* CR */ - - do_edit = 0; - - buf[len++] = '\n'; - continue; - - case 155: /* CSI */ - - shift_mode = 1; - continue; - - case '\b': /* Backspace */ - - if(pos > 0) - { - memmove(&buf[pos-1],&buf[pos],len-pos); - pos--; - len--; - } - - continue; - - case 127: /* Delete */ - - if(pos < len) - { - memmove(&buf[pos],&buf[pos+1],len-pos-1); - len--; - } - - continue; - } - - if(shift_mode) - { - shift_mode = 0; - - switch(z) - { - case 'C': /* Right arrowkey */ - - if(pos < len) - pos++; - - continue; - - case 'D': /* Left arrowkey */ - - if(pos > 0) - pos--; - - continue; - } - } - - if(pos != len) - memmove(&buf[pos + 1],&buf[pos],len - pos); - - buf[pos]=z; - pos++; - len++; - } - } - - if(len >= 0 && len < buflen) /* Does not hurt to null-terminate if we can. */ - buf[len] = '\0'; - - SetMode(file,DOSFALSE); /* Restore mode */ - - return(len); /* Number of characters read. */ -} - -/****************************************************************************/ - -int -__termios_console_hook( - struct fd * fd, - struct file_action_message * fam) -{ - const unsigned char CR = '\r',NL = '\n'; - struct FileHandle * fh; - char * buffer = NULL; - int result = EOF; - int actual_out; - BOOL is_aliased; - BPTR file; - struct termios *tios; - - ENTER(); - - assert( fam != NULL && fd != NULL ); - assert( __is_valid_fd(fd) ); - assert( FLAG_IS_SET(fd->fd_Flags,FDF_TERMIOS) ); - assert( fd->fd_Aux != NULL); - - tios = (struct termios *)fd->fd_Aux; - - /* Careful: file_action_close has to monkey with the file descriptor - table and therefore needs to obtain the stdio lock before - it locks this particular descriptor entry. */ - if(fam->fam_Action == file_action_close) - __stdio_lock(); - - __fd_lock(fd); - - #if defined(__THREAD_SAFE) - { - /* Check if this file should be dynamically bound to one of the - three standard I/O streams. */ - if(FLAG_IS_SET(fd->fd_Flags,FDF_STDIO)) - { - switch(fd->fd_DefaultFile) - { - case STDIN_FILENO: - - file = Input(); - break; - - case STDOUT_FILENO: - - file = Output(); - break; - - case STDERR_FILENO: - - #if defined(__amigaos4__) - { - file = ErrorOutput(); - } - #else - { - struct Process * this_process = (struct Process *)FindTask(NULL); - - file = this_process->pr_CES; - } - #endif /* __amigaos4__ */ - - /* The following is rather controversial; if the standard error stream - is unavailable, we default to reuse the standard output stream. This - is problematic if the standard output stream was redirected and should - not be the same as the standard error output stream. */ - if(file == ZERO) - file = Output(); - - break; - - default: - - file = ZERO; - break; - } - } - else - { - file = fd->fd_DefaultFile; - } - } - #else - { - file = fd->fd_DefaultFile; - } - #endif /* __THREAD_SAFE */ - - if(file == ZERO) - { - SHOWMSG("file is closed"); - - fam->fam_Error = EBADF; - goto out; - } - - switch(fam->fam_Action) - { - case file_action_read: - - SHOWMSG("file_action_read"); - - if(FLAG_IS_CLEAR(tios->c_cflag,CREAD)) - { - SHOWMSG("Reading is not enabled for this console descriptor."); - fam->fam_Error = EIO; - goto out; - } - - assert( fam->fam_Data != NULL ); - assert( fam->fam_Size > 0 ); - - D(("read %ld bytes from position %ld to 0x%08lx",fam->fam_Size,Seek(file,0,OFFSET_CURRENT),fam->fam_Data)); - - PROFILE_OFF(); - - /* Attempt to fake everything needed in non-canonical mode. */ - - if(FLAG_IS_SET(tios->c_lflag,ICANON)) /* Canonical read = same as usual. Unless... */ - { - if(FLAG_IS_CLEAR(tios->c_lflag,ECHO)) /* No-echo mode needs to be emulated. */ - result = LineEditor(file,fam->fam_Data,fam->fam_Size,tios); - else - result = Read(file,fam->fam_Data,fam->fam_Size); - } - else if (fam->fam_Size > 0) - { - /* Non-canonical reads have timeouts and a minimum number of characters to read. */ - int i = 0; - - result = 0; - - if(tios->c_cc[VMIN]>0) - { - i = Read(file,fam->fam_Data,1); /* Reading the first character is not affected by the timeout unless VMIN==0. */ - if(i == ERROR) - { - fam->fam_Error = EIO; - goto out; - } - - result = i; - - while((result < tios->c_cc[VMIN]) && (result < fam->fam_Size)) - { - if(tios->c_cc[VTIME] > 0) - { - if(WaitForChar(file,100000 * tios->c_cc[VTIME]) == DOSFALSE) - break; /* No more characters available within alloted time. */ - } - - i = Read(file,&fam->fam_Data[result],1); - if(i <= 0) - break; /* Break out of this while loop only. */ - - result += i; - } - } - else - { - if(WaitForChar(fd->fd_DefaultFile,100000*tios->c_cc[VTIME])) - result = Read(file,fam->fam_Data,fam->fam_Size); - } - } - else - { - result = 0; /* Reading zero characters will always succeed. */ - } - - PROFILE_ON(); - - if(result == ERROR) - { - D(("read failed ioerr=%ld",IoErr())); - - fam->fam_Error = __translate_io_error_to_errno(IoErr()); - goto out; - } - - if(result > 0) - { - if(tios->c_iflag != 0) /* Input processing enabled. */ - { - int i,n; - int num_bytes = result; - unsigned char byte_in; - - /* XXX The input substitution could possibly be moved to the console handler with an input-map. (?) */ - for(i = n = 0 ; i < num_bytes ; i++) - { - byte_in = fam->fam_Data[i]; - - if(FLAG_IS_SET(tios->c_iflag,ISTRIP)) /* Strip 8:th bit. Done before any other processing. */ - byte_in &= 0x7f; - - if(FLAG_IS_SET(tios->c_iflag,IGNCR) && byte_in == CR) /* Remove CR */ - { - result--; - continue; - } - - if(FLAG_IS_SET(tios->c_iflag,ICRNL) && byte_in == CR) /* Map CR->NL */ - byte_in = NL; - - if(FLAG_IS_SET(tios->c_iflag,INLCR) && byte_in == NL) /* Map NL->CR */ - byte_in = CR; - - fam->fam_Data[n++] = byte_in; - } - } - - if(FLAG_IS_SET(tios->c_lflag,ECHO) && FLAG_IS_CLEAR(tios->c_lflag,ICANON) && FLAG_IS_SET(fd->fd_Flags,FDF_WRITE)) - { - if(Write(file,fam->fam_Data,result) == ERROR) - { - /* "Silently" disable echoing. */ - SHOWMSG("Echo failed and has been disabled."); - CLEAR_FLAG(tios->c_lflag,ECHO); - } - } - } - - if(FLAG_IS_SET(fd->fd_Flags,FDF_CACHE_POSITION)) - fd->fd_Position += (ULONG)result; - - break; - - case file_action_write: - - SHOWMSG("file_action_write"); - - assert( fam->fam_Data != NULL ); - assert( fam->fam_Size > 0 ); - - if(FLAG_IS_SET(tios->c_oflag,OPOST)) /* Output processing enabled. */ - { - unsigned char byte_out; - int i,n; - - buffer = malloc(2 * fam->fam_Size); - if(buffer == NULL) - { - fam->fam_Error = ENOMEM; - goto out; - } - - for(i = n = 0 ; i < fam->fam_Size ; i++) - { - byte_out=fam->fam_Data[i]; - - if(FLAG_IS_SET(tios->c_oflag,ONLRET) && byte_out == CR) - continue; - - if(FLAG_IS_SET(tios->c_oflag,OCRNL) && byte_out == CR) - byte_out = NL; - - if(FLAG_IS_SET(tios->c_oflag,ONOCR) && byte_out == CR) - byte_out = NL; - - if(FLAG_IS_SET(tios->c_oflag,ONLCR) && byte_out == NL) - { - buffer[n++] = CR; - byte_out = NL; - } - - buffer[n++] = byte_out; - } - - actual_out = n; - } - else - { - buffer = fam->fam_Data; - actual_out = fam->fam_Size; - } - - /* Note. When output processing is enabled, write() can return _more_ than the data length. */ - D(("write %ld bytes to position %ld from 0x%08lx",actual_out,Seek(file,0,OFFSET_CURRENT),buffer)); - - if(actual_out > 0) - { - PROFILE_OFF(); - - result = Write(file,buffer,actual_out); - - PROFILE_ON(); - } - else - { - result = 0; - } - - if(buffer == fam->fam_Data) - buffer = NULL; /* Must do this to avoid freeing the user data. */ - - if(result == ERROR) - { - D(("write failed ioerr=%ld",IoErr())); - - fam->fam_Error = __translate_io_error_to_errno(IoErr()); - goto out; - } - - if(FLAG_IS_SET(fd->fd_Flags,FDF_CACHE_POSITION)) - fd->fd_Position += (ULONG)result; - - break; - - case file_action_close: - - SHOWMSG("file_action_close"); - - /* The following is almost guaranteed not to fail. */ - result = OK; - - /* If this is an alias, just remove it. */ - is_aliased = __fd_is_aliased(fd); - if(is_aliased) - { - __remove_fd_alias(fd); - } - else if (FLAG_IS_CLEAR(fd->fd_Flags,FDF_STDIO)) - { - /* Should we reset this file into line buffered mode? */ - if(FLAG_IS_SET(fd->fd_Flags,FDF_NON_BLOCKING) && FLAG_IS_SET(fd->fd_Flags,FDF_IS_INTERACTIVE)) - SetMode(fd->fd_DefaultFile,DOSFALSE); - - /* Are we allowed to close this file? */ - if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_NO_CLOSE)) - { - /* Call a cleanup function, such as the one which - * releases locked records. - */ - if(fd->fd_Cleanup != NULL) - (*fd->fd_Cleanup)(fd); - - PROFILE_OFF(); - - if(CANNOT Close(fd->fd_DefaultFile)) - { - fam->fam_Error = __translate_io_error_to_errno(IoErr()); - - result = EOF; - } - - PROFILE_ON(); - - fd->fd_DefaultFile = ZERO; - } - } - - __fd_unlock(fd); - - #if defined(__THREAD_SAFE) - { - /* Free the lock semaphore now. */ - if(NOT is_aliased) - __delete_semaphore(fd->fd_Lock); - } - #endif /* __THREAD_SAFE */ - - /* And that's the last for this file descriptor. */ - memset(fd,0,sizeof(*fd)); - - break; - - case file_action_seek: - - SHOWMSG("file_action_seek"); - - fam->fam_Error = EINVAL; - goto out; - - case file_action_set_blocking: - - SHOWMSG("file_action_set_blocking"); - - PROFILE_OFF(); - - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_INTERACTIVE)) - { - LONG mode; - - SHOWMSG("changing the mode"); - - if(fam->fam_Arg != 0) - mode = DOSFALSE; /* buffered mode */ - else - mode = DOSTRUE; /* single character mode */ - - if(CANNOT SetMode(file,mode)) - { - fam->fam_Error = __translate_io_error_to_errno(IoErr()); - goto out; - } - - /* Update tios to reflect state change. */ - if(mode == DOSTRUE) - CLEAR_FLAG(tios->c_lflag,ICANON); - else - SET_FLAG(tios->c_lflag,ICANON); - - result = OK; - } - else - { - SHOWMSG("can't do anything here"); - - fam->fam_Error = EBADF; - } - - PROFILE_ON(); - - break; - - case file_action_examine: - - SHOWMSG("file_action_examine"); - - fh = BADDR(file); - - if(CANNOT __safe_examine_file_handle(file,fam->fam_FileInfo)) - { - LONG error; - - /* So that didn't work. Did the file system simply fail to - respond to the request or is something more sinister - at work? */ - error = IoErr(); - if(error != ERROR_ACTION_NOT_KNOWN) - { - SHOWMSG("couldn't examine the file"); - - fam->fam_Error = __translate_io_error_to_errno(error); - goto out; - } - - /* OK, let's have another look at this file. Could it be a - console stream? */ - if(NOT IsInteractive(file)) - { - SHOWMSG("whatever it is, we don't know"); - - fam->fam_Error = ENOSYS; - goto out; - } - - /* Make up some stuff for this stream. */ - memset(fam->fam_FileInfo,0,sizeof(*fam->fam_FileInfo)); - - DateStamp(&fam->fam_FileInfo->fib_Date); - - fam->fam_FileInfo->fib_DirEntryType = ST_CONSOLE; - } - - fam->fam_FileSystem = fh->fh_Type; - - result = OK; - - break; - - default: - - SHOWVALUE(fam->fam_Action); - - fam->fam_Error = EBADF; - break; - } - - out: - - __fd_unlock(fd); - - if(fam->fam_Action == file_action_close) - __stdio_unlock(); - - if(buffer != NULL) - free(buffer); - - SHOWVALUE(result); - - RETURN(result); - return(result); -} diff --git a/library/termios_headers.h b/library/termios_headers.h deleted file mode 100755 index 69617d7..0000000 --- a/library/termios_headers.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * $Id: termios_headers.h,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TERMIOS_HEADERS_H -#define _TERMIOS_HEADERS_H - -/****************************************************************************/ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _TERMIOS_H -#include -#endif /* _TERMIOS_H */ - -/****************************************************************************/ - -extern int __termios_console_hook(struct fd *,struct file_action_message *); -extern int __termios_serial_hook(struct fd *,struct file_action_message *); -extern struct termios *__get_termios(struct fd *); - -/****************************************************************************/ - -enum /* Termios types. */ -{ - TIOST_INVALID = 0, - TIOST_CONSOLE, - TIOST_SERIAL -}; - -enum -{ - TIOS_FLUSH_OUTPUT, - TIOS_FLUSH_SYNC, - TIOS_FLUSH_INPUT, - TIOS_FLUSH_IO -}; - -/****************************************************************************/ - -#endif /* _TERMIOS_HEADERS_H */ diff --git a/library/termios_openserial.c b/library/termios_openserial.c deleted file mode 100755 index 3b4962b..0000000 --- a/library/termios_openserial.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * $Id: termios_openserial.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TERMIOS_HEADERS_H -#include "termios_headers.h" -#endif /* _TERMIOS_HEADERS_H */ - -/****************************************************************************/ - -/* - * This is a clib2/Amiga specific function to obtain a file descriptor - * for a serial port. This is intended as an easy porting path for Unix - * code (which might e.g. open "/dev/ttyS0") and the same concept might - * be applied to other device types as well. - * - * TODO: Implement it. And a serial_fd_hook. And, well, everything else too.... - */ - -int -openserial(const char *device_name,int unit,int mode) -{ - __set_errno(EIO); - - return(ERROR); -} diff --git a/library/termios_tcdrain.c b/library/termios_tcdrain.c deleted file mode 100755 index e8340fc..0000000 --- a/library/termios_tcdrain.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * $Id: termios_tcdrain.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TERMIOS_HEADERS_H -#include "termios_headers.h" -#endif /* _TERMIOS_HEADERS_H */ - -/****************************************************************************/ - -#if defined(__amigaos4__) && !defined(Flush) -#define Flush(fh) FFlush(fh) -#endif /* __amigaos4__ && !Flush */ - -/****************************************************************************/ - -int -tcdrain(int file_descriptor) -{ - int result = ERROR; - struct fd *fd; - struct termios *tios; - - ENTER(); - - SHOWVALUE(file_descriptor); - - if(__check_abort_enabled) - __check_abort(); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - if(FLAG_IS_SET(fd->fd_Flags,FDF_TERMIOS)) - { - tios = fd->fd_Aux; - - switch(tios->type) - { - case TIOST_CONSOLE: - - /* This also discards any buffered input, but it does - not appear possible to drain the output buffer - otherwise. (?) */ - if(CANNOT Flush(fd->fd_DefaultFile)) - goto out; - - break; - - default: /* TODO: Serial port support. */ - - __set_errno(ENXIO); - goto out; - } - - result = OK; - } - else - { - result = fdatasync(file_descriptor); /* If called on a "regular" file. */ - } - - out: - - RETURN(result); - return(result); -} diff --git a/library/termios_tcflow.c b/library/termios_tcflow.c deleted file mode 100755 index 66485f1..0000000 --- a/library/termios_tcflow.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * $Id: termios_tcflow.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TERMIOS_HEADERS_H -#include "termios_headers.h" -#endif /* _TERMIOS_HEADERS_H */ - -/****************************************************************************/ - -int -tcflow(int file_descriptor,int UNUSED action) -{ - int result = ERROR; - struct fd *fd; - - ENTER(); - - SHOWVALUE(file_descriptor); - SHOWVALUE(action); - - fd=__get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - /* XXX TODO */ - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/termios_tcflush.c b/library/termios_tcflush.c deleted file mode 100755 index 08a6003..0000000 --- a/library/termios_tcflush.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * $Id: termios_tcflush.c,v 1.2 2005-06-04 13:57:08 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TERMIOS_HEADERS_H -#include "termios_headers.h" -#endif /* _TERMIOS_HEADERS_H */ - -/****************************************************************************/ - -/* - * This is a bit messy and might possibly be done in a better way, but console - * termios support is a bit of a hack at best. - * tcflush() could possibly be implemented with using CMD_CLEAR with the - * console.device, but this would be just as messy and possibly break - * even more if e.g. stdin is a pipe. - */ - -int -tcflush(int file_descriptor,int queue) -{ - int result = ERROR; - struct fd *fd; - char buf[64]; - struct termios *tios; - - ENTER(); - - SHOWVALUE(file_descriptor); - - if(__check_abort_enabled) - __check_abort(); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL || FLAG_IS_CLEAR(fd->fd_Flags,FDF_TERMIOS)) - { - __set_errno(EBADF); - goto out; - } - - if(queue < TCIFLUSH || queue > TCIOFLUSH) - { - SHOWMSG("Invalid queue specified to tcflush()."); - - __set_errno(EINVAL); - goto out; - } - - tios = fd->fd_Aux; - - if(queue == TCIFLUSH || queue == TCIOFLUSH) - { - LONG num_bytes_read; - - /* Set raw mode so we can read without blocking. */ - if(FLAG_IS_SET(tios->c_lflag,ICANON)) - { - SetMode(fd->fd_DefaultFile,DOSTRUE); - - SET_FLAG(fd->fd_Flags,FDF_NON_BLOCKING); - } - - while(WaitForChar(fd->fd_DefaultFile,1) != DOSFALSE) - { - if(__check_abort_enabled) - __check_abort(); - - /* Read away available data. (upto 8k) */ - num_bytes_read = Read(fd->fd_DefaultFile,buf,64); - if(num_bytes_read == ERROR || num_bytes_read == 0) - break; - } - - /* Restore the Raw/Cooked mode. */ - if(FLAG_IS_SET(tios->c_lflag,ICANON)) - { - SetMode(fd->fd_DefaultFile,DOSFALSE); /* Set Cooked = Canonical mode. */ - - CLEAR_FLAG(fd->fd_Flags,FDF_NON_BLOCKING); - } - - result = OK; - } - else if (queue == TCOFLUSH || queue == TCIOFLUSH) - { - /* TODO: Can we actually discard data buffered on the file? - * For now we do the same as tcdrain(). - */ - result = tcdrain(file_descriptor); - } - - out: - - RETURN(result); - return(result); -} diff --git a/library/termios_tcgetattr.c b/library/termios_tcgetattr.c deleted file mode 100755 index 00050d0..0000000 --- a/library/termios_tcgetattr.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * $Id: termios_tcgetattr.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TERMIOS_HEADERS_H -#include "termios_headers.h" -#endif /* _TERMIOS_HEADERS_H */ - -/****************************************************************************/ - -static const cc_t def_console_cc[NCCS]= -{ - 3, /* VINTR = ETX */ - 28, /* VQUIT = FS */ - 127, /* VERASE = DEL */ - 24, /* VKILL = DC4 */ - 4, /* VEOF = EOT */ - 1, /* VMIN = Minimum number of characters in a non-canonical read. */ - 0, /* VEOL = NUL */ - 0, /* VTIME = Timout in deciseconds for a non-canonical read. */ - 17, /* VSTART = DC1 */ - 19, /* VSTOP = DC3 */ - 26, /* VSUSP = SUB */ - 23 /* VWERASE = ETB */ -}; - -/******************************************************************/ - -static struct termios * -get_console_termios(struct fd *fd) -{ - struct termios *tios; - - /* Create a new, fresh termios. TODO: Actually query some values, - e.g. ICANON and ECHO should not be set for RAW consoles. */ - tios = malloc(sizeof(*tios)); - if(tios == NULL) - { - __set_errno(ENOMEM); - goto out; - } - - memset(tios,0,sizeof(*tios)); - - /* Set up the initial termios state. */ - tios->c_iflag = 0; - tios->c_oflag = 0; - tios->c_cflag = CS8|CLOCAL; - - if(FLAG_IS_SET(fd->fd_Flags,FDF_READ)) - SET_FLAG(tios->c_cflag,CREAD); - - tios->c_lflag = ISIG|ICANON|ECHO; - - memcpy(tios->c_cc,def_console_cc,NCCS); - - tios->c_ispeed = B9600; /* A default as good as any? */ - tios->c_ospeed = B9600; - - tios->type = TIOST_CONSOLE; - tios->flags = 0; - - /* Change the hook. */ - fd->fd_Action = __termios_console_hook; - fd->fd_Aux = tios; - - SET_FLAG(fd->fd_Flags,FDF_TERMIOS); - - out: - - return(tios); -} - -/******************************************************************/ - -struct termios * -__get_termios(struct fd *fd) -{ - struct termios *tios = NULL; - - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET)) /* Network socket. Remote terminal? */ - { - __set_errno(ENODEV); - goto out; - } - - if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_IS_INTERACTIVE)) - { - __set_errno(ENOTTY); - goto out; - } - - if(FLAG_IS_SET(fd->fd_Flags,FDF_TERMIOS)) - tios = fd->fd_Aux; - else - tios = get_console_termios(fd); - - out: - - return(tios); -} - -/******************************************************************/ - -int -tcgetattr(int file_descriptor,struct termios *user_tios) -{ - int result = ERROR; - struct fd *fd; - struct termios *tios; - - if(user_tios == NULL) - { - __set_errno(EFAULT); - goto out; - } - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - if(FLAG_IS_SET(fd->fd_Flags,FDF_TERMIOS)) - { - assert(fd->fd_Aux != NULL); - - memcpy(user_tios,fd->fd_Aux,sizeof(struct termios)); - } - else - { - tios = __get_termios(fd); - if(tios == NULL) - goto out; - - memcpy(user_tios,tios,sizeof(struct termios)); - } - - result = OK; - -out: - - return(result); -} diff --git a/library/termios_tcsendbreak.c b/library/termios_tcsendbreak.c deleted file mode 100755 index 04cc25b..0000000 --- a/library/termios_tcsendbreak.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * $Id: termios_tcsendbreak.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TERMIOS_HEADERS_H -#include "termios_headers.h" -#endif /* _TERMIOS_HEADERS_H */ - -/****************************************************************************/ - -/* - * tcsendbreak() has a rather odd time specification. - * If duration is 0, it will send a BREAK for 0.25-0.5 seconds - * and if duration is non-zero... - * Linux asserts BREAK for N*duration where N is somewhere between 0.25 and 0.5 seconds. - * Solaris calls tcdrain() instead. (According to the manual) - * Let us try the Solaris way and see how it goes. - * - * If the file descriptor does not referr to a serial port, no action is needed. - */ - -int -tcsendbreak(int file_descriptor,int duration) -{ - int result = ERROR; - struct fd *fd; - struct termios *tios; - - ENTER(); - - SHOWVALUE(file_descriptor); - SHOWVALUE(duration); - - if(__check_abort_enabled) - __check_abort(); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL || FLAG_IS_CLEAR(fd->fd_Flags,FDF_TERMIOS)) - { - __set_errno(EBADF); - goto out; - } - - assert( fd->fd_Aux != NULL ); - - tios = fd->fd_Aux; - - switch(tios->type) - { - case TIOST_CONSOLE: - - result = OK; - break; - - case TIOST_SERIAL: - - if(duration == 0) - { - /* TODO */ - result = OK; - } - else - { - result = tcdrain(file_descriptor); - } - - break; - - default: - - SHOWMSG("Invalid tios type in tcsendbreak."); - goto out; - } - - out: - - RETURN(result); - return(result); -} diff --git a/library/termios_tcsetattr.c b/library/termios_tcsetattr.c deleted file mode 100755 index 92f1af5..0000000 --- a/library/termios_tcsetattr.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * $Id: termios_tcsetattr.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TERMIOS_HEADERS_H -#include "termios_headers.h" -#endif /* _TERMIOS_HEADERS_H */ - -/****************************************************************************/ - -static int -set_console_termios(struct fd *fd,struct termios *new_tios) -{ - struct termios *old_tios; - int result = ERROR; - - /* TODO: Check for some "impossible" combinations here? */ - - old_tios = __get_termios(fd); - if(old_tios == NULL) - goto out; - - if(old_tios->type != TIOST_CONSOLE) - goto out; - - if(FLAG_IS_CLEAR(new_tios->c_lflag,ICANON)) - { - SetMode(fd->fd_DefaultFile,DOSTRUE); /* Set Raw = Non-Canonical mode. */ - - SET_FLAG(fd->fd_Flags,FDF_NON_BLOCKING); - } - else - { - SetMode(fd->fd_DefaultFile,DOSFALSE); /* Set Cooked = Canonical mode. */ - - CLEAR_FLAG(fd->fd_Flags,FDF_NON_BLOCKING); - } - - /* Most of the processing (except raw/cooked mode switch) is handled in the hook. */ - memcpy(old_tios,new_tios,offsetof(struct termios,type)); - - result = OK; - - out: - - return(result); -} - -/****************************************************************************/ - -int -tcsetattr(int file_descriptor,int how,struct termios *tios) -{ - int result = ERROR; - struct fd *fd_Term; - struct termios new_tios; - int type; - - if(tios == NULL) - { - __set_errno(EFAULT); - goto out; - } - - fd_Term = __get_file_descriptor(file_descriptor); - if(fd_Term == NULL) - { - SHOWMSG("tcsetattr() was not called with a file descriptor.\n"); - - __set_errno(EBADF); - goto out; - } - - /* The following is in case the termios structure was manually constructed. (it should have been zero:ed in that case) */ - if(tios->type == TIOST_INVALID) - { - if(tcgetattr(file_descriptor,&new_tios) != OK) - goto out; /* Pass errno from tcgetattr() */ - - type = new_tios.type; - - memcpy(&new_tios,tios,sizeof(struct termios)); - - new_tios.c_ispeed = B9600; - new_tios.c_ospeed = B9600; - - new_tios.type = type; - - tios = &new_tios; - } - - if(tios->type == TIOST_SERIAL) - { - __set_errno(ENXIO); /* Unimplemented (for now). */ - goto out; - } - else if (tios->type == TIOST_CONSOLE) - { - if(how == TCSADRAIN) - { - if(tcdrain(file_descriptor) != OK) - goto out; - } - else if (how == TCSAFLUSH) - { - if(tcflush(file_descriptor,TCIOFLUSH) != OK) - goto out; - } - - if(set_console_termios(fd_Term,tios) != OK) - { - __set_errno(EIO); - goto out; - } - } - else - { - __set_errno(ENOTTY); - goto out; - } - - result = OK; - -out: - - return(result); -} diff --git a/library/time_asctime.c b/library/time_asctime.c deleted file mode 100644 index 6c16e34..0000000 --- a/library/time_asctime.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * $Id: time_asctime.c,v 1.4 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -char * -asctime(const struct tm *tm) -{ - static char buffer[40]; - - char * result; - - ENTER(); - - result = __asctime_r(tm,buffer,sizeof(buffer)); - - RETURN(result); - return(result); -} diff --git a/library/time_asctime_r.c b/library/time_asctime_r.c deleted file mode 100644 index ad4ba26..0000000 --- a/library/time_asctime_r.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * $Id: time_asctime_r.c,v 1.7 2005-02-25 10:14:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -STATIC VOID -add_to_string(char * to,size_t to_size,const char * string,size_t * offset_ptr) -{ - size_t offset,len; - - assert( to != NULL && to_size > 0 && string != NULL && offset_ptr != NULL ); - - offset = (*offset_ptr); - - assert( offset < to_size ); - - len = strlen(string); - if(offset + len > to_size) - len = to_size - offset; - - if(len > 0) - { - memmove(&to[offset],string,len); - - offset += len; - - (*offset_ptr) = offset; - } -} - -/****************************************************************************/ - -char * -__asctime_r(const struct tm *tm,char * buffer,size_t buffer_size) -{ - char * result = NULL; - - ENTER(); - - SHOWPOINTER(tm); - - assert( tm != NULL || buffer == NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(tm == NULL || buffer == NULL ) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(buffer_size > 0) - { - struct tm copy_tm; - char number[16]; - const char * b; - size_t offset = 0; - - buffer_size--; - - /* Fill in the week day if it's not in proper range. */ - if(tm->tm_wday < 0 || tm->tm_wday > 6) - { - /* We use a peculiar algorithm rather than falling back onto - mktime() here in order to avoid trouble with skewed results - owing to time zone influence. */ - copy_tm = (*tm); - copy_tm.tm_wday = __calculate_weekday(tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday); - - tm = ©_tm; - } - - assert( 0 <= tm->tm_wday && tm->tm_wday <= 6 ); - - b = __abbreviated_week_day_names[tm->tm_wday]; - - add_to_string(buffer,buffer_size,b, &offset); - add_to_string(buffer,buffer_size," ", &offset); - - if(0 <= tm->tm_mon && tm->tm_mon <= 11) - b = __abbreviated_month_names[tm->tm_mon]; - else - b = "---"; - - add_to_string(buffer,buffer_size,b, &offset); - add_to_string(buffer,buffer_size," ", &offset); - - if(1 <= tm->tm_mday && tm->tm_mday <= 31) - b = __number_to_string((unsigned int)tm->tm_mday,number,sizeof(number),2); - else - b = "--"; - - add_to_string(buffer,buffer_size,b, &offset); - add_to_string(buffer,buffer_size," ", &offset); - - if(0 <= tm->tm_hour && tm->tm_hour <= 23) - b = __number_to_string((unsigned int)tm->tm_hour,number,sizeof(number),2); - else - b = "--"; - - add_to_string(buffer,buffer_size,b, &offset); - add_to_string(buffer,buffer_size,":", &offset); - - if(0 <= tm->tm_min && tm->tm_min <= 59) - b = __number_to_string((unsigned int)tm->tm_min,number,sizeof(number),2); - else - b = "--"; - - add_to_string(buffer,buffer_size,b, &offset); - add_to_string(buffer,buffer_size,":", &offset); - - if(0 <= tm->tm_sec && tm->tm_sec <= 59) - b = __number_to_string((unsigned int)tm->tm_sec,number,sizeof(number),2); - else - b = "--"; - - add_to_string(buffer,buffer_size,b, &offset); - add_to_string(buffer,buffer_size," ", &offset); - - if(0 <= tm->tm_year) - b = __number_to_string((unsigned int)1900 + tm->tm_year,number,sizeof(number),0); - else - b = "----"; - - add_to_string(buffer,buffer_size,b,&offset); - - SHOWSTRING(buffer); - - add_to_string(buffer,buffer_size,"\n",&offset); - - assert( offset <= buffer_size ); - buffer[offset] = '\0'; - - result = buffer; - } - else - { - result = ""; - } - - out: - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -char * -asctime_r(const struct tm *tm,char * buffer) -{ - char * result; - - ENTER(); - - result = __asctime_r(tm,buffer,40); - - RETURN(result); - return(result); -} diff --git a/library/time_clock.c b/library/time_clock.c deleted file mode 100644 index c951fb2..0000000 --- a/library/time_clock.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * $Id: time_clock.c,v 1.6 2005-03-18 12:38:25 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -static struct DateStamp start_time; - -/****************************************************************************/ - -CLIB_CONSTRUCTOR(clock_init) -{ - ENTER(); - - /* Remember when this program was started. */ - DateStamp(&start_time); - - LEAVE(); - - CONSTRUCTOR_SUCCEED(); -} - -/****************************************************************************/ - -clock_t -clock(void) -{ - struct DateStamp now; - LONG minutes_now,ticks_now; - LONG minutes_start,ticks_start; - clock_t result; - - ENTER(); - - /* Get the current time. */ - - PROFILE_OFF(); - DateStamp(&now); - PROFILE_ON(); - - /* Break the current and start time down into minutes and ticks. */ - minutes_now = now.ds_Days * 24 * 60 + now.ds_Minute; - ticks_now = now.ds_Tick; - - minutes_start = start_time.ds_Days * 24 * 60 + start_time.ds_Minute; - ticks_start = start_time.ds_Tick; - - /* Subtract the start time from the current time. We start - * with the ticks. - */ - ticks_now -= ticks_start; - - /* Check for underflow. */ - while(ticks_now < 0) - { - /* Borrow a minute from the current time. */ - ticks_now += 60 * TICKS_PER_SECOND; - - minutes_now--; - } - - /* Now for the minutes. */ - minutes_now -= minutes_start; - - /* Check if any time has passed at all, then return the difference. */ - if(minutes_now >= 0) - result = (clock_t)(minutes_now * 60 * TICKS_PER_SECOND + ticks_now); - else - result = (clock_t)0; - - RETURN(result); - return(result); -} diff --git a/library/time_convert_datestamp.c b/library/time_convert_datestamp.c deleted file mode 100644 index 6061de2..0000000 --- a/library/time_convert_datestamp.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * $Id: time_convert_datestamp.c,v 1.2 2005-02-27 21:58:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -time_t -__convert_datestamp_to_time(const struct DateStamp * ds) -{ - time_t result; - - ENTER(); - - __locale_lock(); - - /* If possible, adjust for the local time zone. We do this because the - AmigaOS system time is returned in local time and we want to return - it in UTC. */ - result = UNIX_TIME_OFFSET + ds->ds_Days * (24*60*60) + ds->ds_Minute * 60 + (ds->ds_Tick / TICKS_PER_SECOND); - if(__default_locale != NULL) - result += 60 * __default_locale->loc_GMTOffset; - - __locale_unlock(); - - RETURN(result); - return(result); -} diff --git a/library/time_convert_time.c b/library/time_convert_time.c deleted file mode 100644 index 24a571b..0000000 --- a/library/time_convert_time.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * $Id: time_convert_time.c,v 1.2 2005-02-27 21:58:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -BOOL -__convert_time_to_datestamp(time_t time_value,struct DateStamp * ds) -{ - BOOL success; - - /* The time has to lie within the AmigaOS epoch. */ - if(time_value < UNIX_TIME_OFFSET) - { - success = FALSE; - goto out; - } - - /* Adjust the time to the AmigaOS epoch. */ - time_value -= UNIX_TIME_OFFSET; - - __locale_lock(); - - /* If possible, adjust the time to match the local time zone settings. */ - if(__default_locale != NULL) - time_value -= 60 * __default_locale->loc_GMTOffset; - - __locale_unlock(); - - ds->ds_Days = (time_value / (24 * 60 * 60)); - ds->ds_Minute = (time_value % (24 * 60 * 60)) / 60; - ds->ds_Tick = (time_value % 60) * TICKS_PER_SECOND; - - success = TRUE; - - out: - - return(success); -} diff --git a/library/time_converttime.c b/library/time_converttime.c deleted file mode 100644 index e39bbcf..0000000 --- a/library/time_converttime.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * $Id: time_converttime.c,v 1.3 2005-01-29 18:05:14 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -struct tm * -__convert_time(ULONG seconds, LONG gmt_offset, struct tm * tm) -{ - DECLARE_UTILITYBASE(); - struct ClockData clock_data; - struct tm * result; - - ENTER(); - - assert( UtilityBase != NULL ); - - /* We need to convert the time from Unix-style UTC - * back into Amiga style local time. - * - * First, the Unix time offset will have to go. - */ - if(seconds < UNIX_TIME_OFFSET) - seconds = 0; - else - seconds -= UNIX_TIME_OFFSET; - - /* Now the local time offset will have to go. */ - seconds -= gmt_offset; - - /* Convert the number of seconds into a more useful format. */ - Amiga2Date(seconds, &clock_data); - - /* The 'struct clockdata' layout and contents are very similar - * to the 'struct tm' contents. We don't have to convert much, - * except for the 'tm.tm_yday' field below. - */ - tm->tm_sec = clock_data.sec; - tm->tm_min = clock_data.min; - tm->tm_hour = clock_data.hour; - tm->tm_mday = clock_data.mday; - tm->tm_mon = clock_data.month - 1; - tm->tm_year = clock_data.year - 1900; - tm->tm_wday = clock_data.wday; - tm->tm_isdst = -1; - - /* Now figure out how many days have passed since January 1st. */ - tm->tm_yday = __calculate_days_per_date(clock_data.year,clock_data.month,clock_data.mday) - __calculate_days_per_date(clock_data.year,1,1); - - result = tm; - - RETURN(result); - return(result); -} diff --git a/library/time_ctime.c b/library/time_ctime.c deleted file mode 100644 index fcd47fa..0000000 --- a/library/time_ctime.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * $Id: time_ctime.c,v 1.5 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -char * -ctime(const time_t *tptr) -{ - char * result = NULL; - - ENTER(); - - assert( tptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(tptr == NULL) - { - SHOWMSG("invalid tptr parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = asctime(localtime(tptr)); - - out: - - RETURN(result); - return(result); -} diff --git a/library/time_ctime_r.c b/library/time_ctime_r.c deleted file mode 100644 index e0b98a8..0000000 --- a/library/time_ctime_r.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: time_ctime_r.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -char * -ctime_r(const time_t *tptr,char * buffer) -{ - char * result = NULL; - struct tm tm; - - ENTER(); - - assert( tptr != NULL && buffer != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(tptr == NULL || buffer == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = asctime_r(localtime_r(tptr,&tm),buffer); - - out: - - RETURN(result); - return(result); -} diff --git a/library/time_data.c b/library/time_data.c deleted file mode 100644 index 46da1e2..0000000 --- a/library/time_data.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * $Id: time_data.c,v 1.4 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -const char * const NOCOMMON __abbreviated_week_day_names[7] = -{ - "Sun", - "Mon", - "Tue", - "Wed", - "Thu", - "Fri", - "Sat" -}; - -const char * const NOCOMMON __week_day_names[7] = -{ - "Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday" -}; - -const char * const NOCOMMON __abbreviated_month_names[12] = -{ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" -}; - -const char * const NOCOMMON __month_names[12] = -{ - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December" -}; diff --git a/library/time_days_per_date.c b/library/time_days_per_date.c deleted file mode 100644 index b81bce5..0000000 --- a/library/time_days_per_date.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: time_days_per_date.c,v 1.1 2005-01-29 18:05:14 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -/* This calculates the number of days that have passed up to the - given date. */ -int -__calculate_days_per_date(int year,int month,int day) -{ - int result; - - month = month + 9; - year = year - 1 + (month / 12); - month = (month % 12) * 306 + 5; - - result = (year * 365) + (year / 4) - (year / 100) + (year / 400) + (month / 10) + day - 1; - - return(result); -} diff --git a/library/time_difftime.c b/library/time_difftime.c deleted file mode 100644 index 60be9c9..0000000 --- a/library/time_difftime.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: time_difftime.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -/****************************************************************************/ - -double -difftime(time_t t1,time_t t0) -{ - double result; - - result = ((double)t1) - ((double)t0); - - return(result); -} - -/****************************************************************************/ - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/time_gettimeofday.c b/library/time_gettimeofday.c deleted file mode 100644 index f527347..0000000 --- a/library/time_gettimeofday.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * $Id: time_gettimeofday.c,v 1.9 2005-03-19 10:15:56 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 PROTO_TIMER_H -#include -#endif /* PROTO_TIMER_H */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -#ifndef _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -#ifndef _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -gettimeofday(struct timeval *tp, struct timezone *tzp) -{ - #if defined(__amigaos4__) - struct TimerIFace * ITimer = __ITimer; - #else - struct Library * TimerBase = __TimerBase; - #endif /* __amigaos4__ */ - - ULONG seconds,microseconds; - struct timeval tv; - - ENTER(); - - /* Obtain the current system time. */ - PROFILE_OFF(); - GetSysTime(&tv); - PROFILE_ON(); - - /* Convert the number of seconds so that they match the Unix epoch, which - starts (January 1st, 1970) eight years before the AmigaOS epoch. */ - seconds = tv.tv_sec + UNIX_TIME_OFFSET; - microseconds = tv.tv_usec; - - __locale_lock(); - - /* If possible, adjust for the local time zone. We do this because the - AmigaOS system time is returned in local time and we want to return - it in UTC. */ - if(__default_locale != NULL) - seconds += 60 * __default_locale->loc_GMTOffset; - - if(tp != NULL) - { - tp->tv_sec = (long)seconds; - tp->tv_usec = (long)microseconds; - - SHOWVALUE(tp->tv_sec); - SHOWVALUE(tp->tv_usec); - } - - if(tzp != NULL) - { - if(__default_locale != NULL) - tzp->tz_minuteswest = __default_locale->loc_GMTOffset; - else - tzp->tz_minuteswest = 0; - - /* The -1 means "we do not know if the time given is in - daylight savings time". */ - tzp->tz_dsttime = -1; - - SHOWVALUE(tzp->tz_minuteswest); - SHOWVALUE(tzp->tz_dsttime); - } - - __locale_unlock(); - - RETURN(0); - return(0); -} diff --git a/library/time_gmtime.c b/library/time_gmtime.c deleted file mode 100644 index e7c39ca..0000000 --- a/library/time_gmtime.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * $Id: time_gmtime.c,v 1.4 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -struct tm * -gmtime(const time_t *t) -{ - static struct tm tm; - struct tm * result; - - ENTER(); - - result = gmtime_r(t,&tm); - - RETURN(result); - return(result); -} diff --git a/library/time_gmtime_r.c b/library/time_gmtime_r.c deleted file mode 100644 index 38ffc28..0000000 --- a/library/time_gmtime_r.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * $Id: time_gmtime_r.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -struct tm * -gmtime_r(const time_t *t,struct tm * tm_ptr) -{ - struct tm * result = NULL; - - ENTER(); - - assert( t != NULL && tm_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(t == NULL || tm_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = __convert_time((*t), 0, tm_ptr); - - out: - - RETURN(result); - return(result); -} diff --git a/library/time_headers.h b/library/time_headers.h deleted file mode 100644 index 0761156..0000000 --- a/library/time_headers.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * $Id: time_headers.h,v 1.11 2005-03-30 19:37:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#define _TIME_HEADERS_H - -/****************************************************************************/ - -#ifndef EXEC_LIBRARIES_H -#include -#endif /* EXEC_LIBRARIES_H */ - -#ifndef EXEC_DEVICES_H -#include -#endif /* EXEC_DEVICES_H */ - -#ifndef EXEC_MEMORY_H -#include -#endif /* EXEC_MEMORY_H */ - -#ifndef DOS_DOSEXTENS_H -#include -#endif /* DOS_DOSEXTENS_H */ - -#ifndef DEVICES_TIMER_H -#include -#endif /* DEVICES_TIMER_H */ - -#ifndef LIBRARIES_LOCALE_H -#include -#endif /* LIBRARIES_LOCALE_H */ - -#ifndef UTILITY_DATE_H -#include -#endif /* UTILITY_DATE_H */ - -/****************************************************************************/ - -#ifndef CLIB_ALIB_PROTOS_H -#include -#endif /* CLIB_ALIB_PROTOS_H */ - -/****************************************************************************/ - -#ifndef PROTO_EXEC_H -#include -#endif /* PROTO_EXEC_H */ - -#ifndef PROTO_DOS_H -#include -#endif /* PROTO_DOS_H */ - -/****************************************************************************/ - -#include -#include -#include -#include -#include - -/****************************************************************************/ - -#ifndef _STDLIB_LOCALEBASE_H -#include "stdlib_localebase.h" -#endif /* _STDLIB_LOCALEBASE_H */ - -#ifndef _STDLIB_UTILITYBASE_H -#include "stdlib_utilitybase.h" -#endif /* _STDLIB_UTILITYBASE_H */ - -/****************************************************************************/ - -#ifndef _MATH_FP_SUPPORT_H -#include "math_fp_support.h" -#endif /* _MATH_FP_SUPPORT_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_H */ - -/****************************************************************************/ - -#ifndef _MACROS_H -#include "macros.h" -#endif /* _MACROS_H */ - -#ifndef _DEBUG_H -#include "debug.h" -#endif /* _DEBUG_H */ - -/****************************************************************************/ - -/* This is the difference (in seconds) between the Unix epoch (which began - on January 1st, 1970) and the AmigaOS epoch (which began eight years - later on January 1st 1978). */ -#define UNIX_TIME_OFFSET 252460800 - -/****************************************************************************/ - -extern const char * const NOCOMMON __abbreviated_week_day_names[7]; -extern const char * const NOCOMMON __week_day_names[7]; -extern const char * const NOCOMMON __abbreviated_month_names[12]; -extern const char * const NOCOMMON __month_names[12]; - -/****************************************************************************/ - -extern char * __asctime_r(const struct tm *tm,char * buffer,size_t buffer_size); -extern char * __number_to_string(unsigned int number,char * string,size_t max_len,size_t min_len); -extern struct tm * __convert_time(ULONG seconds, LONG gmt_offset, struct tm * tm); -extern time_t __convert_datestamp_to_time(const struct DateStamp * ds); -extern BOOL __convert_time_to_datestamp(time_t time_value,struct DateStamp * ds); -extern int __calculate_weekday(int year,int month,int day); -extern int __calculate_days_per_date(int year,int month,int day); - -/****************************************************************************/ - -#endif /* _TIME_HEADERS_H */ diff --git a/library/time_localtime.c b/library/time_localtime.c deleted file mode 100644 index 761c0ec..0000000 --- a/library/time_localtime.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $Id: time_localtime.c,v 1.4 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -struct tm * -localtime(const time_t *t) -{ - static struct tm tm; - - struct tm * result; - - ENTER(); - - result = localtime_r(t,&tm); - - RETURN(result); - return(result); -} diff --git a/library/time_localtime_r.c b/library/time_localtime_r.c deleted file mode 100644 index f898a08..0000000 --- a/library/time_localtime_r.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * $Id: time_localtime_r.c,v 1.5 2005-02-27 21:58:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -struct tm * -localtime_r(const time_t *t,struct tm * tm_ptr) -{ - struct tm * result = NULL; - LONG gmt_offset; - - ENTER(); - - assert( t != NULL && tm_ptr != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(t == NULL || tm_ptr == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - __locale_lock(); - - /* The time parameter given represents UTC and - * must be converted to local time before we proceed. - */ - if(__default_locale != NULL) - gmt_offset = 60 * __default_locale->loc_GMTOffset; - else - gmt_offset = 0; - - __locale_unlock(); - - SHOWVALUE(gmt_offset); - - result = __convert_time((*t), gmt_offset, tm_ptr); - - out: - - RETURN(result); - return(result); -} diff --git a/library/time_mktime.c b/library/time_mktime.c deleted file mode 100644 index 74e6e63..0000000 --- a/library/time_mktime.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * $Id: time_mktime.c,v 1.9 2005-05-09 13:47:24 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -time_t -mktime(struct tm *tm) -{ - DECLARE_UTILITYBASE(); - struct ClockData clock_data; - ULONG seconds, delta; - time_t result = (time_t)-1; - int max_month_days; - - ENTER(); - - assert( tm != NULL ); - assert( UtilityBase != NULL ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(tm == NULL) - { - SHOWMSG("invalid tm parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* The month must be valid. */ - if(tm->tm_mon < 0 || tm->tm_mon > 11) - { - SHOWVALUE(tm->tm_mon); - SHOWMSG("invalid month"); - goto out; - } - - /* The day of the month must be valid. */ - if(tm->tm_mday < 1 || tm->tm_mday > 31) - { - SHOWVALUE(tm->tm_mday); - SHOWMSG("invalid day of month"); - goto out; - } - - /* The year must be valid. */ - if(tm->tm_year < 78) - { - SHOWVALUE(tm->tm_year); - SHOWMSG("invalid year"); - goto out; - } - - /* Is this the month of February? */ - if(tm->tm_mon == 1) - { - int year; - - /* We need to have the full year number for the - leap year calculation below. */ - year = tm->tm_year + 1900; - - /* Now for the famous leap year calculation rules... In - the given year, how many days are there in the month - of February? */ - if((year % 4) != 0) - max_month_days = 28; - else if ((year % 400) == 0) - max_month_days = 29; - else if ((year % 100) == 0) - max_month_days = 28; - else - max_month_days = 29; - } - else - { - static const char days_per_month[12] = - { - 31, 0,31, - 30,31,30, - 31,31,30, - 31,30,31 - }; - - max_month_days = days_per_month[tm->tm_mon]; - } - - /* The day of the month must be valid. */ - if(tm->tm_mday < 0 || tm->tm_mday > max_month_days) - { - SHOWVALUE(tm->tm_mday); - SHOWMSG("invalid day of month"); - goto out; - } - - /* The hour must be valid. */ - if(tm->tm_hour < 0 || tm->tm_hour > 23) - { - SHOWVALUE(tm->tm_hour); - SHOWMSG("invalid hour"); - goto out; - } - - /* The minute must be valid. */ - if(tm->tm_min < 0 || tm->tm_min > 59) - { - SHOWVALUE(tm->tm_min); - SHOWMSG("invalid minute"); - goto out; - } - - /* Note: the number of seconds can be larger than 59 - in order to account for leap seconds. */ - if(tm->tm_sec < 0 || tm->tm_sec > 60) - { - SHOWVALUE(tm->tm_sec); - SHOWMSG("invalid seconds"); - goto out; - } - - clock_data.sec = (tm->tm_sec > 59) ? 59 : tm->tm_sec; - clock_data.min = tm->tm_min; - clock_data.hour = tm->tm_hour; - clock_data.mday = tm->tm_mday; - clock_data.month = tm->tm_mon + 1; - clock_data.year = tm->tm_year + 1900; - - seconds = Date2Amiga(&clock_data) + (tm->tm_sec - 59); - - /* The AmigaOS "epoch" starts with January 1st, 1978, which was - a Sunday. */ - tm->tm_wday = (seconds / (24 * 60 * 60)) % 7; - - clock_data.mday = 1; - clock_data.month = 1; - - delta = Date2Amiga(&clock_data); - - tm->tm_yday = (seconds - delta) / (24 * 60 * 60); - - __locale_lock(); - - /* The data in 'struct tm *tm' was given in local time. We need - to convert the result into UTC. */ - if(__default_locale != NULL) - seconds += 60 * __default_locale->loc_GMTOffset; - - __locale_unlock(); - - /* Finally, adjust for the difference between the Unix and the - AmigaOS epochs, which differ by 8 years. */ - result = seconds + UNIX_TIME_OFFSET; - - out: - - RETURN(result); - return(result); -} diff --git a/library/time_numbertostring.c b/library/time_numbertostring.c deleted file mode 100644 index c7a87ef..0000000 --- a/library/time_numbertostring.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * $Id: time_numbertostring.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -char * -__number_to_string( - unsigned int number, - char * string, - size_t max_len, - size_t min_len) -{ - char * s = string; - size_t len,i; - char c; - - assert( string != NULL && max_len >= min_len ); - - /* One off for the terminating NUL. */ - if(max_len > 0) - max_len--; - - len = 0; - - /* Convert the number digit by digit, building the - * string in reverse order. - */ - do - { - if(max_len == 0) - break; - - max_len--; - - (*s++) = '0' + (number % 10); - number /= 10; - - len++; - } - while(number > 0); - - /* Pad the string to the requested length, if necessary. */ - while(max_len > 0 && len < min_len) - { - max_len--; - - (*s++) = '0'; - len++; - } - - (*s) = '\0'; - - /* Reverse the string in place. */ - for(i = 0 ; i < len / 2 ; i++) - { - c = string[len-1-i]; - string[len-1-i] = string[i]; - string[i] = c; - } - - return(string); -} diff --git a/library/time_strftime.c b/library/time_strftime.c deleted file mode 100644 index 92d44b8..0000000 --- a/library/time_strftime.c +++ /dev/null @@ -1,674 +0,0 @@ -/* - * $Id: time_strftime.c,v 1.16 2005-05-19 13:57:52 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -struct format_hook_data -{ - char * buffer; - int max_size; - int len; -}; - -/****************************************************************************/ - -STATIC VOID -format_hook_function( - struct Hook * hook, - long c, - struct Locale * UNUSED unused_locale) -{ - struct format_hook_data * data = hook->h_Data; - - if(c != '\0') - { - if(data->max_size > 0) - { - /* There's still room for another character. */ - (*data->buffer++) = (char)c; - - data->len++; - - data->max_size--; - } - else - { - /* Indicate that the buffer was too short. */ - data->len = 0; - } - } -} - -/****************************************************************************/ - -STATIC VOID -store_string_via_hook(const char * string,int len,struct Hook * hook) -{ - DECLARE_UTILITYBASE(); - - assert( string != NULL && hook != NULL ); - assert( UtilityBase != NULL ); - - if(len < 0) - len = strlen(string); - - while(len-- > 0) - CallHookPkt(hook,(APTR)((ULONG)(*string++)),NULL); -} - -/****************************************************************************/ - -/* The algorithm for calculating the ISO 8601 week number value comes from - the "Calendar FAQ" at . */ -INLINE STATIC int -julian_day(int day,int month,int year) -{ - int a,y,m,result; - - a = (14 - month) / 12; - y = year + 4800 - a; - m = month + 12 * a - 3; - - result = day + (153 * m + 2) / 5 + 365 * y + (y / 4) - (y / 100) + (y / 400) - 32045; - - return(result); -} - -STATIC void -iso8601_calendar_week_and_year(int day,int month,int year,int * week_ptr,int * year_ptr) -{ - int J = julian_day(day,month,year); - int d1,d4,L; - int week; - - d4 = (J + 31741 - (J % 7)) % 146097 % 36524 % 1461; - L = d4 / 1460; - d1 = ((d4 - L) % 365) + L; - - week = (d1 / 7) + 1; - - if (month == 1 && week > 51) - year--; - else if (month == 12 && week == 1) - year++; - - if(week_ptr != NULL) - (*week_ptr) = week; - - if(year_ptr != NULL) - (*year_ptr) = year; -} - -/****************************************************************************/ - -STATIC VOID -format_date(const char *format,const struct tm *tm,struct Hook * hook) -{ - int gmt_offset; - int week_number; - int year_number; - int hour; - char buffer[40]; - const char * str; - char c; - - assert( format != NULL && tm != NULL && hook != NULL); - - while((c = (*format++)) != '\0') - { - /* This is the simple case. */ - if(c != '%') - { - store_string_via_hook(&c,1,hook); - continue; - } - - /* OK, what kind of format is expected? */ - c = (*format++); - - /* For C99, check if the 'E' or 'O' modifiers are present. If so, - skip them for now. */ - if(c == 'E' || c == 'O') - c = (*format++); - - /* We stop if the string ends here. Hm... should this count as an error? */ - if(c == '\0') - break; - - switch(c) - { - /* Abbreviated weekday name ("Sun"). */ - case 'a': - - assert( 0 <= tm->tm_wday && tm->tm_wday <= 6 ); - - if(0 <= tm->tm_wday && tm->tm_wday <= 6) - str = __abbreviated_week_day_names[tm->tm_wday]; - else - str = "-"; - - store_string_via_hook(str,-1,hook); - break; - - /* Full weekday name ("Sunday"). */ - case 'A': - - assert( 0 <= tm->tm_wday && tm->tm_wday <= 6 ); - - if(0 <= tm->tm_wday && tm->tm_wday <= 6) - str = __week_day_names[tm->tm_wday]; - else - str = "-"; - - store_string_via_hook(str,-1,hook); - break; - - /* Abbreviated month name ("Jan"). */ - case 'b': - - assert( 0 <= tm->tm_mon && tm->tm_mon <= 11 ); - - if(0 <= tm->tm_mon && tm->tm_mon <= 11) - str = __abbreviated_month_names[tm->tm_mon]; - else - str = "-"; - - store_string_via_hook(str,-1,hook); - break; - - /* Full month name ("January"). */ - case 'B': - - assert( 0 <= tm->tm_mon && tm->tm_mon <= 11 ); - - if(0 <= tm->tm_mon && tm->tm_mon <= 11) - str = __month_names[tm->tm_mon]; - else - str = ""; - - store_string_via_hook(str,-1,hook); - break; - - /* Locale specific date and time ("%a %b %d %H:%M:%S %Y"). */ - case 'c': - - format_date("%a %b %d %H:%M:%S %Y",tm,hook); - break; - - /* The century number ("00"-"99"; C99). */ - case 'C': - - __number_to_string((unsigned int)(tm->tm_year / 100),buffer,sizeof(buffer),2); - store_string_via_hook(buffer,2,hook); - break; - - /* Day of the month ("01"-"31"). */ - case 'd': - - assert( 1 <= tm->tm_mday && tm->tm_mday <= 31 ); - - __number_to_string((unsigned int)tm->tm_mday,buffer,sizeof(buffer),2); - store_string_via_hook(buffer,2,hook); - break; - - /* Date ("12/31/00"; C99) */ - case 'D': - - format_date("%m/%d/%y",tm,hook); - break; - - /* Month with a leading space rather than a zero (" 1"-"12"; C99). */ - case 'e': - - assert( 0 <= tm->tm_mon && tm->tm_mon <= 11 ); - - __number_to_string((unsigned int)tm->tm_mon+1,buffer,sizeof(buffer),2); - if(buffer[0] == '0') - buffer[0] = ' '; - - store_string_via_hook(buffer,2,hook); - break; - - /* ISO 8601 date format ("2005-05-14"; C99). */ - case 'F': - - format_date("%Y-%m-%d",tm,hook); - break; - - /* The last two digits of the week-based year ("00"-"99"; C99). */ - case 'g': - - assert( 1 <= tm->tm_mday && tm->tm_mday <= 31 ); - assert( 0 <= tm->tm_mon && tm->tm_mon <= 11 ); - assert( 0 <= tm->tm_year ); - - iso8601_calendar_week_and_year(tm->tm_mday,tm->tm_mon+1,tm->tm_year + 1900,NULL,&year_number); - __number_to_string(year_number % 100,buffer,sizeof(buffer),2); - store_string_via_hook(buffer,2,hook); - break; - - /* The number of the week-based year ("2005"; C99). */ - case 'G': - - assert( 1 <= tm->tm_mday && tm->tm_mday <= 31 ); - assert( 0 <= tm->tm_mon && tm->tm_mon <= 11 ); - assert( 0 <= tm->tm_year ); - - iso8601_calendar_week_and_year(tm->tm_mday,tm->tm_mon+1,tm->tm_year + 1900,NULL,&year_number); - __number_to_string(year_number,buffer,sizeof(buffer),0); - store_string_via_hook(buffer,-1,hook); - break; - - /* Abbreviated month name ("Jan"; C99). */ - case 'h': - - format_date("%b",tm,hook); - break; - - /* Hour ("00"-"23"). */ - case 'H': - - assert( 0 <= tm->tm_hour && tm->tm_hour <= 23 ); - - __number_to_string((unsigned int)tm->tm_hour,buffer,sizeof(buffer),2); - store_string_via_hook(buffer,2,hook); - break; - - /* Hour ("01"-"12"). */ - case 'I': - - assert( 0 <= tm->tm_hour && tm->tm_hour <= 23 ); - - hour = tm->tm_hour % 12; - if(hour == 0) - hour = 12; - - __number_to_string(hour,buffer,sizeof(buffer),2); - store_string_via_hook(buffer,2,hook); - break; - - /* Day of the year ("001"-"366"). */ - case 'j': - - __number_to_string(1 + __calculate_days_per_date(tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday) - __calculate_days_per_date(tm->tm_year+1900,1,1),buffer,sizeof(buffer),3); - store_string_via_hook(buffer,-1,hook); - break; - - /* Month ("01"-"12"). */ - case 'm': - - assert( 0 <= tm->tm_mon && tm->tm_mon <= 11 ); - - __number_to_string((unsigned int)tm->tm_mon+1,buffer,sizeof(buffer),2); - store_string_via_hook(buffer,2,hook); - break; - - /* Minute ("00"-"59"). */ - case 'M': - - assert( 0 <= tm->tm_min && tm->tm_min <= 59 ); - - __number_to_string((unsigned int)tm->tm_min,buffer,sizeof(buffer),2); - store_string_via_hook(buffer,2,hook); - break; - - /* Line feed character (C99). */ - case 'n': - - store_string_via_hook("\n",1,hook); - break; - - /* 'Ante meridiem'/'Post meridiem' indicator. */ - case 'p': - - assert( 0 <= tm->tm_hour && tm->tm_hour <= 23 ); - - store_string_via_hook((tm->tm_hour < 12) ? "AM" :" PM",2,hook); - break; - - /* 12 hour clock time (C99). */ - case 'r': - - format_date("%I:%M:%S %p",tm,hook); - break; - - /* Locale-specific time (C99). */ - case 'R': - - format_date("%H:%M",tm,hook); - break; - - /* Seconds ("00"-"59"). */ - case 'S': - - assert( 0 <= tm->tm_sec && tm->tm_sec <= 59 ); - - __number_to_string((unsigned int)tm->tm_sec,buffer,sizeof(buffer),2); - store_string_via_hook(buffer,2,hook); - break; - - /* Horizontal tabulator character (C99). */ - case 't': - - store_string_via_hook("\t",1,hook); - break; - - /* ISO 8601 time format ("23:59:59"; C99). */ - case 'T': - - format_date("%H:%M:%S",tm,hook); - break; - - /* ISO 8601 week day number ("1"-"7"; 1 is Monday; C99). */ - case 'u': - - assert( 0 <= tm->tm_wday && tm->tm_wday <= 6 ); - - __number_to_string((unsigned int)(tm->tm_wday > 0 ? tm->tm_wday : 7),buffer,sizeof(buffer),0); - store_string_via_hook(buffer,1,hook); - break; - - /* Week number of the year; first week is the one that contains - * the first Sunday of the year ("00"-"53"). - */ - case 'U': - - __number_to_string((tm->tm_yday + 7 - tm->tm_wday) / 7,buffer,sizeof(buffer),2); - store_string_via_hook(buffer,2,hook); - break; - - /* ISO 8601 week number ("01"-"53"; C99). */ - case 'V': - - assert( 1 <= tm->tm_mday && tm->tm_mday <= 31 ); - assert( 0 <= tm->tm_mon && tm->tm_mon <= 11 ); - assert( 0 <= tm->tm_year ); - - iso8601_calendar_week_and_year(tm->tm_mday,tm->tm_mon+1,tm->tm_year + 1900,&week_number,NULL); - __number_to_string(week_number,buffer,sizeof(buffer),2); - store_string_via_hook(buffer,2,hook); - break; - - /* Week day ("0"-"6"). */ - case 'w': - - assert( 0 <= tm->tm_wday && tm->tm_wday <= 6 ); - - __number_to_string((unsigned int)tm->tm_wday,buffer,sizeof(buffer),0); - store_string_via_hook(buffer,1,hook); - break; - - /* Week number of the year; first week is the one that contains - * the first Monday of the year ("00"-"53"). - */ - case 'W': - - __number_to_string((tm->tm_yday + 7 - ((tm->tm_wday + 6) % 7)) / 7,buffer,sizeof(buffer),2); - store_string_via_hook(buffer,2,hook); - break; - - /* Locale-specific date ("%a %b %d, %Y"). */ - case 'x': - - format_date("%a %b %d, %Y",tm,hook); - break; - - /* Locale-specific time ("%H:%M:%S"). */ - case 'X': - - format_date("%H:%M:%S",tm,hook); - break; - - /* Year without century ("00"-"99"). */ - case 'y': - - assert( 0 <= tm->tm_year ); - - __number_to_string((unsigned int)tm->tm_year % 100,buffer,sizeof(buffer),2); - store_string_via_hook(buffer,2,hook); - break; - - /* Year with century ("1970"-"2147483647"). */ - case 'Y': - - assert( 0 <= tm->tm_year ); - - __number_to_string((unsigned int)1900 + tm->tm_year,buffer,sizeof(buffer),0); - store_string_via_hook(buffer,-1,hook); - break; - - /* ISO 8601 offset of time zone from UTC (C99). */ - case 'z': - - __locale_lock(); - - if(__default_locale != NULL) - { - gmt_offset = __default_locale->loc_GMTOffset; - if(gmt_offset < 0) - gmt_offset = (-gmt_offset); - else if (gmt_offset > 0) - store_string_via_hook("-",1,hook); - } - else - { - gmt_offset = 0; - } - - __locale_unlock(); - - /* The GMT offset is given in minutes. We need to print - it as a decimal number. */ - gmt_offset = (100 * (gmt_offset / 60)) + (gmt_offset % 60); - - __number_to_string((unsigned int)gmt_offset,buffer,sizeof(buffer),0); - store_string_via_hook(buffer,-1,hook); - - break; - - /* Time zone name. */ - case 'Z': - - store_string_via_hook("GMT",3,hook); - - __locale_lock(); - - if(__default_locale != NULL) - { - int hours_west_of_gmt; - char sign; - - hours_west_of_gmt = __default_locale->loc_GMTOffset / 60; - if(hours_west_of_gmt < 0) - { - sign = '+'; - - hours_west_of_gmt = (-hours_west_of_gmt); - } - else if (hours_west_of_gmt > 0) - { - sign = '-'; - } - - if(hours_west_of_gmt != 0) - { - store_string_via_hook(&sign,1,hook); - __number_to_string((unsigned int)hours_west_of_gmt,buffer,sizeof(buffer),2); - store_string_via_hook(buffer,-1,hook); - } - } - - __locale_unlock(); - - break; - - /* Store that character 'as is'. */ - default: - - store_string_via_hook(&c,1,hook); - break; - } - } -} - -/****************************************************************************/ - -size_t -strftime(char *s, size_t maxsize, const char *format, const struct tm *tm) -{ - DECLARE_LOCALEBASE(); - size_t result = 0; - - ENTER(); - - SHOWPOINTER(s); - SHOWVALUE(maxsize); - SHOWSTRING(format); - SHOWPOINTER(tm); - - assert( s != NULL && format != NULL && tm != NULL ); - assert( (int)maxsize >= 0 ); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(s == NULL || format == NULL || tm == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(maxsize > 0) - { - struct format_hook_data data; - struct Hook hook; - - data.len = 0; - data.buffer = s; - data.max_size = maxsize-1; - - memset(&hook,0,sizeof(hook)); - - #if defined(__amigaos4__) - { - hook.h_Entry = (HOOKFUNC)format_hook_function; - } - #else - { - hook.h_Entry = (HOOKFUNC)HookEntry; - hook.h_SubEntry = (HOOKFUNC)format_hook_function; - } - #endif /* __amigaos4__ */ - - hook.h_Data = &data; - - __locale_lock(); - - /* Try to use the locale.library date/time conversion function. */ - if(__locale_table[LC_TIME] != NULL) - { - struct DateStamp ds; - struct tm tm_copy; - time_t time_value; - - tm_copy = (*tm); - - time_value = mktime(&tm_copy); - if(time_value == (time_t)-1) - { - SHOWMSG("invalid time"); - goto out; - } - - /* Convert the number of seconds into a DateStamp, as to be - submitted to the FormatDate() function below. */ - if(CANNOT __convert_time_to_datestamp(time_value,&ds)) - { - SHOWMSG("time conversion to datestamp failed"); - goto out; - } - - assert( LocaleBase != NULL ); - - FormatDate(__locale_table[LC_TIME],(STRPTR)format,&ds,&hook); - } - else - { - struct tm copy_tm; - - /* Fill in the week day if it's not in proper range. */ - if(tm->tm_wday < 0 || tm->tm_wday > 6) - { - /* We use a peculiar algorithm rather than falling back onto - mktime() here in order to avoid trouble with skewed results - owing to time zone influence. */ - copy_tm = (*tm); - copy_tm.tm_wday = __calculate_weekday(tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday); - - tm = ©_tm; - } - - format_date(format,tm,&hook); - } - - __locale_unlock(); - - (*data.buffer) = '\0'; - - SHOWSTRING(s); - - result = data.len; - } - - out: - - RETURN(result); - return(result); -} diff --git a/library/time_time.c b/library/time_time.c deleted file mode 100644 index 3d77466..0000000 --- a/library/time_time.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $Id: time_time.c,v 1.4 2005-01-25 11:21:00 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -/****************************************************************************/ - -time_t -time(time_t * tptr) -{ - struct DateStamp ds; - time_t result; - - PROFILE_OFF(); - DateStamp(&ds); - PROFILE_ON(); - - /* This converts the DateStamp contents into the number of - seconds elapsed since January 1st 1970. The time is - given as relative to UTC, not local time. */ - result = __convert_datestamp_to_time(&ds); - - if(tptr != NULL) - (*tptr) = result; - - return(result); -} diff --git a/library/time_weekday.c b/library/time_weekday.c deleted file mode 100644 index fb5def7..0000000 --- a/library/time_weekday.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * $Id: time_weekday.c,v 1.1 2005-01-26 18:41:39 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -int -__calculate_weekday(int year,int month,int day) -{ - /* This algorithm comes from . */ - static const char month_skew[12] = - { - 0,3,3,6, - 1,4,6,2, - 5,0,3,5 - }; - - int sum; - - /* Subtract 1900 from the year. */ - sum = year - 1900; - - /* To that number, add one fourth of itself, discarding - any remainder. This sum is the year's skew value. */ - sum += sum / 4; - - /* If the month in question is January or February in a leap - year, subtract 1 from the sum. */ - if(month == 1 || month == 2) - { - int leap_year_adjust; - - /* Figure out if the year is a leap year. */ - if((year % 4) != 0) - leap_year_adjust = 0; - else if ((year % 400) == 0) - leap_year_adjust = 1; - else if ((year % 100) == 0) - leap_year_adjust = 0; - else - leap_year_adjust = 1; - - sum -= leap_year_adjust; - } - - /* Add the month's skew value from the table. */ - sum += day + month_skew[month-1]; - - /* The sum is the number of days after Sunday on which the date falls. */ - return(sum % 7); -} diff --git a/library/uio_headers.h b/library/uio_headers.h deleted file mode 100644 index 1c0df1e..0000000 --- a/library/uio_headers.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * $Id: uio_headers.h,v 1.1 2005-04-03 10:22:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UIO_HEADERS_H -#define _UIO_HEADERS_H - -/****************************************************************************/ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _SYS_UIO_H -#include -#endif /* _SYS_UIO_H */ - -/****************************************************************************/ - -#endif /* _UIO_HEADERS_H */ diff --git a/library/uio_readv.c b/library/uio_readv.c deleted file mode 100644 index 7c159a2..0000000 --- a/library/uio_readv.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * $Id: uio_readv.c,v 1.3 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UIO_HEADERS_H -#include "uio_headers.h" -#endif /* _UIO_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -ssize_t -readv(int file_descriptor,const struct iovec *iov,int vec_count) -{ - ssize_t result = EOF; - struct file_action_message msg; - ssize_t total_num_bytes_read; - ssize_t part_num_bytes_read; - ssize_t num_bytes_read; - struct fd * fd; - int i; - - ENTER(); - - SHOWVALUE(file_descriptor); - SHOWPOINTER(iov); - SHOWVALUE(vec_count); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(iov == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(vec_count < 1 || vec_count > MAX_IOVEC) - { - __set_errno(EINVAL); - goto out; - } - - /* Check for overflow. An expensive test, but better to do it here than in the read loop. */ - for(i = 0, total_num_bytes_read = 0 ; i < vec_count ; i++) - { - total_num_bytes_read += iov[i].iov_len; - if(total_num_bytes_read < 0) /* Rollover. */ - { - __set_errno(EINVAL); - goto out; - } - } - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - total_num_bytes_read = 0; - part_num_bytes_read = 0; - - i = 0; - - while(i < vec_count) /* XXX: Should this loop be locked? */ - { - if(__check_abort_enabled) - __check_abort(); - - if(iov[i].iov_len > 0) - { - msg.fam_Action = file_action_read; - msg.fam_Data = (char *)iov[i].iov_base + part_num_bytes_read; - msg.fam_Size = iov[i].iov_len - part_num_bytes_read; - - num_bytes_read = (*fd->fd_Action)(fd,&msg); - if(num_bytes_read == EOF) - { - __set_errno(msg.fam_Error); - goto out; - } - - /* End of file reached? */ - if(num_bytes_read == 0) - break; - - total_num_bytes_read += num_bytes_read; - - part_num_bytes_read += num_bytes_read; - if((size_t)part_num_bytes_read < iov[i].iov_len) - { - /* Avoid busy-waiting for more data here? */ - continue; - } - } - - part_num_bytes_read = 0; - - i++; - } - - result = total_num_bytes_read; - -out: - - RETURN(result); - return(result); -} diff --git a/library/uio_writev.c b/library/uio_writev.c deleted file mode 100644 index 55b0138..0000000 --- a/library/uio_writev.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * $Id: uio_writev.c,v 1.3 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UIO_HEADERS_H -#include "uio_headers.h" -#endif /* _UIO_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -ssize_t -writev(int file_descriptor,const struct iovec *iov,int vec_count) -{ - ssize_t result = EOF; - struct file_action_message msg; - ssize_t total_num_bytes_written; - char * buffer = NULL; - struct fd * fd; - int i; - - ENTER(); - - SHOWVALUE(file_descriptor); - SHOWPOINTER(iov); - SHOWVALUE(vec_count); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(iov == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(vec_count < 1 || vec_count > MAX_IOVEC) - { - __set_errno(EINVAL); - goto out; - } - - /* Check for overflow. An expensive test, but better to do it - here than in the write loop. */ - for(i = 0, total_num_bytes_written = 0 ; i < vec_count ; i++) - { - total_num_bytes_written += iov[i].iov_len; - if(total_num_bytes_written < 0) /* Rollover. */ - { - __set_errno(EINVAL); - goto out; - } - } - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - buffer = malloc(total_num_bytes_written); - if(buffer != NULL) - { - char * b = buffer; - - for(i = 0 ; i < vec_count ; i++) - { - memcpy(b,iov[i].iov_base,iov[i].iov_len); - b += iov[i].iov_len; - } - - msg.fam_Action = file_action_write; - msg.fam_Data = buffer; - msg.fam_Size = total_num_bytes_written; - - if((*fd->fd_Action)(fd,&msg) == EOF) - { - __set_errno(msg.fam_Error); - goto out; - } - } - else - { - for(i = 0 ; i < vec_count ; i++) - { - if(__check_abort_enabled) - __check_abort(); - - if(iov[i].iov_len > 0) - { - msg.fam_Action = file_action_write; - msg.fam_Data = (char *)iov[i].iov_base; - msg.fam_Size = iov[i].iov_len; - - if((*fd->fd_Action)(fd,&msg) == EOF) - { - __set_errno(msg.fam_Error); - goto out; - } - } - } - } - - result = total_num_bytes_written; - -out: - - if(buffer != NULL) - free(buffer); - - RETURN(result); - return(result); -} diff --git a/library/unistd_access.c b/library/unistd_access.c deleted file mode 100644 index 82e9807..0000000 --- a/library/unistd_access.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * $Id: unistd_access.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -access(const char * path_name, int mode) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info path_name_nti; - #endif /* UNIX_PATH_SEMANTICS */ - int result = ERROR; - BPTR lock = ZERO; - - ENTER(); - - SHOWSTRING(path_name); - SHOWVALUE(mode); - - assert( path_name != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(path_name == NULL) - { - SHOWMSG("invalid path name"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(mode < 0 || mode > (R_OK|W_OK|X_OK|F_OK)) - { - SHOWMSG("invalid mode"); - - __set_errno(EINVAL); - goto out; - } - - #if defined(UNIX_PATH_SEMANTICS) - { - STRPTR actual_path_name = NULL; - - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0) - goto out; - - if(NOT path_name_nti.is_root) - actual_path_name = (STRPTR)path_name; - } - - if(actual_path_name != NULL) - { - D(("trying to get a lock on '%s'",actual_path_name)); - - lock = Lock(actual_path_name,SHARED_LOCK); - if(lock == ZERO) - { - __set_errno(__translate_access_io_error_to_errno(IoErr())); - goto out; - } - } - } - #else - { - D(("trying to get a lock on '%s'",path_name)); - - PROFILE_OFF(); - lock = Lock((STRPTR)path_name,SHARED_LOCK); - PROFILE_ON(); - - if(lock == ZERO) - { - __set_errno(__translate_access_io_error_to_errno(IoErr())); - goto out; - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - if((mode != F_OK) && (mode & (R_OK|W_OK|X_OK)) != 0) - { - D_S(struct FileInfoBlock,fib); - - #if defined(UNIX_PATH_SEMANTICS) - { - if(lock == ZERO) - { - memset(fib,0,sizeof(*fib)); - - /* This is a simulated directory which cannot be - * modified under program control. - */ - fib->fib_Protection = FIBF_WRITE; - fib->fib_DirEntryType = ST_ROOT; - } - else - { - LONG status; - - PROFILE_OFF(); - status = Examine(lock,fib); - PROFILE_ON(); - - if(status == DOSFALSE) - { - SHOWMSG("couldn't examine"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - } - } - #else - { - LONG status; - - PROFILE_OFF(); - status = Examine(lock,fib); - PROFILE_ON(); - - if(status == DOSFALSE) - { - SHOWMSG("couldn't examine"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - fib->fib_Protection ^= FIBF_READ|FIBF_WRITE|FIBF_EXECUTE|FIBF_DELETE; - - if(FLAG_IS_SET(mode,R_OK)) - { - if(FLAG_IS_CLEAR(fib->fib_Protection,FIBF_READ)) - { - SHOWMSG("not readable"); - - __set_errno(EACCES); - goto out; - } - } - - if(FLAG_IS_SET(mode,W_OK)) - { - if(FLAG_IS_CLEAR(fib->fib_Protection,FIBF_WRITE) || - FLAG_IS_CLEAR(fib->fib_Protection,FIBF_DELETE)) - { - SHOWMSG("not writable"); - - __set_errno(EACCES); - goto out; - } - } - - if(FLAG_IS_SET(mode,X_OK)) - { - /* Note: 'X' means 'search' for directories, which is always - * permitted on the Amiga. - */ - if((fib->fib_DirEntryType < 0) && FLAG_IS_CLEAR(fib->fib_Protection,FIBF_EXECUTE)) - { - SHOWMSG("not executable"); - - __set_errno(EACCES); - goto out; - } - } - } - - result = OK; - - out: - - PROFILE_OFF(); - UnLock(lock); - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/unistd_chdir.c b/library/unistd_chdir.c deleted file mode 100644 index 18ad514..0000000 --- a/library/unistd_chdir.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * $Id: unistd_chdir.c,v 1.7 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* ZZZ chdir() must be reentrant according to POSIX.1 */ -int -chdir(const char * path_name) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info path_name_nti; - #endif /* UNIX_PATH_SEMANTICS */ - D_S(struct FileInfoBlock,fib); - BPTR dir_lock = ZERO; - LONG status; - int result = ERROR; - - 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 path name"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0) - goto out; - - /* The pseudo root directory is a very special case indeed. We - * just accept it and don't pretend to have obtained a lock - * on anything. - */ - if(path_name_nti.is_root) - { - SHOWMSG("this is the / directory"); - - __restore_path_name(&path_name,&path_name_nti); - - /* ZZZ this must not fail */ - __set_current_path(path_name); - - result = OK; - - goto out; - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - D(("trying to get a lock on '%s'",path_name)); - - PROFILE_OFF(); - dir_lock = Lock((STRPTR)path_name,SHARED_LOCK); - PROFILE_ON(); - - if(dir_lock == ZERO) - { - __set_errno(__translate_access_io_error_to_errno(IoErr())); - goto out; - } - - PROFILE_OFF(); - status = Examine(dir_lock,fib); - PROFILE_ON(); - - if(status == DOSFALSE) - { - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - if(fib->fib_DirEntryType < 0) - { - SHOWMSG("this is not a directory"); - - __set_errno(ENOTDIR); - goto out; - } - - PROFILE_OFF(); - - if(__current_directory_changed) - { - BPTR old_dir; - - old_dir = CurrentDir(dir_lock); - - if(__unlock_current_directory) - UnLock(old_dir); - } - else - { - __original_current_directory = CurrentDir(dir_lock); - - __current_directory_changed = TRUE; - } - - __unlock_current_directory = TRUE; - - PROFILE_ON(); - - dir_lock = ZERO; - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - __restore_path_name(&path_name,&path_name_nti); - - /* ZZZ this must not fail */ - __set_current_path(path_name); - } - #endif /* UNIX_PATH_SEMANTICS */ - - result = OK; - - out: - - PROFILE_OFF(); - UnLock(dir_lock); - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/unistd_chdir_exit.c b/library/unistd_chdir_exit.c deleted file mode 100644 index f6b3553..0000000 --- a/library/unistd_chdir_exit.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * $Id: unistd_chdir_exit.c,v 1.6 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* If the program's current directory was changed, here is where - we find out about it. */ -BPTR NOCOMMON __original_current_directory; -BOOL NOCOMMON __current_directory_changed; -BOOL NOCOMMON __unlock_current_directory; - -/****************************************************************************/ - -CLIB_DESTRUCTOR(__chdir_exit) -{ - ENTER(); - - if(__current_directory_changed) - { - BPTR old_dir; - - old_dir = CurrentDir(__original_current_directory); - __original_current_directory = ZERO; - - if(__unlock_current_directory) - { - UnLock(old_dir); - - __unlock_current_directory = FALSE; - } - - __current_directory_changed = FALSE; - } - - LEAVE(); -} diff --git a/library/unistd_chown.c b/library/unistd_chown.c deleted file mode 100644 index 6e6dba4..0000000 --- a/library/unistd_chown.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * $Id: unistd_chown.c,v 1.7 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -chown(const char * path_name, uid_t owner, gid_t group) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info path_name_nti; - #endif /* UNIX_PATH_SEMANTICS */ - struct DevProc * dvp = NULL; - LONG status; - int result = ERROR; - - ENTER(); - - SHOWSTRING(path_name); - SHOWVALUE(owner); - SHOWVALUE(group); - - assert( path_name != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(path_name == NULL) - { - SHOWMSG("invalid path name"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(owner > 65535 || group > 65535) - { - SHOWMSG("invalid owner or group"); - - __set_errno(EINVAL); - goto out; - } - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0) - goto out; - - if(path_name_nti.is_root) - { - __set_errno(EACCES); - goto out; - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - D(("changing owner of '%s'",path_name)); - - #if defined(__amigaos4__) - { - PROFILE_OFF(); - status = SetOwner((STRPTR)path_name,(LONG)((((ULONG)owner) << 16) | group)); - PROFILE_ON(); - } - #else - { - if(((struct Library *)DOSBase)->lib_Version >= 39) - { - PROFILE_OFF(); - status = SetOwner((STRPTR)path_name,(LONG)((((ULONG)owner) << 16) | group)); - PROFILE_ON(); - } - else - { - D_S(struct bcpl_name,new_name); - size_t len; - - len = strlen(path_name); - if(len >= sizeof(new_name->name)) - { - __set_errno(ENAMETOOLONG); - goto out; - } - - PROFILE_OFF(); - dvp = GetDeviceProc((STRPTR)path_name,NULL); - PROFILE_ON(); - - if(dvp == NULL) - { - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - new_name->name[0] = len; - memmove(&new_name->name[1],path_name,len); - - PROFILE_OFF(); - status = DoPkt(dvp->dvp_Port,ACTION_SET_OWNER,dvp->dvp_Lock,MKBADDR(new_name),(LONG)((((ULONG)owner) << 16) | group),0,0); - PROFILE_ON(); - } - } - #endif /* __amigaos4__ */ - - if(status == DOSFALSE) - { - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - result = OK; - - out: - - PROFILE_OFF(); - FreeDeviceProc(dvp); - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/unistd_currentpathname.c b/library/unistd_currentpathname.c deleted file mode 100644 index fafd4fc..0000000 --- a/library/unistd_currentpathname.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: unistd_currentpathname.c,v 1.3 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -char NOCOMMON __current_path_name[MAXPATHLEN]; diff --git a/library/unistd_dup.c b/library/unistd_dup.c deleted file mode 100644 index 68e1b53..0000000 --- a/library/unistd_dup.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id: unistd_dup.c,v 1.3 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -dup(int file_descriptor) -{ - return(dup2(file_descriptor,-1)); -} diff --git a/library/unistd_dup2.c b/library/unistd_dup2.c deleted file mode 100644 index eeefcb4..0000000 --- a/library/unistd_dup2.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * $Id: unistd_dup2.c,v 1.9 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -dup2(int file_descriptor1, int file_descriptor2) -{ - struct fd * fd1; - int result = ERROR; - - ENTER(); - - SHOWVALUE(file_descriptor1); - SHOWVALUE(file_descriptor2); - - if(__check_abort_enabled) - __check_abort(); - - __stdio_lock(); - - assert( file_descriptor1 >= 0 && file_descriptor1 < __num_fd ); - assert( __fd[file_descriptor1] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor1]->fd_Flags,FDF_IN_USE) ); - - fd1 = __get_file_descriptor(file_descriptor1); - if(fd1 == NULL) - { - __set_errno(EBADF); - goto out; - } - - if(file_descriptor2 < 0) - { - /* Try to find a place to put the duplicate into. */ - file_descriptor2 = __find_vacant_fd_entry(); - if(file_descriptor2 < 0) - { - /* No free space, so let's grow the table. */ - if(__grow_fd_table(0) < 0) - { - SHOWMSG("not enough memory for new file descriptor"); - goto out; - } - - file_descriptor2 = __find_vacant_fd_entry(); - assert( file_descriptor2 >= 0 ); - } - } - else if (file_descriptor1 != file_descriptor2) - { - /* Make sure the requested duplicate exists. */ - if(__grow_fd_table(file_descriptor2 + 1) < 0) - goto out; - - assert( file_descriptor2 >= 0 && file_descriptor2 < __num_fd ); - assert( __fd[file_descriptor2] != NULL ); - } - - if(file_descriptor1 != file_descriptor2) - { - struct fd * fd2; - - /* Have a look at the requested file descriptor. */ - assert( 0 <= file_descriptor2 && file_descriptor2 < __num_fd ); - - fd2 = __fd[file_descriptor2]; - - assert( fd2 != NULL ); - - /* Make sure that the entry is cleaned up before we used it. */ - if(FLAG_IS_SET(fd2->fd_Flags,FDF_IN_USE)) - { - SHOWMSG("closing file descriptor #2"); - - if(close(file_descriptor2) < 0) - goto out; - } - - __duplicate_fd(fd2,fd1); - } - - result = file_descriptor2; - - out: - - __stdio_unlock(); - - RETURN(result); - return(result); -} diff --git a/library/unistd_fchown.c b/library/unistd_fchown.c deleted file mode 100644 index 0bb0086..0000000 --- a/library/unistd_fchown.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * $Id: unistd_fchown.c,v 1.10 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -fchown(int file_descriptor, uid_t owner, gid_t group) -{ - D_S(struct FileInfoBlock,fib); - BPTR parent_dir = ZERO; - BPTR old_current_dir = ZERO; - BOOL current_dir_changed = FALSE; - int result = ERROR; - struct fd * fd = NULL; - LONG success; - - ENTER(); - - SHOWVALUE(file_descriptor); - SHOWVALUE(owner); - SHOWVALUE(group); - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - if(__check_abort_enabled) - __check_abort(); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - __fd_lock(fd); - - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET)) - { - __set_errno(EINVAL); - goto out; - } - - if(FLAG_IS_SET(fd->fd_Flags,FDF_STDIO)) - { - __set_errno(EBADF); - goto out; - } - - if(owner > 65535 || group > 65535) - { - SHOWMSG("owner or group not OK"); - - SHOWVALUE(owner); - SHOWVALUE(group); - - __set_errno(EINVAL); - goto out; - } - - PROFILE_OFF(); - success = (__safe_examine_file_handle(fd->fd_DefaultFile,fib) && (parent_dir = __safe_parent_of_file_handle(fd->fd_DefaultFile)) != ZERO); - PROFILE_ON(); - - if(NO success) - { - SHOWMSG("couldn't find parent directory"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - old_current_dir = CurrentDir(parent_dir); - current_dir_changed = TRUE; - - PROFILE_OFF(); - - #if defined(__amigaos4__) - { - success = SetOwner(fib->fib_FileName,(LONG)((((ULONG)owner) << 16) | group)); - } - #else - { - if(((struct Library *)DOSBase)->lib_Version >= 39) - { - success = SetOwner(fib->fib_FileName,(LONG)((((ULONG)owner) << 16) | group)); - } - else - { - D_S(struct bcpl_name,new_name); - struct DevProc * dvp; - unsigned int len; - - SHOWMSG("have to do this manually..."); - - success = DOSFALSE; - - len = strlen(fib->fib_FileName); - - assert( len < sizeof(new_name->name) ); - - dvp = GetDeviceProc(fib->fib_FileName,NULL); - if(dvp != NULL) - { - LONG error; - - new_name->name[0] = len; - memmove(&new_name->name[1],fib->fib_FileName,len); - - success = DoPkt(dvp->dvp_Port,ACTION_SET_OWNER,dvp->dvp_Lock,MKBADDR(new_name),(LONG)((((ULONG)owner) << 16) | group),0,0); - error = IoErr(); - - FreeDeviceProc(dvp); - - SetIoErr(error); - } - } - } - #endif /* __amigaos4__ */ - - PROFILE_ON(); - - if(NO success) - { - SHOWMSG("couldn't change owner/group"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - result = OK; - - out: - - __fd_unlock(fd); - - PROFILE_OFF(); - - UnLock(parent_dir); - - if(current_dir_changed) - CurrentDir(old_current_dir); - - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/unistd_fdatasync.c b/library/unistd_fdatasync.c deleted file mode 100644 index 80fee5e..0000000 --- a/library/unistd_fdatasync.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * $Id: unistd_fdatasync.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* fdatasync() performs as fsync() except that metadata (atime, ctime etc.) - is not necessarily flushed. The original source code was contributed by - Peter Bengtsson. */ - -/****************************************************************************/ - -int -fdatasync(int file_descriptor) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(file_descriptor); - - if(__check_abort_enabled) - __check_abort(); - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - if(__sync_fd(fd,0) < 0) /* flush just the data */ - goto out; - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/unistd_fdopen.c b/library/unistd_fdopen.c deleted file mode 100644 index 80a81be..0000000 --- a/library/unistd_fdopen.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * $Id: unistd_fdopen.c,v 1.6 2005-03-04 09:07:09 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -FILE * -fdopen(int file_descriptor, const char * type) -{ - FILE * result = NULL; - int slot_number; - - ENTER(); - - SHOWVALUE(file_descriptor); - SHOWSTRING(type); - - assert(type != NULL); - - if(__check_abort_enabled) - __check_abort(); - - __stdio_lock(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(type == NULL) - { - SHOWMSG("invalid type parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - slot_number = __find_vacant_iob_entry(); - if(slot_number < 0) - { - if(__grow_iob_table(0) < 0) - { - SHOWMSG("not enough memory for a file buffer slot"); - goto out; - } - - slot_number = __find_vacant_iob_entry(); - assert( slot_number >= 0 ); - } - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - if(__open_iob(NULL, type, file_descriptor, slot_number) < 0) - { - SHOWMSG("couldn't open the file for the file descriptor"); - goto out; - } - - result = (FILE *)__iob[slot_number]; - - out: - - __stdio_unlock(); - - RETURN(result); - return(result); -} diff --git a/library/unistd_fileno.c b/library/unistd_fileno.c deleted file mode 100644 index 0438df8..0000000 --- a/library/unistd_fileno.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * $Id: unistd_fileno.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -fileno(FILE * file) -{ - struct iob * iob = (struct iob *)file; - int result = ERROR; - - ENTER(); - - SHOWPOINTER(file); - - assert( file != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - flockfile(file); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(file == NULL) - { - SHOWMSG("invalid file parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - assert( __is_valid_iob(iob) ); - assert( FLAG_IS_SET(iob->iob_Flags,IOBF_IN_USE) ); - - if(FLAG_IS_CLEAR(iob->iob_Flags,IOBF_IN_USE)) - { - __set_errno(EBADF); - goto out; - } - - assert( iob->iob_Descriptor >= 0 && iob->iob_Descriptor < __num_fd ); - assert( __fd[iob->iob_Descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[iob->iob_Descriptor]->fd_Flags,FDF_IN_USE) ); - - result = iob->iob_Descriptor; - - out: - - funlockfile(file); - - RETURN(result); - return(result); -} diff --git a/library/unistd_fsync.c b/library/unistd_fsync.c deleted file mode 100644 index 680dacd..0000000 --- a/library/unistd_fsync.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * $Id: unistd_fsync.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* fsync() flushes all pending data and metadata on a file descriptor. - The original source code was contributed by Peter Bengtsson. */ - -/****************************************************************************/ - -int -fsync(int file_descriptor) -{ - struct fd * fd; - int result = ERROR; - - ENTER(); - - SHOWVALUE(file_descriptor); - - if(__check_abort_enabled) - __check_abort(); - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - if(__sync_fd(fd,1) < 0) /* flush everything */ - goto out; - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/unistd_ftruncate.c b/library/unistd_ftruncate.c deleted file mode 100644 index b8bb62b..0000000 --- a/library/unistd_ftruncate.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * $Id: unistd_ftruncate.c,v 1.12 2005-04-24 09:53:12 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -ftruncate(int file_descriptor, off_t length) -{ - D_S(struct FileInfoBlock,fib); - int result = ERROR; - struct fd * fd = NULL; - off_t current_file_size; - LONG initial_position = 0; - BOOL initial_position_valid = FALSE; - - ENTER(); - - SHOWVALUE(file_descriptor); - SHOWVALUE(length); - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - if(__check_abort_enabled) - __check_abort(); - - PROFILE_OFF(); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - __fd_lock(fd); - - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET)) - { - __set_errno(EINVAL); - goto out; - } - - if(FLAG_IS_SET(fd->fd_Flags,FDF_STDIO)) - { - __set_errno(EBADF); - goto out; - } - - if(length < 0) - { - SHOWMSG("invalid length"); - - __set_errno(EINVAL); - goto out; - } - - assert( FLAG_IS_SET(fd->fd_Flags,FDF_IN_USE) ); - - if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_WRITE)) - { - SHOWMSG("file descriptor is not write-enabled"); - - __set_errno(EINVAL); - goto out; - } - - /* Figure out how large the file is right now. */ - if(CANNOT __safe_examine_file_handle(fd->fd_DefaultFile,fib)) - { - SHOWMSG("couldn't examine file"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - current_file_size = (off_t)fib->fib_Size; - - /* Is the file to be made shorter than it is right now? */ - if(length < current_file_size) - { - /* Remember where we started. */ - if(NOT initial_position_valid) - { - initial_position = Seek(fd->fd_DefaultFile,0,OFFSET_CURRENT); - if(initial_position == SEEK_ERROR && IoErr() != OK) - goto out; - - initial_position_valid = TRUE; - } - - /* Careful: seek to a position where the file can be safely truncated. */ - if(Seek(fd->fd_DefaultFile,length,OFFSET_BEGINNING) == SEEK_ERROR && IoErr() != OK) - { - D(("could not move to file offset %ld",length)); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - if(SetFileSize(fd->fd_DefaultFile,length,OFFSET_BEGINNING) == SEEK_ERROR) - { - D(("could not reduce file to size %ld",length)); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - /* If the file is now shorter than the file position, which must - not be changed by a call to ftruncate(), extend the file again, - filling the extension with 0 bytes. */ - if((off_t)initial_position > length) - { - current_file_size = length; - - length = (off_t)initial_position; - } - } - - /* Is the size of the file to grow? */ - if(length > current_file_size) - { - /* Remember where we started. */ - if(NOT initial_position_valid) - { - initial_position = Seek(fd->fd_DefaultFile,0,OFFSET_CURRENT); - if(initial_position == SEEK_ERROR && IoErr() != OK) - goto out; - - initial_position_valid = TRUE; - } - - /* Move to what should be the end of the file. */ - if(Seek(fd->fd_DefaultFile,current_file_size,OFFSET_BEGINNING) == SEEK_ERROR && IoErr() != OK) - { - D(("could not move to file offset %ld",current_file_size)); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - /* Add as many bytes to the end of the file as are required - to make it as large as requested. */ - if(__grow_file_size(fd,length - current_file_size) != OK) - { - D(("could not extend file to size %ld",length)); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - } - - result = OK; - - out: - - /* ftruncate() may change the size of the file, but it may - not change the current file position. */ - if(initial_position_valid) - Seek(fd->fd_DefaultFile,initial_position,OFFSET_CURRENT); - - __fd_unlock(fd); - - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/unistd_getcwd.c b/library/unistd_getcwd.c deleted file mode 100644 index e70035e..0000000 --- a/library/unistd_getcwd.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * $Id: unistd_getcwd.c,v 1.8 2005-03-18 12:38:25 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#undef getcwd - -/****************************************************************************/ - -__static char * -__getcwd(char * buffer,size_t buffer_size,const char *file,int line) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info buffer_nti; - #endif /* UNIX_PATH_SEMANTICS */ - char * buffer_allocated = NULL; - char * result = NULL; - BPTR dir_lock = ZERO; - - ENTER(); - - SHOWPOINTER(buffer); - SHOWVALUE(buffer_size); - - assert( buffer != NULL ); - assert( (int)buffer_size >= 0 ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(buffer == NULL || buffer_size == 0) - { - SHOWMSG("invalid buffer parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - dir_lock = Lock("",SHARED_LOCK); - PROFILE_ON(); - - if(dir_lock == ZERO) - { - SHOWMSG("could not get a lock on the current directory"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - /* If no buffer is provided, the behaviour of this function is - actually undefined. But we try to play nice and allocate - a custom buffer for the result to be returned. */ - if(buffer == NULL) - { - /* If the buffer size is not given, use the maximum we support. */ - if(buffer_size == 0) - buffer_size = MAXPATHLEN; - - buffer_allocated = __malloc(buffer_size,file,line); - if(buffer_allocated == NULL) - { - SHOWMSG("not enough memory for result buffer"); - - __set_errno(ENOMEM); - goto out; - } - - buffer = buffer_allocated; - } - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__current_path_name[0] != '\0') - { - if(buffer_size == 0) - { - __set_errno(ENOMEM); - goto out; - } - - assert( (int)buffer_size > 0 ); - - memmove(buffer,__current_path_name,buffer_size-1); - buffer[buffer_size-1] = '\0'; - - D(("returning absolute path name '%s'",buffer)); - - result = buffer; - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - if(result == NULL) - { - LONG status; - - PROFILE_OFF(); - status = NameFromLock(dir_lock,buffer,(LONG)buffer_size); - PROFILE_ON(); - - if(status == DOSFALSE) - { - SHOWMSG("could not get name from lock"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - const char * path_name = buffer; - size_t len; - - if(buffer_size == 0) - { - __set_errno(ENOMEM); - goto out; - } - - assert( (int)buffer_size > 0 ); - - if(__translate_amiga_to_unix_path_name(&path_name,&buffer_nti) != 0) - goto out; - - len = strlen(path_name); - if(len > buffer_size-1) - len = buffer_size-1; - - memmove(buffer,path_name,len); - buffer[len] = '\0'; - } - } - #endif /* UNIX_PATH_SEMANTICS */ - } - - SHOWSTRING(buffer); - - result = buffer; - - out: - - if(result == NULL && buffer_allocated != NULL) - free(buffer_allocated); - - PROFILE_OFF(); - UnLock(dir_lock); - PROFILE_ON(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -char * -getcwd(char * buffer, size_t buffer_size) -{ - char * result; - - result = __getcwd(buffer,buffer_size,NULL,0); - - return(result); -} diff --git a/library/unistd_getopt.c b/library/unistd_getopt.c deleted file mode 100644 index 8a57926..0000000 --- a/library/unistd_getopt.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * $Id: unistd_getopt.c,v 1.5 2005-02-28 10:07:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int opterr = 1; -int optind = 1; -int optopt; -char * optarg; - -/****************************************************************************/ - -int -getopt(int argc, char * argv[], char *opts) -{ - static int sp = 1; - int result = EOF; - char *cp; - int c; - - ENTER(); - - SHOWVALUE(argc); - SHOWPOINTER(argv); - SHOWSTRING(opts); - - assert( argc > 0 && argv != NULL && opts != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(argv == NULL || opts == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - SHOWVALUE(optind); - - if(sp == 1) - { - if(optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') - { - goto out; - } - else if (strcmp(argv[optind], "--") == SAME) - { - optind++; - - goto out; - } - } - - optopt = c = argv[optind][sp]; - - if(c == ':' || (cp = strchr(opts, c)) == NULL) - { - if(opterr != 0) - fprintf(stderr, "%s%s%c\n", argv[0], ": illegal option -- ", c); - - if(argv[optind][++sp] == '\0') - { - optind++; - - sp = 1; - } - - result = '?'; - goto out; - } - - if(*++cp == ':') - { - if(argv[optind][sp+1] != '\0') - { - optarg = &argv[optind++][sp+1]; - } - else if (++optind >= argc) - { - if(opterr != 0) - fprintf(stderr, "%s%s%c\n", argv[0], ": option requires an argument -- ", c); - - sp = 1; - - result = '?'; - goto out; - } - else - { - optarg = argv[optind++]; - } - - sp = 1; - } - else - { - if(argv[optind][++sp] == '\0') - { - sp = 1; - - optind++; - } - - optarg = NULL; - } - - result = c; - - out: - - RETURN(result); - return(result); -} diff --git a/library/unistd_getpid.c b/library/unistd_getpid.c deleted file mode 100644 index 9dfc580..0000000 --- a/library/unistd_getpid.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * $Id: unistd_getpid.c,v 1.3 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -pid_t -getpid(void) -{ - pid_t result; - - ENTER(); - - #if 0 - { - struct Process * this_process; - ULONG max_cli_number,i; - - this_process = (struct Process *)FindTask(NULL); - result = 0; - - Forbid(); - - max_cli_number = MaxCli(); - - for(i = 1 ; i <= max_cli_number ; i++) - { - if(FindCliProc(i) == this_process) - { - result = (pid_t)i; - break; - } - } - - Permit(); - } - #else - { - result = (pid_t)FindTask(NULL); - } - #endif - - /* ZZZ what should we do if are about to return zero? */ - assert( result != 0 ); - - RETURN(result); - return(result); -} diff --git a/library/unistd_headers.h b/library/unistd_headers.h deleted file mode 100644 index b683d7e..0000000 --- a/library/unistd_headers.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Id: unistd_headers.h,v 1.8 2005-05-15 12:32:58 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#define _UNISTD_HEADERS_H - -/****************************************************************************/ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_H */ - -/****************************************************************************/ - -extern char NOCOMMON __current_path_name[MAXPATHLEN]; - -/****************************************************************************/ - -/* Names of files and directories to delete when shutting down. */ -extern struct MinList NOCOMMON __unlink_list; - -/****************************************************************************/ - -/* Local timer I/O. */ -extern struct MsgPort * NOCOMMON __timer_port; -extern struct timerequest * NOCOMMON __timer_request; -extern BOOL NOCOMMON __timer_busy; -extern struct Library * NOCOMMON __TimerBase; - -/****************************************************************************/ - -#if defined(__amigaos4__) -extern struct TimerIFace * NOCOMMON __ITimer; -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -/* If the program's current directory was changed, here is where - we find out about it. */ -extern BPTR NOCOMMON __original_current_directory; -extern BOOL NOCOMMON __current_directory_changed; -extern BOOL NOCOMMON __unlock_current_directory; - -/****************************************************************************/ - -extern BOOL NOCOMMON __unix_path_semantics; - -/****************************************************************************/ - -extern int __set_current_path(const char * path_name); -extern int __strip_double_slash(char * file_name,int len); - -/****************************************************************************/ - -extern unsigned int __time_delay(unsigned long seconds,unsigned long microseconds); - -/****************************************************************************/ - -#endif /* _UNISTD_HEADERS_H */ diff --git a/library/unistd_init_exit.c b/library/unistd_init_exit.c deleted file mode 100644 index 648d027..0000000 --- a/library/unistd_init_exit.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * $Id: unistd_init_exit.c,v 1.12 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -/* Names of files and directories to delete when shutting down. */ -struct MinList NOCOMMON __unlink_list; - -/****************************************************************************/ - -CLIB_CONSTRUCTOR(unistd_init) -{ - ENTER(); - - NewList((struct List *)&__unlink_list); - - LEAVE(); - - CONSTRUCTOR_SUCCEED(); -} - -/****************************************************************************/ - -CLIB_DESTRUCTOR(unistd_exit) -{ - ENTER(); - - PROFILE_OFF(); - - if(__unlink_list.mlh_Head != NULL && NOT IsListEmpty((struct List *)&__unlink_list)) - { - struct UnlinkNode * uln; - BPTR old_dir; - - /* Close all the files that still might be open. */ - __close_all_files(); - - while((uln = (struct UnlinkNode *)RemHead((struct List *)&__unlink_list))) - { - old_dir = CurrentDir(uln->uln_Lock); - - D(("deleting '%s'",uln->uln_Name)); - - DeleteFile(uln->uln_Name); - - CurrentDir(old_dir); - - UnLock(uln->uln_Lock); - } - } - - PROFILE_ON(); - - LEAVE(); -} diff --git a/library/unistd_isatty.c b/library/unistd_isatty.c deleted file mode 100644 index 8a49a19..0000000 --- a/library/unistd_isatty.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $Id: unistd_isatty.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -isatty(int file_descriptor) -{ - int result = ERROR; - struct fd * fd; - - ENTER(); - - SHOWVALUE(file_descriptor); - - assert( file_descriptor >= 0 && file_descriptor < __num_fd ); - assert( __fd[file_descriptor] != NULL ); - assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); - - if(__check_abort_enabled) - __check_abort(); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_INTERACTIVE)) - result = 1; - else - result = 0; - - out: - - RETURN(result); - return(result); -} diff --git a/library/unistd_lchown.c b/library/unistd_lchown.c deleted file mode 100644 index 5270329..0000000 --- a/library/unistd_lchown.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * $Id: unistd_lchown.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -lchown(const char * path_name, uid_t owner, gid_t group) -{ - int result = ERROR; - - ENTER(); - - SHOWSTRING(path_name); - SHOWVALUE(owner); - SHOWVALUE(group); - - assert( path_name != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(path_name == NULL) - { - SHOWMSG("invalid path name"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - result = chown(path_name,owner,group); - - out: - - RETURN(result); - return(result); -} diff --git a/library/unistd_link.c b/library/unistd_link.c deleted file mode 100644 index bb2aa1a..0000000 --- a/library/unistd_link.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * $Id: unistd_link.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -link(const char * existing_path,const char * new_path) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info existing_path_name_nti; - struct name_translation_info new_path_name_nti; - #endif /* UNIX_PATH_SEMANTICS */ - BPTR existing_path_lock = ZERO; - int result = ERROR; - LONG status; - - ENTER(); - - SHOWSTRING(existing_path); - SHOWSTRING(new_path); - - assert( existing_path != NULL && new_path != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(existing_path == NULL || new_path == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name(&existing_path,&existing_path_name_nti) != 0) - goto out; - - if(__translate_unix_to_amiga_path_name(&new_path,&new_path_name_nti) != 0) - goto out; - - if(existing_path_name_nti.is_root || new_path_name_nti.is_root) - { - __set_errno(EACCES); - goto out; - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - D(("trying to get a lock on '%s'",existing_path)); - - PROFILE_OFF(); - existing_path_lock = Lock((STRPTR)existing_path,SHARED_LOCK); - PROFILE_ON(); - - if(existing_path_lock == ZERO) - { - SHOWMSG("that didn't work"); - - __set_errno(__translate_access_io_error_to_errno(IoErr())); - goto out; - } - - D(("trying to make a link named '%s'",new_path)); - - PROFILE_OFF(); - status = MakeLink((STRPTR)new_path,existing_path_lock,LINK_HARD); - PROFILE_ON(); - - if(status == DOSFALSE) - { - SHOWMSG("that didn't work"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - result = OK; - - out: - - PROFILE_OFF(); - UnLock(existing_path_lock); - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/unistd_readlink.c b/library/unistd_readlink.c deleted file mode 100644 index efa1d26..0000000 --- a/library/unistd_readlink.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * $Id: unistd_readlink.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -readlink(const char * path_name, char * buffer, int buffer_size) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info path_name_nti; - struct name_translation_info buffer_nti; - #endif /* UNIX_PATH_SEMANTICS */ - struct DevProc * dvp = NULL; - BPTR lock = ZERO; - int result = ERROR; - - ENTER(); - - SHOWSTRING(path_name); - SHOWPOINTER(buffer); - SHOWVALUE(buffer_size); - - assert( path_name != NULL && buffer != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(path_name == NULL || buffer == NULL) - { - SHOWSTRING("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics && __translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0) - goto out; - } - #endif /* UNIX_PATH_SEMANTICS */ - - D(("trying to get a lock on '%s'",path_name)); - - PROFILE_OFF(); - lock = Lock((STRPTR)path_name,SHARED_LOCK); - PROFILE_ON(); - - if(lock != ZERO) - { - LONG status; - - SHOWMSG("trying to obtain the absolute path"); - - PROFILE_OFF(); - status = NameFromLock(lock,buffer,buffer_size); - PROFILE_ON(); - - if(status == DOSFALSE) - { - SHOWMSG("that didn't work"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - } - else - { - LONG read_link_result; - - PROFILE_OFF(); - dvp = GetDeviceProc((STRPTR)path_name,NULL); - PROFILE_ON(); - - if(dvp == NULL) - { - SHOWMSG("didn't get deviceproc"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - PROFILE_OFF(); - read_link_result = ReadLink(dvp->dvp_Port,dvp->dvp_Lock,(STRPTR)path_name,buffer,(ULONG)buffer_size); - PROFILE_ON(); - - if(read_link_result == -1) - { - SHOWMSG("couldn't read the link"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - else if (read_link_result == -2) - { - SHOWMSG("buffer was too short"); - - __set_errno(ENOBUFS); - goto out; - } - } - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_amiga_to_unix_path_name((char const **)&buffer,&buffer_nti) != 0) - goto out; - - __restore_path_name((char const **)&buffer,&buffer_nti); - - strcpy(buffer,buffer_nti.substitute); - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - result = strlen(buffer); - - SHOWSTRING(buffer); - - out: - - PROFILE_OFF(); - - FreeDeviceProc(dvp); - UnLock(lock); - - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/unistd_realpath.c b/library/unistd_realpath.c deleted file mode 100644 index bb2a3c1..0000000 --- a/library/unistd_realpath.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * $Id: unistd_realpath.c,v 1.5 2005-02-28 10:07:32 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -char * -realpath(const char * path_name, char * buffer) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info path_name_nti; - struct name_translation_info buffer_nti; - #endif /* UNIX_PATH_SEMANTICS */ - struct DevProc * dvp = NULL; - BPTR lock = ZERO; - char *result = NULL; - - ENTER(); - - SHOWSTRING(path_name); - SHOWPOINTER(buffer); - - assert( path_name != NULL && buffer != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(path_name == NULL || buffer == NULL) - { - SHOWSTRING("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics && __translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0) - goto out; - } - #endif /* UNIX_PATH_SEMANTICS */ - - D(("trying to get a lock on '%s'",path_name)); - - PROFILE_OFF(); - lock = Lock((STRPTR)path_name,SHARED_LOCK); - PROFILE_ON(); - - if(lock != ZERO) - { - LONG status; - - SHOWMSG("trying to obtain the absolute path"); - - PROFILE_OFF(); - status = NameFromLock(lock,buffer,PATH_MAX); - PROFILE_ON(); - - if(status == DOSFALSE) - { - SHOWMSG("that didn't work"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - } - else - { - SHOWMSG("couldn't get a lock"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_amiga_to_unix_path_name((char const **)&buffer,&buffer_nti) != 0) - goto out; - - __restore_path_name((char const **)&buffer,&buffer_nti); - - strcpy(buffer,buffer_nti.substitute); - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - result = buffer; - - SHOWSTRING(buffer); - - out: - - PROFILE_OFF(); - - FreeDeviceProc(dvp); - UnLock(lock); - - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/unistd_restorepathname.c b/library/unistd_restorepathname.c deleted file mode 100644 index cbbb748..0000000 --- a/library/unistd_restorepathname.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * $Id: unistd_restorepathname.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -void -__restore_path_name(char const ** name_ptr,struct name_translation_info * nti) -{ - assert( name_ptr != NULL && (*name_ptr) != NULL && nti != NULL ); - - /* Reset the name pointer to its previous position. */ - (*name_ptr) = nti->original_name; -} diff --git a/library/unistd_setcurrentpath.c b/library/unistd_setcurrentpath.c deleted file mode 100644 index a6e523f..0000000 --- a/library/unistd_setcurrentpath.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * $Id: unistd_setcurrentpath.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -int -__set_current_path(const char * path_name) -{ - int result = ERROR; - - SHOWSTRING(path_name); - - ENTER(); - - assert( path_name != NULL ); - - if(strlen(path_name)+1 > sizeof(__current_path_name)) - { - SHOWMSG("path is too long"); - - __set_errno(ENAMETOOLONG); - goto out; - } - - /* Only store the path if it's absolute. */ - if(path_name[0] == '/') - strcpy(__current_path_name,path_name); - else - strcpy(__current_path_name,""); - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/unistd_sleep.c b/library/unistd_sleep.c deleted file mode 100644 index 1cdc079..0000000 --- a/library/unistd_sleep.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: unistd_sleep.c,v 1.5 2005-03-27 10:02:50 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* ZZZ sleep() must be reentrant according to POSIX.1 */ -unsigned int -sleep(unsigned int seconds) -{ - unsigned int result; - - ENTER(); - - result = __time_delay(seconds,0); - - RETURN(result); - return(result); -} diff --git a/library/unistd_strip_double_slash.c b/library/unistd_strip_double_slash.c deleted file mode 100644 index dbc029e..0000000 --- a/library/unistd_strip_double_slash.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * $Id: unistd_strip_double_slash.c,v 1.3 2005-05-15 12:32:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* Remove '//' from an AmigaDOS path name. For example, "volume:one/two//three" - is equivalent to "volume:one/three" and the following function removes the - redundant part of the path. */ -int -__strip_double_slash(char * file_name,int len) -{ - int position; - - position = len; - - while(len > 1) - { - position--; - - /* Stop when we hit the volume name or the first character of the name. */ - if((position == 0) || (file_name[position] == ':') || (file_name[position - 1] == ':')) - break; - - /* Do we have a // embedded in the file_name? That // must stand alone - between directory names and not in front of a volume name or - yet another /. */ - if((position > 1) && (file_name[position] == '/' && file_name[position - 1] == '/') && (file_name[position - 2] != ':' && file_name[position - 2] != '/')) - { - int start,delta; - - start = position; - - /* Back up behind the //. */ - position -= 2; - - /* Find the spot where the previous directory or volume - name begins. */ - while((position > 0) && (file_name[position] != ':') && (file_name[position] != '/')) - position--; - - /* Don't move too far. */ - if((file_name[position] == ':') || (file_name[position] == '/')) - position++; - - /* Find out how long the directory name is that - we are going to remove now. */ - delta = start - position + 1; - - /* Remove the file_name part; we copy one more byte than - necessary to account for the NUL at the end. */ - len -= delta; - - memmove(&file_name[position],&file_name[position + delta],len - position + 1); - - /* The string is shorter, and here we go again... */ - position = len; - } - } - - return(len); -} diff --git a/library/unistd_symlink.c b/library/unistd_symlink.c deleted file mode 100644 index e5de909..0000000 --- a/library/unistd_symlink.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Id: unistd_symlink.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* ZZZ symbolic_path must be interpreted relative to the current (!) - * directory here. - */ -int -symlink(const char * actual_path, const char * symbolic_path) -{ - int result = ERROR; - LONG status; - - ENTER(); - - SHOWSTRING(actual_path); - SHOWSTRING(symbolic_path); - - assert( actual_path != NULL && symbolic_path != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(actual_path == NULL || symbolic_path == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - SHOWMSG("trying to make that link"); - - PROFILE_OFF(); - status = MakeLink((STRPTR)symbolic_path,(LONG)actual_path,LINK_SOFT); - PROFILE_ON(); - - if(status == DOSFALSE) - { - SHOWMSG("that didn't work"); - - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/unistd_sync_fd.c b/library/unistd_sync_fd.c deleted file mode 100644 index 1d67eb7..0000000 --- a/library/unistd_sync_fd.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * $Id: unistd_sync_fd.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -#if defined(__amigaos4__) && !defined(Flush) -#define Flush(fh) FFlush(fh) -#endif /* __amigaos4__ && !Flush */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -__sync_fd(struct fd * fd,int mode) -{ - int result = ERROR; - - assert( fd != NULL ); - - __fd_lock(fd); - - if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET)) - { - __set_errno(EINVAL); - goto out; - } - - if(FLAG_IS_SET(fd->fd_Flags,FDF_STDIO)) - { - __set_errno(EBADF); - goto out; - } - - /* The mode tells us what to flush. 0 means "flush just the data", and - everything else means "flush everything. */ - Flush(fd->fd_DefaultFile); - - if(mode != 0) - { - struct FileHandle * fh = BADDR(fd->fd_DefaultFile); - - /* Verify that this file is not bound to "NIL:". */ - if(fh->fh_Type != NULL) - DoPkt(fh->fh_Type,ACTION_FLUSH, 0,0,0,0,0); - } - - result = OK; - - out: - - __fd_unlock(fd); - - return(result); -} diff --git a/library/unistd_time_delay.c b/library/unistd_time_delay.c deleted file mode 100644 index e031041..0000000 --- a/library/unistd_time_delay.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * $Id: unistd_time_delay.c,v 1.5 2005-03-18 12:38:25 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -#ifndef PROTO_TIMER_H -#include -#endif /* PROTO_TIMER_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -unsigned int -__time_delay(unsigned long seconds,unsigned long microseconds) -{ - unsigned int result = 0; - - ENTER(); - - SHOWVALUE(seconds); - - if(__check_abort_enabled) - __check_abort(); - - if((seconds > 0 || microseconds > 0) && NOT __timer_busy) - { - #if defined(__amigaos4__) - struct TimerIFace * ITimer = __ITimer; - #else - struct Library * TimerBase = __TimerBase; - #endif /* __amigaos4__ */ - - ULONG signals_to_wait_for; - ULONG seconds_then; - ULONG timer_signal; - struct timeval tv; - ULONG signals; - - __timer_busy = TRUE; - - __timer_request->tr_node.io_Command = TR_ADDREQUEST; - __timer_request->tr_time.tv_secs = seconds; - __timer_request->tr_time.tv_micro = microseconds; - - timer_signal = (1UL << __timer_port->mp_SigBit); - - signals_to_wait_for = timer_signal; - - SetSignal(0,signals_to_wait_for); - - if(__check_abort_enabled) - SET_FLAG(signals_to_wait_for,SIGBREAKF_CTRL_C); - - PROFILE_OFF(); - GetSysTime(&tv); - PROFILE_ON(); - - seconds_then = tv.tv_secs + seconds; - - SendIO((struct IORequest *)__timer_request); - - while(TRUE) - { - PROFILE_OFF(); - signals = Wait(signals_to_wait_for); - PROFILE_ON(); - - if(FLAG_IS_SET(signals,SIGBREAKF_CTRL_C)) - { - ULONG seconds_now; - - if(CheckIO((struct IORequest *)__timer_request)) - AbortIO((struct IORequest *)__timer_request); - - WaitIO((struct IORequest *)__timer_request); - - SetSignal(SIGBREAKF_CTRL_C,SIGBREAKF_CTRL_C); - __check_abort(); - - /* Now figure out how many seconds have elapsed and - how many would still remain. */ - PROFILE_OFF(); - GetSysTime(&tv); - PROFILE_ON(); - - seconds_now = tv.tv_secs; - if(seconds_now < seconds_then) - result = seconds_then - seconds_now; - - break; - } - - if(FLAG_IS_SET(signals,timer_signal)) - { - WaitIO((struct IORequest *)__timer_request); - break; - } - } - - __timer_busy = FALSE; - } - - RETURN(result); - return(result); -} diff --git a/library/unistd_timer.c b/library/unistd_timer.c deleted file mode 100644 index b8cf62e..0000000 --- a/library/unistd_timer.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * $Id: unistd_timer.c,v 1.8 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* Local timer I/O. */ -struct MsgPort * NOCOMMON __timer_port; -struct timerequest * NOCOMMON __timer_request; -BOOL NOCOMMON __timer_busy; -struct Library * NOCOMMON __TimerBase; - -/****************************************************************************/ - -#if defined(__amigaos4__) -struct TimerIFace * NOCOMMON __ITimer; -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -CLIB_CONSTRUCTOR(timer_init) -{ - BOOL success = FALSE; - - ENTER(); - - __timer_port = CreateMsgPort(); - if(__timer_port == NULL) - { - __show_error("The timer message port could not be created."); - goto out; - } - - __timer_request = (struct timerequest *)CreateIORequest(__timer_port,sizeof(*__timer_request)); - if(__timer_request == NULL) - { - __show_error("The timer I/O request could not be created."); - goto out; - } - - if(OpenDevice(TIMERNAME,UNIT_VBLANK,(struct IORequest *)__timer_request,0) != OK) - { - __show_error("The timer could not be opened."); - goto out; - } - - __TimerBase = (struct Library *)__timer_request->tr_node.io_Device; - - #if defined(__amigaos4__) - { - __ITimer = (struct TimerIFace *)GetInterface(__TimerBase, "main", 1, 0); - if(__ITimer == NULL) - { - __show_error("The timer interface could not be obtained."); - goto out; - } - } - #endif /* __amigaos4__ */ - - success = TRUE; - - out: - - SHOWVALUE(success); - LEAVE(); - - if(success) - CONSTRUCTOR_SUCCEED(); - else - CONSTRUCTOR_FAIL(); -} - -/****************************************************************************/ - -CLIB_DESTRUCTOR(timer_exit) -{ - ENTER(); - - #if defined(__amigaos4__) - { - if(__ITimer != NULL) - DropInterface((struct Interface *)__ITimer); - - __ITimer = NULL; - } - #endif /* __amigaos4__ */ - - __TimerBase = NULL; - - if(__timer_request != NULL) - { - if(__timer_request->tr_node.io_Device != NULL) - CloseDevice((struct IORequest *)__timer_request); - - DeleteIORequest((struct IORequest *)__timer_request); - __timer_request = NULL; - } - - if(__timer_port != NULL) - { - DeleteMsgPort(__timer_port); - __timer_port = NULL; - } - - LEAVE(); -} diff --git a/library/unistd_translatea2u.c b/library/unistd_translatea2u.c deleted file mode 100644 index b72ce7b..0000000 --- a/library/unistd_translatea2u.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * $Id: unistd_translatea2u.c,v 1.6 2005-05-15 12:32:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -int -__translate_amiga_to_unix_path_name(char const ** name_ptr,struct name_translation_info * nti) -{ - const int max_unix_len = sizeof(nti->substitute)-1; - char local_replacement[sizeof(nti->substitute)]; - BOOL have_double_slash; - int len,replace_len; - int result = ERROR; - int i; - char * replace; - char * name; - - assert( name_ptr != NULL && (*name_ptr) != NULL && nti != NULL ); - - replace = nti->substitute; - - name = (char *)(*name_ptr); - - /* Check if the name would become too long to handle. */ - len = strlen(name); - if(len >= (int)sizeof(nti->substitute)) - { - D(("path name '%s' is too long (%ld characters total; maximum is %ld)!",name,len,sizeof(nti->substitute)-1)); - - __set_errno(ENAMETOOLONG); - goto out; - } - - /* Reduce any '//' embedded in the name if possible. */ - have_double_slash = FALSE; - - for(i = 0 ; i < len-1 ; i++) - { - if(name[i] == '/' && name[i+1] == '/') - { - have_double_slash = TRUE; - break; - } - } - - if(have_double_slash) - { - /* We will need to make a copy of the name. Make sure that it fits. */ - if(len > max_unix_len) - { - __set_errno(ENAMETOOLONG); - goto out; - } - - strcpy(local_replacement,name); - name = local_replacement; - - len = __strip_double_slash(name,len); - } - - /* The empty string corresponds to the current - * directory, which is the ".". - */ - if(len == 0) - { - strcpy(replace,"."); - } - else - { - char * volume_name; - int volume_name_len; - - /* Figure out if the path includes a volume, device or assignment name. - If so, strip it from the path, to be translated and added later. */ - volume_name = NULL; - volume_name_len = 0; - - for(i = 0 ; i < len ; i++) - { - if(name[i] == ':') - { - volume_name = name; - volume_name_len = i; - - name += volume_name_len+1; - len -= volume_name_len+1; - - break; - } - } - - /* Replace all "/" characters in the name which don't just act as - * separators with "..". Otherwise, copy the name string to the - * replacement buffer. - */ - replace_len = 0; - - while(name[0] == '/') - { - if(replace_len + 3 > max_unix_len) - { - __set_errno(ENAMETOOLONG); - goto out; - } - - memmove(&replace[replace_len],"../",3); - replace_len += 3; - - name++; - len--; - - if(len == 0) - { - /* Strip the trailing '/'. */ - replace[--replace_len] = '\0'; - } - } - - for(i = 0 ; i < len ; i++) - { - if(name[i] == '/' && (name[i+1] == '/' || name[i+1] == '\0')) - { - if(replace_len + 3 > max_unix_len) - { - __set_errno(ENAMETOOLONG); - goto out; - } - - memmove(&replace[replace_len],"/..",3); - replace_len += 3; - } - else - { - if(replace_len + 1 > max_unix_len) - { - __set_errno(ENAMETOOLONG); - goto out; - } - - replace[replace_len++] = name[i]; - } - } - - assert( replace_len <= max_unix_len ); - - replace[replace_len] = '\0'; - - /* If necessary, add and translate the volume name found above. */ - if(volume_name != NULL) - { - /* Check if the complete path will fit. This assumes the worst - case scenario. */ - if(1 + volume_name_len + 1 + replace_len > max_unix_len) - { - __set_errno(ENAMETOOLONG); - goto out; - } - - if(volume_name_len > 0) - { - if(replace_len > 0) - { - /* Add the volume name in front of the path. */ - memmove(&replace[1 + volume_name_len + 1],replace,(size_t)(replace_len+1)); - replace[0] = replace[1 + volume_name_len] = '/'; - memmove(&replace[1],volume_name,(size_t)volume_name_len); - } - else - { - /* There is only the volume name. */ - replace[0] = '/'; - memmove(&replace[1],volume_name,(size_t)volume_name_len); - replace[volume_name_len + 1] = '\0'; - } - } - else - { - int path_prefix_len = 0; - - /* We need to expand ':'. If the current directory name is - known and refers to an absolute path, we borrow the - absolute path name component. */ - if(__current_path_name[0] != '\0') - { - int path_name_len; - - path_name_len = strlen(__current_path_name); - - /* Figure out where the absolute path name portion ends. */ - for(i = 1 ; i <= path_name_len ; i++) - { - if(__current_path_name[i] == '/' || - __current_path_name[i] == '\0') - { - path_prefix_len = i; - break; - } - } - - /* If we found the absolute path name portion, use it. */ - if(path_prefix_len > 0) - { - if(path_prefix_len + 1 + replace_len > max_unix_len) - { - __set_errno(ENAMETOOLONG); - goto out; - } - - if(replace_len > 0) - { - memmove(&replace[path_prefix_len + 1],replace,(size_t)(replace_len+1)); - memmove(replace,__current_path_name,(size_t)path_prefix_len); - replace[path_prefix_len] = '/'; - } - else - { - memmove(replace,__current_path_name,(size_t)path_prefix_len); - replace[path_prefix_len] = '\0'; - } - } - } - - if(path_prefix_len == 0) - { - /* The ':foo' path gets translated into '/foo'. */ - memmove(&replace[1],replace,(size_t)(replace_len+1)); - replace[0] = '/'; - } - } - } - } - - name = replace; - - assert( strlen(name) < (size_t)max_unix_len ); - - nti->original_name = (char *)(*name_ptr); - (*name_ptr) = name; - - D(("translated '%s' to '%s'",nti->original_name,name)); - - result = OK; - - out: - - return(result); -} diff --git a/library/unistd_translaterel.c b/library/unistd_translaterel.c deleted file mode 100644 index 35e84aa..0000000 --- a/library/unistd_translaterel.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * $Id: unistd_translaterel.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -int -__translate_relative_path_name(char const ** name_ptr,char *replacement_buffer,size_t replacement_buffer_size) -{ - int result = ERROR; - char * name; - - assert( name_ptr != NULL && (*name_ptr) != NULL && replacement_buffer != NULL ); - - /* If we have a current directory which all references should - * be made relative to, do just that. Absolute paths - * are not modified, though. - */ - name = (char *)(*name_ptr); - if(__current_path_name[0] != '\0' && name[0] != '/') - { - size_t total_len; - BOOL add_slash; - - /* Get the current directory name and get - * ready to attach the file name at the end. - */ - total_len = strlen(__current_path_name); - - if(__current_path_name[total_len-1] != '/' && - __current_path_name[total_len-1] != ':' && - name[0] != '\0') - { - add_slash = TRUE; - - total_len++; - } - else - { - add_slash = FALSE; - } - - total_len += strlen(name); - - /* Check if the complete string will fit, including the terminating NUL byte. */ - if(total_len+1 > replacement_buffer_size) - { - __set_errno(ENAMETOOLONG); - goto out; - } - - /* Put the file name together. */ - strcpy(replacement_buffer,__current_path_name); - - if(add_slash) - strcat(replacement_buffer,"/"); - - strcat(replacement_buffer,name); - - assert( strlen(replacement_buffer) < replacement_buffer_size ); - - (*name_ptr) = replacement_buffer; - } - - result = OK; - - out: - - return(result); -} diff --git a/library/unistd_translateu2a.c b/library/unistd_translateu2a.c deleted file mode 100644 index 14eaa8b..0000000 --- a/library/unistd_translateu2a.c +++ /dev/null @@ -1,553 +0,0 @@ -/* - * $Id: unistd_translateu2a.c,v 1.9 2005-05-15 12:32:59 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 DEBUG*/ - -#ifndef _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* - * The following patterns must translate properly: - * - * foo/ - * /// - * foo//bar - * foo//bar//baz - * ./foo - * ././foo - * foo/./baz - * foo/./bar/./baz - * foo/. - * /. - * /tmp - * /tmp/foo - * /dev/null - * /dev/null/foo - * /dev/nullX - * /foo - * /foo/ - * /foo/bar - * /foo/bar/baz - * foo/../bar - * foo/bar/../../baz - * foo/bar/.. - * ../foo - * ../../foo - * . - * .. - */ - -/****************************************************************************/ - -int -__translate_unix_to_amiga_path_name(char const ** name_ptr,struct name_translation_info * nti) -{ - int result = ERROR; - char * name; - - /*PUSHDEBUGLEVEL(2);*/ - - assert( name_ptr != NULL && (*name_ptr) != NULL && nti != NULL ); - - name = (char *)(*name_ptr); - - nti->is_root = FALSE; - - /* If this is not an absolute Amiga path name, which we will accept "as is", - perform the translation and substitution. */ - if(strchr(name,':') == NULL) - { - char volume_name[sizeof(nti->substitute)]; - size_t volume_name_len; - char * replace = nti->substitute; - size_t len,i,j; - - /* Check if the name would become too long to handle. */ - len = strlen(name); - if(len >= sizeof(nti->substitute)) - { - D(("path name '%s' is too long (%ld characters total; maximum is %ld)!",name,len,sizeof(nti->substitute)-1)); - - __set_errno(ENAMETOOLONG); - goto out; - } - - D(("initial name = '%s'",name)); - - /* Prepend an absolute path to the name, if such a path was previously set - as the current directory. */ - if(__translate_relative_path_name((const char **)&name,nti->substitute,sizeof(nti->substitute)) < 0) - { - SHOWMSG("relative path name could not be worked into the pattern"); - goto out; - } - - /* If the name was replaced, update the string length cached. */ - if(name != (*name_ptr)) - { - D(("name after relative path replacement = '%s'",name)); - - len = strlen(name); - } - - /* If there are neighboring slashes, strip all but one - ('foo//bar' -> 'foo/bar'). The "//" pattern in a Unix - file name is apparently harmless, but on AmigaDOS it - has a very definite meaning. */ - if(len > 2) - { - BOOL have_double_slash = FALSE; - - for(i = 0 ; i < len - 1 ; i++) - { - if(name[i] == '/' && name[i + 1] == '/') - { - have_double_slash = TRUE; - break; - } - } - - if(have_double_slash) - { - BOOL have_slash; - char c; - - have_slash = FALSE; - - for(i = j = 0 ; i < len ; i++) - { - c = name[i]; - - if(c == '/') - { - if(NOT have_slash) - replace[j++] = c; - - have_slash = TRUE; - } - else - { - replace[j++] = c; - - have_slash = FALSE; - } - } - - name = replace; - - len = j; - - name[len] = '\0'; - D(("name = '%s' (line %ld)",name,__LINE__)); - } - } - - /* If there are any, strip the trailing slashes ('foo/' -> 'foo'). A - leading '/' must be preserved, though ('///' -> '/'). */ - if(len > 1) - { - size_t num_trailing_slashes = 0; - - while((num_trailing_slashes < len - 1) && (name[len - (num_trailing_slashes + 1)] == '/')) - num_trailing_slashes++; - - if(num_trailing_slashes > 0) - { - len -= num_trailing_slashes; - - if(name != replace) - { - memmove(replace,name,len); - name = replace; - } - - name[len] = '\0'; - D(("name = '%s' (line %ld)",name,__LINE__)); - } - } - - /* Ditch all leading './' ('./foo' -> 'foo'). */ - while(len > 2 && name[0] == '.' && name[1] == '/') - { - name += 2; - len -= 2; - - D(("name = '%s' (line %ld)",name,__LINE__)); - } - - /* Ditch all embedded '/./' ('foo/./bar' -> 'foo/bar'). */ - if(len > 2) - { - BOOL have_slash_dot_slash = FALSE; - - for(i = j = 0 ; i < len - 2 ; i++) - { - if(name[i] == '/' && name[i + 1] == '.' && name[i + 2] == '/') - { - have_slash_dot_slash = TRUE; - break; - } - } - - if(have_slash_dot_slash) - { - for(i = j = 0 ; i < len ; i++) - { - replace[j++] = name[i]; - - if(name[i] == '/' && name[i + 1] == '.' && name[i + 2] == '/') - i += 2; - } - - len = j; - - name = replace; - - name[len] = '\0'; - D(("name = '%s' (line %ld)",name,__LINE__)); - } - } - - /* Special case: the path name may end with "/." signifying that the - directory itself is requested ('foo/.' -> 'foo'). */ - if(len >= 2 && strncmp(&name[len - 2],"/.",2) == SAME) - { - /* If it's just '/.' then it's really '/'. */ - if(len == 2) - { - strcpy(replace,"/"); - name = replace; - - len = 1; - } - else - { - if(name != replace) - { - memmove(replace,name,len - 2); - name = replace; - } - - len -= 2; - } - - name[len] = '\0'; - D(("name = '%s' (line %ld)",name,__LINE__)); - } - - /* Check for absolute path. */ - if(name[0] == '/') - { - if(len == 1) - { - SHOWMSG("this is the root directory"); - - nti->is_root = TRUE; - } - - /* Ok, so this is an absolute path. We begin by checking - for a few special cases, the first being a reference - to "/tmp". */ - if((strncmp(name,"/tmp",4) == SAME) && (name[4] == '/' || len == 4)) - { - if(name[4] == '/') - { - /* Convert "/tmp/foo" to "T:foo". */ - memmove(&replace[2],&name[5],len - 5); - memmove(replace,"T:",2); - - len -= 3; - } - else - { - /* Convert "/tmp" to "T:". */ - strcpy(replace,"T:"); - - len = 2; - } - - name = replace; - - name[len] = '\0'; - D(("name = '%s' (line %ld)",name,__LINE__)); - } - else if ((strncmp(name,"/dev/null",9)) == SAME && (len == 9 || name[9] == '/')) - { - strcpy(replace,"NIL:"); - name = replace; - - len = 4; - - name[len] = '\0'; - D(("name = '%s' (line %ld)",name,__LINE__)); - } - else - { - size_t path_name_start = 0; - - volume_name_len = 0; - - /* Find out how long the first component - of the absolute path is. */ - for(i = 1 ; i <= len ; i++) - { - if(i == len || name[i] == '/') - { - volume_name_len = i - 1; - - /* Is there anything following the path name? */ - if(i < len) - path_name_start = i + 1; - - break; - } - } - - /* Copy the first component and attach a colon. "/foo" becomes "foo:". */ - memmove(replace,&name[1],volume_name_len); - replace[volume_name_len++] = ':'; - - /* Now add the finishing touches. "/foo/bar" finally - becomes "foo:bar" and "/foo" becomes "foo:". */ - if(path_name_start > 0) - { - memmove(&replace[volume_name_len],&name[path_name_start],len - path_name_start); - - len--; - } - - name = replace; - - name[len] = '\0'; - D(("name = '%s' (line %ld)",name,__LINE__)); - } - } - - /* Extract and remove the volume name from the path. We - are going to need it later. */ - volume_name_len = 0; - - for(i = 0 ; i < len ; i++) - { - if(name[i] == ':') - { - /* Look for extra colon characters embedded in the name - (as in "foo/bar:baz") which really don't belong here. */ - for(j = 0 ; j < i ; j++) - { - if(name[j] == '/') - { - D(("name '%s' still contains colon characters",name)); - - __set_errno(EINVAL); /* invalid name */ - goto out; - } - } - - volume_name_len = i + 1; - - memmove(volume_name,name,volume_name_len); - - name += volume_name_len; - len -= volume_name_len; - - D(("name = '%s' (line %ld)",name,__LINE__)); - - break; - } - } - - /* Look for extra colon characters embedded in the name - (as in "foo:bar:baz") which really don't belong here. */ - for(i = 0 ; i < len ; i++) - { - if(name[i] == ':') - { - D(("name '%s' still contains colon characters",name)); - - __set_errno(EINVAL); /* invalid name */ - goto out; - } - } - - /* Now parse the path name and replace all embedded '..' with - the AmigaDOS counterparts ('foo/../bar' -> 'foo//bar'). */ - if(len > 3) - { - BOOL have_slash_dot_dot_slash = FALSE; - - for(i = j = 0 ; i < len - 3 ; i++) - { - if(name[i] == '/' && name[i + 1] == '.' && name[i + 2] == '.' && name[i + 3] == '/') - { - have_slash_dot_dot_slash = TRUE; - break; - } - } - - if(have_slash_dot_dot_slash) - { - for(i = j = 0 ; i < len ; i++) - { - replace[j++] = name[i]; - - if(name[i] == '/' && name[i + 1] == '.' && name[i + 2] == '.' && name[i + 3] == '/') - i += 2; - } - - len = j; - - name = replace; - - name[len] = '\0'; - D(("name = '%s' (line %ld)",name,__LINE__)); - } - } - - /* Translate a trailing '/..' to '//' */ - if(len >= 3 && strncmp(&name[len - 3],"/..",3) == SAME) - { - if(name != replace) - { - memmove(replace,name,len - 2); - name = replace; - } - - len -= 2; - - name[len++] = '/'; - - name[len] = '\0'; - D(("name = '%s' (line %ld)",name,__LINE__)); - } - - /* Translate a leading '../' ('../foo' -> '/foo') */ - if(len >= 3 && strncmp(name,"../",3) == SAME) - { - memmove(replace,&name[2],len - 2); - name = replace; - - len -= 2; - - name[len] = '\0'; - D(("name = '%s' (line %ld)",name,__LINE__)); - } - - /* Translate the '..' ('..' -> '/') */ - if(len == 2 && strncmp(name,"..",2) == SAME) - { - strcpy(replace,"/"); - name = replace; - - len = 1; - - D(("name = '%s' (line %ld)",name,__LINE__)); - } - - /* Translate the '.' ('.' -> '') */ - if(len == 1 && name[0] == '.') - { - strcpy(replace,""); - name = replace; - - len = 0; - - D(("name = '%s' (line %ld)",name,__LINE__)); - } - - /* Now put it all together again. */ - if(volume_name_len > 0) - { - memmove(&replace[volume_name_len],name,len); - memmove(replace,volume_name,volume_name_len); - - len += volume_name_len; - - name = replace; - - name[len] = '\0'; - D(("name = '%s' (line %ld)",name,__LINE__)); - } - - /* Reduce any "//" embedded in the name, if necessary. */ - if(len > 1) - { - BOOL have_double_slash = FALSE; - - for(i = 0 ; i < len - 1 ; i++) - { - if(name[i] == '/' && name[i + 1] == '/') - { - have_double_slash = TRUE; - break; - } - } - - if(have_double_slash) - { - if(name != replace) - { - memmove(replace,name,len); - name = replace; - } - - len = __strip_double_slash(name,len); - - D(("name = '%s' (line %ld)",name,__LINE__)); - } - } - - /* The following is somewhat controversial. It assumes that what comes out - as a path name that ends with ":/" should translate into the root - directory. This would not be the case for the names of assignments, - though, for which the "/" suffix would actually do something useful. */ - if(len >= 2 && strncmp(&name[len - 2],":/",2) == SAME) - nti->is_root = TRUE; - } - - nti->original_name = (char *)(*name_ptr); - (*name_ptr) = name; - - D(("translated '%s' to '%s'",nti->original_name,name)); - - result = OK; - -out: - - /*POPDEBUGLEVEL();*/ - - return(result); -} diff --git a/library/unistd_truncate.c b/library/unistd_truncate.c deleted file mode 100644 index d170792..0000000 --- a/library/unistd_truncate.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Id: unistd_truncate.c,v 1.6 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -truncate(const char * path_name, off_t length) -{ - int result = ERROR; - int fd; - - ENTER(); - - SHOWSTRING(path_name); - SHOWVALUE(length); - - assert( path_name != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(path_name == NULL) - { - SHOWMSG("invalid path name"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(length < 0) - { - SHOWMSG("invalid length"); - - __set_errno(EINVAL); - goto out; - } - - fd = open(path_name,O_WRONLY); - if(fd < 0) - { - SHOWMSG("file didn't open"); - goto out; - } - - result = ftruncate(fd,length); - - close(fd); - - out: - - RETURN(result); - return(result); -} diff --git a/library/unistd_ttyname.c b/library/unistd_ttyname.c deleted file mode 100755 index dd77e88..0000000 --- a/library/unistd_ttyname.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * $Id: unistd_ttyname.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* - * Just a quick kludge. - */ - -char * -ttyname(int file_descriptor) -{ - char * result = NULL; - struct fd *fd; - - ENTER(); - - SHOWVALUE(file_descriptor); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - __set_errno(EBADF); - goto out; - } - - if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_IS_INTERACTIVE)) - { - __set_errno(ENOTTY); - goto out; - } - - result = "CONSOLE:"; - - out: - - RETURN(result); - return(result); -} diff --git a/library/unistd_ttyname_r.c b/library/unistd_ttyname_r.c deleted file mode 100755 index d5f49c1..0000000 --- a/library/unistd_ttyname_r.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * $Id: unistd_ttyname_r.c,v 1.1 2005-06-04 10:46:21 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* - * Just a quick kludge, really. - */ - -int -ttyname_r(int file_descriptor,char *name,size_t buflen) -{ - struct fd *fd; - int result; - - ENTER(); - - SHOWVALUE(file_descriptor); - - fd = __get_file_descriptor(file_descriptor); - if(fd == NULL) - { - result = EBADF; - goto out; - } - - if(FLAG_IS_CLEAR(fd->fd_Flags,FDF_IS_INTERACTIVE)) - { - result = ENOTTY; - goto out; - } - - if(buflen < _POSIX_TTY_NAME_MAX) /* XXX Should this be _POSIX_PATH_MAX? */ - { - result = ERANGE; - goto out; - } - - strcpy(name,"CONSOLE:"); /* The buffer is at least 9 bytes, so this is ok. */ - - result = OK; - - out: - - RETURN(result); - return(result); -} diff --git a/library/unistd_unix_path_semantics.c b/library/unistd_unix_path_semantics.c deleted file mode 100644 index d721811..0000000 --- a/library/unistd_unix_path_semantics.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: unistd_unix_path_semantics.c,v 1.3 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -BOOL NOCOMMON __unix_path_semantics = TRUE; diff --git a/library/unistd_unlink.c b/library/unistd_unlink.c deleted file mode 100644 index 1d52168..0000000 --- a/library/unistd_unlink.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * $Id: unistd_unlink.c,v 1.8 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -/* ZZZ unlink() must be reentrant according to POSIX.1 */ -int -unlink(const char * path_name) -{ - #if defined(UNIX_PATH_SEMANTICS) - DECLARE_UTILITYBASE(); - struct name_translation_info path_name_nti; - #endif /* UNIX_PATH_SEMANTICS */ - BPTR current_dir = ZERO; - int result = ERROR; - LONG status; - - 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 path name"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0) - goto out; - - if(path_name_nti.is_root) - { - __set_errno(EACCES); - goto out; - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - D(("trying to delete '%s'",path_name)); - - PROFILE_OFF(); - status = DeleteFile((STRPTR)path_name); - PROFILE_ON(); - - if(status == DOSFALSE) - { - #if defined(UNIX_PATH_SEMANTICS) - { - struct UnlinkNode * node; - struct UnlinkNode * uln; - BOOL found = FALSE; - - assert( UtilityBase != NULL ); - - if(IoErr() != ERROR_OBJECT_IN_USE) - { - __set_errno(__translate_access_io_error_to_errno(IoErr())); - goto out; - } - - SHOWMSG("will try to delete that file later"); - - /* ZZZ we should be locking the path's parent directory - and then just remember what the last part of the path - pointed to. */ - PROFILE_OFF(); - current_dir = Lock("",SHARED_LOCK); - PROFILE_ON(); - - if(current_dir == ZERO) - { - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - PROFILE_OFF(); - - assert( __unlink_list.mlh_Head != NULL ); - - for(node = (struct UnlinkNode *)__unlink_list.mlh_Head ; - node->uln_MinNode.mln_Succ != NULL ; - node = (struct UnlinkNode *)node->uln_MinNode.mln_Succ) - { - if(Stricmp(node->uln_Name,path_name) == SAME && SameLock(node->uln_Lock,current_dir) == LOCK_SAME) - { - found = TRUE; - break; - } - } - - PROFILE_ON(); - - if(NOT found) - { - uln = malloc(sizeof(*uln) + strlen(path_name) + 1); - if(uln == NULL) - goto out; - - uln->uln_Lock = current_dir; - uln->uln_Name = (char *)(uln + 1); - - strcpy(uln->uln_Name,path_name); - AddTail((struct List *)&__unlink_list,(struct Node *)uln); - - current_dir = ZERO; - } - } - #else - { - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - #endif /* UNIX_PATH_SEMANTICS */ - } - - result = OK; - - out: - - PROFILE_OFF(); - UnLock(current_dir); - PROFILE_ON(); - - RETURN(result); - return(result); -} diff --git a/library/unistd_usleep.c b/library/unistd_usleep.c deleted file mode 100644 index 6f2b2cf..0000000 --- a/library/unistd_usleep.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * $Id: unistd_usleep.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UNISTD_HEADERS_H -#include "unistd_headers.h" -#endif /* _UNISTD_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -void -usleep(unsigned long microseconds) -{ - ENTER(); - - SHOWVALUE(microseconds); - - __time_delay(0,microseconds); - - LEAVE(); -} diff --git a/library/unistd_wildcard_expand.c b/library/unistd_wildcard_expand.c deleted file mode 100644 index dffe8d3..0000000 --- a/library/unistd_wildcard_expand.c +++ /dev/null @@ -1,519 +0,0 @@ -/* - * $Id: unistd_wildcard_expand.c,v 1.14 2005-06-26 10:23:05 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Neither the name of Olaf Barthel nor the names of contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_MEMORY_H -#include "stdlib_memory.h" -#endif /* _STDLIB_MEMORY_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -#ifndef CLIB_ALIB_PROTOS_H -#include -#endif /* CLIB_ALIB_PROTOS_H */ - -/****************************************************************************/ - -#if defined(__amigaos4__) -#define ap_Buf ap_Buffer -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -static size_t quote_vector_size; -static UBYTE * quote_vector; - -/****************************************************************************/ - -int -__wildcard_quote_parameter(unsigned int parameter) -{ - size_t num_bytes; - int result = ERROR; - - /* Can we mark this parameter as quoted or do we need more - room in the buffer? */ - num_bytes = (parameter + 7) / 8; - if(num_bytes >= quote_vector_size) - { - size_t new_quote_vector_size = quote_vector_size + 8; - UBYTE * new_quote_vector; - - /* Allocate a larger buffer. */ - new_quote_vector = realloc(quote_vector,new_quote_vector_size); - if(new_quote_vector == NULL) - goto out; - - /* Set the bits in the new buffer portion to 0. */ - memset(&new_quote_vector[quote_vector_size],0,new_quote_vector_size - quote_vector_size); - - quote_vector_size = new_quote_vector_size; - quote_vector = new_quote_vector; - } - - assert( quote_vector != NULL ); - assert( num_bytes < quote_vector_size ); - - quote_vector[parameter / 8] |= 1 << (7 - (parameter % 8)); - - result = OK; - - out: - - return(result); -} - -/****************************************************************************/ - -static struct AnchorPath * anchor; - -/****************************************************************************/ - -CLIB_DESTRUCTOR(__wildcard_expand_exit) -{ - ENTER(); - - if(anchor != NULL) - { - MatchEnd(anchor); - - #if defined(__amigaos4__) - { - FreeDosObject(DOS_ANCHORPATH,anchor); - } - #endif /* __amigaos4__ */ - - anchor = NULL; - } - - LEAVE(); -} - -/****************************************************************************/ - -struct name_node -{ - struct MinNode nn_min_node; - char * nn_name; - BOOL nn_wild; -}; - -/****************************************************************************/ - -STATIC int -compare(const char **a,const char **b) -{ - return(strcmp((*a),(*b))); -} - -/****************************************************************************/ - -int -__wildcard_expand_init(void) -{ - APTR old_window_pointer; - struct AnchorPath * ap = NULL; - struct MinList argument_list; - size_t argument_list_size; - BOOL found_pattern = FALSE; - BOOL match_made; - char * replacement_arg = NULL; - struct name_node * node; - int argc; - char ** argv; - int error; - int i; - - PROFILE_OFF(); - - /* Disable dos.library requesters during pattern matching below. We - do this so early in order to make it easier to reset the window - pointer in the cleanup code. */ - old_window_pointer = __set_process_window((APTR)-1); - - /* No work to be done? */ - if(__argc == 0 || __argv == NULL) - { - error = OK; - goto out; - } - - argc = __argc; - argv = __argv; - - #if defined(__amigaos4__) - { - ap = AllocDosObjectTags(DOS_ANCHORPATH, - ADO_Strlen, 2 * MAXPATHLEN, - ADO_Mask, (__check_abort_enabled) ? SIGBREAKF_CTRL_C : 0, - TAG_END); - - if(ap == NULL) - { - error = ENOMEM; - goto out; - } - } - #else - { - /* We need some extra room in this data structure as the buffer - will be used to check if a string contains a pattern. */ - ap = malloc(sizeof(*ap) + 2 * MAXPATHLEN); - if(ap == NULL) - { - error = ENOMEM; - goto out; - } - - /* This has to be long-word aligned. */ - assert( (((ULONG)ap) & 3) == 0 ); - - memset(ap,0,sizeof(*ap)); - - ap->ap_Strlen = MAXPATHLEN; - - if(__check_abort_enabled) - ap->ap_BreakBits = SIGBREAKF_CTRL_C; - } - #endif /* __amigaos4__ */ - - /* This may have to be cleaned up later. */ - anchor = ap; - - /* The argument list will go in here. */ - NewList((struct List *)&argument_list); - argument_list_size = 0; - - for(i = 0 ; i < argc ; i++) - { - match_made = FALSE; - - /* Check if the string is quoted. Quoted strings are never expanded. */ - if(i > 0 && (quote_vector == NULL || (quote_vector[i / 8] & (1 << (7 - (i % 8)))) == 0)) - { - size_t arg_len,star_count,j; - char last_c; - char * arg; - - arg = argv[i]; - - /* Check if there are any asterisks in the argument string. - These will be replaced by "#?", if possible. If a backtick - precedes the '*' then it is assumed to be an escaped - wildcard pattern character which has to be used "as is". */ - arg_len = strlen(arg); - - star_count = 0; - last_c = '\0'; - - for(j = 0 ; j < arg_len ; j++) - { - if(arg[j] == '*' && last_c != '`') - star_count++; - - last_c = arg[j]; - } - - /* Should we try to create a replacement string? */ - if(star_count > 0) - { - size_t k; - - if(replacement_arg != NULL) - free(replacement_arg); - - replacement_arg = malloc(arg_len + star_count + 1); - if(replacement_arg == NULL) - { - error = ENOMEM; - goto out; - } - - last_c = '\0'; - - /* Replace each "*" with "#?". */ - for(j = k = 0 ; j < arg_len ; j++) - { - if(arg[j] == '*' && last_c != '`') - { - replacement_arg[k++] = '#'; - replacement_arg[k++] = '?'; - } - else - { - replacement_arg[k++] = arg[j]; - } - - last_c = arg[j]; - } - - replacement_arg[k] = '\0'; - - arg = replacement_arg; - } - - /* Does this string contain a wildcard pattern? */ - if(ParsePatternNoCase(arg,ap->ap_Buf,2 * MAXPATHLEN) > 0) - { - BOOL is_first = TRUE; - LONG rc; - - rc = MatchFirst(arg,ap); - - while(TRUE) - { - /* Got a break signal? */ - if(rc == ERROR_BREAK) - { - __set_process_window(old_window_pointer); - - SetSignal(SIGBREAKF_CTRL_C,SIGBREAKF_CTRL_C); - __check_abort(); - - old_window_pointer = __set_process_window((APTR)-1); - - /* If we ever arrive here, retry the previous match. */ - if(is_first) - { - MatchEnd(ap); - - rc = MatchFirst(arg,ap); - } - else - { - rc = MatchNext(ap); - } - - continue; - } - else if (rc == ERROR_NO_MORE_ENTRIES) - { - /* End of the line. */ - break; - } - else if (rc != OK) - { - /* Some error occured. */ - error = EIO; - break; - } - - /* Allocate another node for the expanded parameter. */ - node = malloc(sizeof(*node) + strlen(ap->ap_Buf) + 1); - if(node == NULL) - { - error = ENOMEM; - goto out; - } - - /* Remember that this name ended up here due to pattern matching. */ - node->nn_name = (char *)(node + 1); - node->nn_wild = TRUE; - - strcpy(node->nn_name,ap->ap_Buf); - - AddTail((struct List *)&argument_list,(struct Node *)node); - argument_list_size++; - - rc = MatchNext(ap); - - is_first = FALSE; - - /* Remember that we found a wildcard pattern among the arguments. */ - match_made = found_pattern = TRUE; - } - - MatchEnd(ap); - } - } - - if(NOT match_made) - { - /* Just remember this argument as is. */ - node = malloc(sizeof(*node)); - if(node == NULL) - { - error = ENOMEM; - goto out; - } - - node->nn_name = argv[i]; - node->nn_wild = FALSE; - - AddTail((struct List *)&argument_list,(struct Node *)node); - argument_list_size++; - } - } - - /* If there were wildcard patterns among the command line parameters, - * work them into the argument vector. - */ - if(found_pattern) - { - size_t last_wild,position; - char ** table; - - /* This will hold the new arguments. */ - table = malloc(sizeof(*table) * (argument_list_size + 1)); - if(table == NULL) - { - error = ENOMEM; - goto out; - } - - __argc = argument_list_size; - __argv = table; - - /* Fill in the table, sorting the wildcard matches. */ - last_wild = 0; - - for(node = (struct name_node *)argument_list.mlh_Head, position = 0 ; - node->nn_min_node.mln_Succ != NULL ; - node = (struct name_node *)node->nn_min_node.mln_Succ, position++) - { - if(node->nn_wild) - { - /* Remember where we found the last parameter that was - added due to pattern matching. */ - if(last_wild == 0) - last_wild = position; - } - else - { - /* This is not a parameter which was added due to pattern - matching. But if we added one before, we will want to - sort all these parameters alphabetically. */ - if(last_wild != 0) - { - size_t num_elements; - - assert( position > last_wild ); - assert( last_wild < argument_list_size ); - - /* How many parameters would have to be sorted? */ - num_elements = position - last_wild; - if(num_elements > 1) - qsort(&table[last_wild],num_elements,sizeof(*table),(int (*)(const void *,const void *))compare); - - last_wild = 0; - } - } - - assert( position < argument_list_size ); - - table[position] = node->nn_name; - } - - /* If necessary, take care of the last entries in the list. */ - if(last_wild != 0) - { - size_t num_elements; - - assert( position > last_wild ); - assert( last_wild < argument_list_size ); - - /* How many parameters would have to be sorted? */ - num_elements = position - last_wild; - if(num_elements > 1) - qsort(&table[last_wild],num_elements,sizeof(*table),(int (*)(const void *,const void *))compare); - } - - assert( position == argument_list_size ); - - /* This terminates the table. */ - table[position] = NULL; - } - else - { - /* Throw the contents of the list away. There is nothing worth keeping. */ - while((node = (struct name_node *)RemHead((struct List *)&argument_list)) != NULL) - free(node); - } - - error = OK; - - out: - - __set_process_window(old_window_pointer); - - if(ap != NULL) - { - MatchEnd(ap); - - #if defined(__amigaos4__) - { - FreeDosObject(DOS_ANCHORPATH,anchor); - } - #else - { - free(ap); - } - #endif /* __amigaos4__ */ - } - - anchor = NULL; - - if(error != OK) - { - __set_errno(error); - - perror(__argv[0]); - abort(); - } - - if(replacement_arg != NULL) - free(replacement_arg); - - if(quote_vector != NULL) - { - free(quote_vector); - quote_vector = NULL; - } - - quote_vector_size = 0; - - PROFILE_ON(); - - return(error); -} diff --git a/library/unix.lib_rev.c b/library/unix.lib_rev.c deleted file mode 100644 index 4544a38..0000000 --- a/library/unix.lib_rev.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * $Id: unix.lib_rev.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 "unix.lib_rev.h" - -/****************************************************************************/ - -char __unix_lib_version[] = VERSTAG; diff --git a/library/unix.lib_rev.h b/library/unix.lib_rev.h deleted file mode 100644 index 6076c81..0000000 --- a/library/unix.lib_rev.h +++ /dev/null @@ -1,6 +0,0 @@ -#define VERSION 1 -#define REVISION 193 -#define DATE "4.6.2005" -#define VERS "unix.lib 1.193" -#define VSTRING "unix.lib 1.193 (4.6.2005)\r\n" -#define VERSTAG "\0$VER: unix.lib 1.193 (4.6.2005)" diff --git a/library/unix.lib_rev.rev b/library/unix.lib_rev.rev deleted file mode 100644 index 2455a46..0000000 --- a/library/unix.lib_rev.rev +++ /dev/null @@ -1 +0,0 @@ -193 diff --git a/library/usergroup_crypt.c b/library/usergroup_crypt.c deleted file mode 100644 index 52b0d73..0000000 --- a/library/usergroup_crypt.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * $Id: usergroup_crypt.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -#ifdef crypt -#undef crypt -#endif /* crypt */ - -/****************************************************************************/ - -char * -crypt(const char *key,const char *salt) -{ - char *result = NULL; - - ENTER(); - - SHOWSTRING(key); - SHOWSTRING(salt); - - assert(key != NULL && salt != NULL); - assert(__UserGroupBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(key == NULL || salt == NULL) - { - SHOWMSG("invalid parameters"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - result = __crypt((STRPTR)key,(STRPTR)salt); - PROFILE_ON(); - - SHOWSTRING(result); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_data.c b/library/usergroup_data.c deleted file mode 100644 index 000b28f..0000000 --- a/library/usergroup_data.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id: usergroup_data.c,v 1.4 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -int NOCOMMON __root_uid; -int NOCOMMON __root_gid; -int NOCOMMON __root_euid; -int NOCOMMON __root_egid; - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_endgrent.c b/library/usergroup_endgrent.c deleted file mode 100644 index d4d8bbc..0000000 --- a/library/usergroup_endgrent.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * $Id: usergroup_endgrent.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -#ifdef endgrent -#undef endgrent -#endif /* endgrent */ - -/****************************************************************************/ - -void -endgrent(void) -{ - ENTER(); - - assert(__UserGroupBase != NULL); - - PROFILE_OFF(); - __endgrent(); - PROFILE_ON(); - - if(__check_abort_enabled) - __check_abort(); - - LEAVE(); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_endpwent.c b/library/usergroup_endpwent.c deleted file mode 100644 index 0dc108b..0000000 --- a/library/usergroup_endpwent.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * $Id: usergroup_endpwent.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -#ifdef endpwent -#undef endpwent -#endif /* endpwent */ - -/****************************************************************************/ - -void -endpwent(void) -{ - ENTER(); - - assert(__UserGroupBase != NULL); - - PROFILE_OFF(); - __endpwent(); - PROFILE_ON(); - - if(__check_abort_enabled) - __check_abort(); - - LEAVE(); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_getegid.c b/library/usergroup_getegid.c deleted file mode 100644 index 47cb516..0000000 --- a/library/usergroup_getegid.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * $Id: usergroup_getegid.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -#ifdef getegid -#undef getegid -#endif /* getegid */ - -/****************************************************************************/ - -gid_t -getegid(void) -{ - gid_t result; - - ENTER(); - - assert(__UserGroupBase != NULL); - - if(__root_mode) - { - result = __root_egid; - } - else - { - PROFILE_OFF(); - result = __getegid(); - PROFILE_ON(); - } - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_geteuid.c b/library/usergroup_geteuid.c deleted file mode 100644 index 33282fb..0000000 --- a/library/usergroup_geteuid.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * $Id: usergroup_geteuid.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -#ifdef geteuid -#undef geteuid -#endif /* geteuid */ - -/****************************************************************************/ - -uid_t -geteuid(void) -{ - uid_t result; - - ENTER(); - - assert(__UserGroupBase != NULL); - - if(__root_mode) - { - result = __root_euid; - } - else - { - PROFILE_OFF(); - result = __geteuid(); - PROFILE_ON(); - } - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_getgid.c b/library/usergroup_getgid.c deleted file mode 100644 index 7465959..0000000 --- a/library/usergroup_getgid.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * $Id: usergroup_getgid.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -#ifdef getgid -#undef getgid -#endif /* getgid */ - -/****************************************************************************/ - -gid_t -getgid(void) -{ - gid_t result; - - ENTER(); - - assert(__UserGroupBase != NULL); - - if(__root_mode) - { - result = __root_gid; - } - else - { - PROFILE_OFF(); - result = __getgid(); - PROFILE_ON(); - } - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_getgrent.c b/library/usergroup_getgrent.c deleted file mode 100644 index 4bab7ab..0000000 --- a/library/usergroup_getgrent.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: usergroup_getgrent.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -#ifdef getgrent -#undef getgrent -#endif /* getgrent */ - -/****************************************************************************/ - -struct group * -getgrent(void) -{ - struct group * result; - - ENTER(); - - assert(__UserGroupBase != NULL); - - PROFILE_OFF(); - result = __getgrent(); - PROFILE_ON(); - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_getgrgid.c b/library/usergroup_getgrgid.c deleted file mode 100644 index 1689e29..0000000 --- a/library/usergroup_getgrgid.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id: usergroup_getgrgid.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -struct group * -getgrgid(gid_t gid) -{ - struct group *result; - - ENTER(); - - assert(__UserGroupBase != NULL); - - PROFILE_OFF(); - result = __getgrgid((LONG)gid); - PROFILE_ON(); - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_getgrnam.c b/library/usergroup_getgrnam.c deleted file mode 100644 index 07e5289..0000000 --- a/library/usergroup_getgrnam.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * $Id: usergroup_getgrnam.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -struct group * -getgrnam(const char * name) -{ - struct group *result = NULL; - - ENTER(); - - SHOWSTRING(name); - - assert(name != NULL); - assert(__UserGroupBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name == NULL) - { - SHOWMSG("invalid name parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - result = __getgrnam((STRPTR)name); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_getgroups.c b/library/usergroup_getgroups.c deleted file mode 100644 index 0ce11c1..0000000 --- a/library/usergroup_getgroups.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * $Id: usergroup_getgroups.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -int -getgroups(int ngroups, gid_t *groups) -{ - int result = ERROR; - - ENTER(); - - SHOWVALUE(ngroups); - SHOWPOINTER(groups); - - assert(ngroups == 0 || groups != NULL); - assert(__UserGroupBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(ngroups != 0 && groups == NULL) - { - SHOWMSG("invalid groups parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(ngroups > 0) - { - PROFILE_OFF(); - result = __getgroups(ngroups,(LONG *)groups); - PROFILE_ON(); - } - else - { - result = OK; - } - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_getpass.c b/library/usergroup_getpass.c deleted file mode 100644 index 00fbcb8..0000000 --- a/library/usergroup_getpass.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * $Id: usergroup_getpass.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -char * -getpass(const char *prompt) -{ - char *result = NULL; - - ENTER(); - - SHOWSTRING(prompt); - - assert( prompt != NULL ); - assert(__UserGroupBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(prompt == NULL) - { - SHOWMSG("invalid prompt"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - result = __getpass((STRPTR)prompt); - PROFILE_ON(); - - SHOWSTRING(result); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_getpwent.c b/library/usergroup_getpwent.c deleted file mode 100644 index 9dfdacc..0000000 --- a/library/usergroup_getpwent.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id: usergroup_getpwent.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -struct passwd * -getpwent(void) -{ - struct passwd * result; - - ENTER(); - - assert(__UserGroupBase != NULL); - - PROFILE_OFF(); - result = __getpwent(); - PROFILE_ON(); - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_getpwnam.c b/library/usergroup_getpwnam.c deleted file mode 100644 index c2e5dde..0000000 --- a/library/usergroup_getpwnam.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * $Id: usergroup_getpwnam.c,v 1.3 2005-02-03 16:56:17 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -struct passwd * -getpwnam(const char *name) -{ - struct passwd *result = NULL; - - ENTER(); - - SHOWSTRING(name); - - assert(name != NULL); - assert(__UserGroupBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name == NULL) - { - SHOWMSG("invalid name"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - result = __getpwnam((STRPTR)name); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_getpwuid.c b/library/usergroup_getpwuid.c deleted file mode 100644 index 35e2a5b..0000000 --- a/library/usergroup_getpwuid.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * $Id: usergroup_getpwuid.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -struct passwd * -getpwuid(uid_t uid) -{ - struct passwd *result; - - ENTER(); - - assert(__UserGroupBase != NULL); - - SHOWVALUE(uid); - - PROFILE_OFF(); - result = __getpwuid((LONG)uid); - PROFILE_ON(); - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_getuid.c b/library/usergroup_getuid.c deleted file mode 100644 index 5468611..0000000 --- a/library/usergroup_getuid.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * $Id: usergroup_getuid.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -uid_t -getuid(void) -{ - uid_t result; - - ENTER(); - - assert(__UserGroupBase != NULL); - - if(__root_mode) - { - result = __root_uid; - } - else - { - PROFILE_OFF(); - result = __getuid(); - PROFILE_ON(); - } - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_headers.h b/library/usergroup_headers.h deleted file mode 100644 index 68afbfa..0000000 --- a/library/usergroup_headers.h +++ /dev/null @@ -1,794 +0,0 @@ -/* - * $Id: usergroup_headers.h,v 1.6 2005-03-18 12:38:25 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _USERGROUP_HEADERS_H -#define _USERGROUP_HEADERS_H - -/****************************************************************************/ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_H */ - -/****************************************************************************/ - -extern struct Library * NOCOMMON __UserGroupBase; - -/****************************************************************************/ - -#if defined(__amigaos4__) - -extern struct UserGroupIFace * NOCOMMON __IUserGroup; - -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -extern BOOL NOCOMMON __root_mode; - -/****************************************************************************/ - -extern int NOCOMMON __root_uid; -extern int NOCOMMON __root_gid; -extern int NOCOMMON __root_euid; -extern int NOCOMMON __root_egid; - -/****************************************************************************/ - -#if defined(__GNUC__) - -#if defined(__amigaos4__) - -#include - -#define __ug_SetupContextTagList(name, tags) __IUserGroup->ug_SetupContextTagList(name, tags) -#define __ug_GetErr() __IUserGroup->ug_GetErr() -#define __ug_StrError(err) __IUserGroup->ug_StrError(err) -#define __getuid() __IUserGroup->getuid() -#define __geteuid() __IUserGroup->geteuid() -#define __setreuid(real, effective) __IUserGroup->setreuid(real, effective) -#define __setuid(uid) __IUserGroup->setuid(uid) -#define __getgid() __IUserGroup->getgid() -#define __getegid() __IUserGroup->getegid() -#define __setregid(real, effective) __IUserGroup->setregid(real, effective) -#define __setgid(gid) __IUserGroup->setgid(gid) -#define __getgroups(gidsetlen, gidset) __IUserGroup->getgroups(gidsetlen, gidset) -#define __setgroups(gidsetlen, gidset) __IUserGroup->setgroups(gidsetlen, gidset) -#define __initgroups(name, basegid) __IUserGroup->initgroups(name, basegid) -#define __getpwnam(login) __IUserGroup->getpwnam(login) -#define __getpwuid(uid) __IUserGroup->getpwuid(uid) -#define __setpwent() __IUserGroup->setpwent() -#define __getpwent() __IUserGroup->getpwent() -#define __endpwent() __IUserGroup->endpwent() -#define __getgrnam(name) __IUserGroup->getgrnam(name) -#define __getgrgid(gid) __IUserGroup->getgrgid(gid) -#define __setgrent() __IUserGroup->setgrent() -#define __getgrent() __IUserGroup->getgrent() -#define __endgrent() __IUserGroup->endgrent() -#define __crypt(key, set) __IUserGroup->crypt(key, set) -#define __ug_GetSalt(user, buf, size) __IUserGroup->ug_GetSalt(user, buf, size) -#define __getpass(prompt) __IUserGroup->getpass(prompt) -#define __umask(mask) __IUserGroup->umask(mask) -#define __getumask() __IUserGroup->getumask() -#define __setsid() __IUserGroup->setsid() -#define __getpgrp() __IUserGroup->getpgrp() -#define __getlogin() __IUserGroup->getlogin() -#define __setlogin(name) __IUserGroup->setlogin(name) -#define __setutent() __IUserGroup->setutent() -#define __getutent() __IUserGroup->getutent() -#define __endutent() __IUserGroup->endutent() -#define __getlastlog(uid) __IUserGroup->getlastlog(uid) -#define __setlastlog(uid, name, host) __IUserGroup->setlastlog(uid, name, host) -#define __getcredentials(task) __IUserGroup->getcredentials(task) - -#else - -#define __ug_SetupContextTagList(name, tags) ({ \ - UBYTE * _ug_SetupContextTagList_name = (name); \ - struct TagItem * _ug_SetupContextTagList_tags = (tags); \ - LONG _ug_SetupContextTagList__re = \ - ({ \ - register struct Library * const __ug_SetupContextTagList__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __ug_SetupContextTagList__re __asm("d0"); \ - register UBYTE * __ug_SetupContextTagList_name __asm("a0") = (_ug_SetupContextTagList_name); \ - register struct TagItem * __ug_SetupContextTagList_tags __asm("a1") = (_ug_SetupContextTagList_tags); \ - __asm volatile ("jsr a6@(-30:W)" \ - : "=r"(__ug_SetupContextTagList__re) \ - : "r"(__ug_SetupContextTagList__bn), "r"(__ug_SetupContextTagList_name), "r"(__ug_SetupContextTagList_tags) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __ug_SetupContextTagList__re; \ - }); \ - _ug_SetupContextTagList__re; \ -}) - -#define __ug_GetErr() ({ \ - LONG _ug_GetErr__re = \ - ({ \ - register struct Library * const __ug_GetErr__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __ug_GetErr__re __asm("d0"); \ - __asm volatile ("jsr a6@(-36:W)" \ - : "=r"(__ug_GetErr__re) \ - : "r"(__ug_GetErr__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __ug_GetErr__re; \ - }); \ - _ug_GetErr__re; \ -}) - -#define __ug_StrError(err) ({ \ - LONG _ug_StrError_err = (err); \ - UBYTE * _ug_StrError__re = \ - ({ \ - register struct Library * const __ug_StrError__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register UBYTE * __ug_StrError__re __asm("d0"); \ - register LONG __ug_StrError_err __asm("d1") = (_ug_StrError_err); \ - __asm volatile ("jsr a6@(-42:W)" \ - : "=r"(__ug_StrError__re) \ - : "r"(__ug_StrError__bn), "r"(__ug_StrError_err) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __ug_StrError__re; \ - }); \ - _ug_StrError__re; \ -}) - -#define __getuid() ({ \ - LONG _getuid__re = \ - ({ \ - register struct Library * const __getuid__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __getuid__re __asm("d0"); \ - __asm volatile ("jsr a6@(-48:W)" \ - : "=r"(__getuid__re) \ - : "r"(__getuid__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getuid__re; \ - }); \ - _getuid__re; \ -}) - -#define __geteuid() ({ \ - LONG _geteuid__re = \ - ({ \ - register struct Library * const __geteuid__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __geteuid__re __asm("d0"); \ - __asm volatile ("jsr a6@(-54:W)" \ - : "=r"(__geteuid__re) \ - : "r"(__geteuid__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __geteuid__re; \ - }); \ - _geteuid__re; \ -}) - -#define __setreuid(real, effective) ({ \ - LONG _setreuid_real = (real); \ - LONG _setreuid_effective = (effective); \ - LONG _setreuid__re = \ - ({ \ - register struct Library * const __setreuid__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __setreuid__re __asm("d0"); \ - register LONG __setreuid_real __asm("d0") = (_setreuid_real); \ - register LONG __setreuid_effective __asm("d1") = (_setreuid_effective); \ - __asm volatile ("jsr a6@(-60:W)" \ - : "=r"(__setreuid__re) \ - : "r"(__setreuid__bn), "r"(__setreuid_real), "r"(__setreuid_effective) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __setreuid__re; \ - }); \ - _setreuid__re; \ -}) - -#define __setuid(uid) ({ \ - LONG _setuid_uid = (uid); \ - LONG _setuid__re = \ - ({ \ - register struct Library * const __setuid__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __setuid__re __asm("d0"); \ - register LONG __setuid_uid __asm("d0") = (_setuid_uid); \ - __asm volatile ("jsr a6@(-66:W)" \ - : "=r"(__setuid__re) \ - : "r"(__setuid__bn), "r"(__setuid_uid) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __setuid__re; \ - }); \ - _setuid__re; \ -}) - -#define __getgid() ({ \ - LONG _getgid__re = \ - ({ \ - register struct Library * const __getgid__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __getgid__re __asm("d0"); \ - __asm volatile ("jsr a6@(-72:W)" \ - : "=r"(__getgid__re) \ - : "r"(__getgid__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getgid__re; \ - }); \ - _getgid__re; \ -}) - -#define __getegid() ({ \ - LONG _getegid__re = \ - ({ \ - register struct Library * const __getegid__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __getegid__re __asm("d0"); \ - __asm volatile ("jsr a6@(-78:W)" \ - : "=r"(__getegid__re) \ - : "r"(__getegid__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getegid__re; \ - }); \ - _getegid__re; \ -}) - -#define __setregid(real, effective) ({ \ - LONG _setregid_real = (real); \ - LONG _setregid_effective = (effective); \ - LONG _setregid__re = \ - ({ \ - register struct Library * const __setregid__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __setregid__re __asm("d0"); \ - register LONG __setregid_real __asm("d0") = (_setregid_real); \ - register LONG __setregid_effective __asm("d1") = (_setregid_effective); \ - __asm volatile ("jsr a6@(-84:W)" \ - : "=r"(__setregid__re) \ - : "r"(__setregid__bn), "r"(__setregid_real), "r"(__setregid_effective) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __setregid__re; \ - }); \ - _setregid__re; \ -}) - -#define __setgid(gid) ({ \ - LONG _setgid_gid = (gid); \ - LONG _setgid__re = \ - ({ \ - register struct Library * const __setgid__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __setgid__re __asm("d0"); \ - register LONG __setgid_gid __asm("d0") = (_setgid_gid); \ - __asm volatile ("jsr a6@(-90:W)" \ - : "=r"(__setgid__re) \ - : "r"(__setgid__bn), "r"(__setgid_gid) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __setgid__re; \ - }); \ - _setgid__re; \ -}) - -#define __getgroups(gidsetlen, gidset) ({ \ - LONG _getgroups_gidsetlen = (gidsetlen); \ - LONG * _getgroups_gidset = (gidset); \ - LONG _getgroups__re = \ - ({ \ - register struct Library * const __getgroups__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __getgroups__re __asm("d0"); \ - register LONG __getgroups_gidsetlen __asm("d0") = (_getgroups_gidsetlen); \ - register LONG * __getgroups_gidset __asm("a1") = (_getgroups_gidset); \ - __asm volatile ("jsr a6@(-96:W)" \ - : "=r"(__getgroups__re) \ - : "r"(__getgroups__bn), "r"(__getgroups_gidsetlen), "r"(__getgroups_gidset) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getgroups__re; \ - }); \ - _getgroups__re; \ -}) - -#define __setgroups(gidsetlen, gidset) ({ \ - LONG _setgroups_gidsetlen = (gidsetlen); \ - LONG * _setgroups_gidset = (gidset); \ - LONG _setgroups__re = \ - ({ \ - register struct Library * const __setgroups__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __setgroups__re __asm("d0"); \ - register LONG __setgroups_gidsetlen __asm("d0") = (_setgroups_gidsetlen); \ - register LONG * __setgroups_gidset __asm("a1") = (_setgroups_gidset); \ - __asm volatile ("jsr a6@(-102:W)" \ - : "=r"(__setgroups__re) \ - : "r"(__setgroups__bn), "r"(__setgroups_gidsetlen), "r"(__setgroups_gidset) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __setgroups__re; \ - }); \ - _setgroups__re; \ -}) - -#define __initgroups(name, basegid) ({ \ - UBYTE * _initgroups_name = (name); \ - LONG _initgroups_basegid = (basegid); \ - LONG _initgroups__re = \ - ({ \ - register struct Library * const __initgroups__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __initgroups__re __asm("d0"); \ - register UBYTE * __initgroups_name __asm("a1") = (_initgroups_name); \ - register LONG __initgroups_basegid __asm("d0") = (_initgroups_basegid); \ - __asm volatile ("jsr a6@(-108:W)" \ - : "=r"(__initgroups__re) \ - : "r"(__initgroups__bn), "r"(__initgroups_name), "r"(__initgroups_basegid) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __initgroups__re; \ - }); \ - _initgroups__re; \ -}) - -#define __getpwnam(login) ({ \ - UBYTE * _getpwnam_login = (login); \ - struct passwd * _getpwnam__re = \ - ({ \ - register struct Library * const __getpwnam__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register struct passwd * __getpwnam__re __asm("d0"); \ - register UBYTE * __getpwnam_login __asm("a1") = (_getpwnam_login); \ - __asm volatile ("jsr a6@(-114:W)" \ - : "=r"(__getpwnam__re) \ - : "r"(__getpwnam__bn), "r"(__getpwnam_login) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getpwnam__re; \ - }); \ - _getpwnam__re; \ -}) - -#define __getpwuid(uid) ({ \ - LONG _getpwuid_uid = (uid); \ - struct passwd * _getpwuid__re = \ - ({ \ - register struct Library * const __getpwuid__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register struct passwd * __getpwuid__re __asm("d0"); \ - register LONG __getpwuid_uid __asm("d0") = (_getpwuid_uid); \ - __asm volatile ("jsr a6@(-120:W)" \ - : "=r"(__getpwuid__re) \ - : "r"(__getpwuid__bn), "r"(__getpwuid_uid) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getpwuid__re; \ - }); \ - _getpwuid__re; \ -}) - -#define __setpwent() ({ \ - register struct Library * const __setpwent__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - __asm volatile ("jsr a6@(-126:W)" \ - : \ - : "r"(__setpwent__bn) \ - : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ -}) - -#define __getpwent() ({ \ - struct passwd * _getpwent__re = \ - ({ \ - register struct Library * const __getpwent__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register struct passwd * __getpwent__re __asm("d0"); \ - __asm volatile ("jsr a6@(-132:W)" \ - : "=r"(__getpwent__re) \ - : "r"(__getpwent__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getpwent__re; \ - }); \ - _getpwent__re; \ -}) - -#define __endpwent() ({ \ - register struct Library * const __endpwent__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - __asm volatile ("jsr a6@(-138:W)" \ - : \ - : "r"(__endpwent__bn) \ - : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ -}) - -#define __getgrnam(name) ({ \ - UBYTE * _getgrnam_name = (name); \ - struct group * _getgrnam__re = \ - ({ \ - register struct Library * const __getgrnam__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register struct group * __getgrnam__re __asm("d0"); \ - register UBYTE * __getgrnam_name __asm("a1") = (_getgrnam_name); \ - __asm volatile ("jsr a6@(-144:W)" \ - : "=r"(__getgrnam__re) \ - : "r"(__getgrnam__bn), "r"(__getgrnam_name) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getgrnam__re; \ - }); \ - _getgrnam__re; \ -}) - -#define __getgrgid(gid) ({ \ - LONG _getgrgid_gid = (gid); \ - struct group * _getgrgid__re = \ - ({ \ - register struct Library * const __getgrgid__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register struct group * __getgrgid__re __asm("d0"); \ - register LONG __getgrgid_gid __asm("d0") = (_getgrgid_gid); \ - __asm volatile ("jsr a6@(-150:W)" \ - : "=r"(__getgrgid__re) \ - : "r"(__getgrgid__bn), "r"(__getgrgid_gid) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getgrgid__re; \ - }); \ - _getgrgid__re; \ -}) - -#define __setgrent() ({ \ - register struct Library * const __setgrent__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - __asm volatile ("jsr a6@(-156:W)" \ - : \ - : "r"(__setgrent__bn) \ - : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ -}) - -#define __getgrent() ({ \ - struct group * _getgrent__re = \ - ({ \ - register struct Library * const __getgrent__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register struct group * __getgrent__re __asm("d0"); \ - __asm volatile ("jsr a6@(-162:W)" \ - : "=r"(__getgrent__re) \ - : "r"(__getgrent__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getgrent__re; \ - }); \ - _getgrent__re; \ -}) - -#define __endgrent() ({ \ - register struct Library * const __endgrent__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - __asm volatile ("jsr a6@(-168:W)" \ - : \ - : "r"(__endgrent__bn) \ - : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ -}) - -#define __crypt(key, set) ({ \ - UBYTE * _crypt_key = (key); \ - UBYTE * _crypt_set = (set); \ - UBYTE * _crypt__re = \ - ({ \ - register struct Library * const __crypt__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register UBYTE * __crypt__re __asm("d0"); \ - register UBYTE * __crypt_key __asm("a0") = (_crypt_key); \ - register UBYTE * __crypt_set __asm("a1") = (_crypt_set); \ - __asm volatile ("jsr a6@(-174:W)" \ - : "=r"(__crypt__re) \ - : "r"(__crypt__bn), "r"(__crypt_key), "r"(__crypt_set) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __crypt__re; \ - }); \ - _crypt__re; \ -}) - -#define __ug_GetSalt(user, buf, size) ({ \ - struct passwd * _ug_GetSalt_user = (user); \ - UBYTE * _ug_GetSalt_buf = (buf); \ - ULONG _ug_GetSalt_size = (size); \ - UBYTE * _ug_GetSalt__re = \ - ({ \ - register struct Library * const __ug_GetSalt__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register UBYTE * __ug_GetSalt__re __asm("d0"); \ - register struct passwd * __ug_GetSalt_user __asm("a0") = (_ug_GetSalt_user); \ - register UBYTE * __ug_GetSalt_buf __asm("a1") = (_ug_GetSalt_buf); \ - register ULONG __ug_GetSalt_size __asm("d0") = (_ug_GetSalt_size); \ - __asm volatile ("jsr a6@(-180:W)" \ - : "=r"(__ug_GetSalt__re) \ - : "r"(__ug_GetSalt__bn), "r"(__ug_GetSalt_user), "r"(__ug_GetSalt_buf), "r"(__ug_GetSalt_size) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __ug_GetSalt__re; \ - }); \ - _ug_GetSalt__re; \ -}) - -#define __getpass(prompt) ({ \ - UBYTE * _getpass_prompt = (prompt); \ - UBYTE * _getpass__re = \ - ({ \ - register struct Library * const __getpass__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register UBYTE * __getpass__re __asm("d0"); \ - register UBYTE * __getpass_prompt __asm("a1") = (_getpass_prompt); \ - __asm volatile ("jsr a6@(-186:W)" \ - : "=r"(__getpass__re) \ - : "r"(__getpass__bn), "r"(__getpass_prompt) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getpass__re; \ - }); \ - _getpass__re; \ -}) - -#define __umask(mask) ({ \ - ULONG _umask_mask = (mask); \ - ULONG _umask__re = \ - ({ \ - register struct Library * const __umask__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register ULONG __umask__re __asm("d0"); \ - register ULONG __umask_mask __asm("d0") = (_umask_mask); \ - __asm volatile ("jsr a6@(-192:W)" \ - : "=r"(__umask__re) \ - : "r"(__umask__bn), "r"(__umask_mask) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __umask__re; \ - }); \ - _umask__re; \ -}) - -#define __getumask() ({ \ - UWORD _getumask__re = \ - ({ \ - register struct Library * const __getumask__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register UWORD __getumask__re __asm("d0"); \ - __asm volatile ("jsr a6@(-198:W)" \ - : "=r"(__getumask__re) \ - : "r"(__getumask__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getumask__re; \ - }); \ - _getumask__re; \ -}) - -#define __setsid() ({ \ - LONG _setsid__re = \ - ({ \ - register struct Library * const __setsid__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __setsid__re __asm("d0"); \ - __asm volatile ("jsr a6@(-204:W)" \ - : "=r"(__setsid__re) \ - : "r"(__setsid__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __setsid__re; \ - }); \ - _setsid__re; \ -}) - -#define __getpgrp() ({ \ - LONG _getpgrp__re = \ - ({ \ - register struct Library * const __getpgrp__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __getpgrp__re __asm("d0"); \ - __asm volatile ("jsr a6@(-210:W)" \ - : "=r"(__getpgrp__re) \ - : "r"(__getpgrp__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getpgrp__re; \ - }); \ - _getpgrp__re; \ -}) - -#define __getlogin() ({ \ - UBYTE * _getlogin__re = \ - ({ \ - register struct Library * const __getlogin__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register UBYTE * __getlogin__re __asm("d0"); \ - __asm volatile ("jsr a6@(-216:W)" \ - : "=r"(__getlogin__re) \ - : "r"(__getlogin__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getlogin__re; \ - }); \ - _getlogin__re; \ -}) - -#define __setlogin(name) ({ \ - UBYTE * _setlogin_name = (name); \ - LONG _setlogin__re = \ - ({ \ - register struct Library * const __setlogin__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __setlogin__re __asm("d0"); \ - register UBYTE * __setlogin_name __asm("a1") = (_setlogin_name); \ - __asm volatile ("jsr a6@(-222:W)" \ - : "=r"(__setlogin__re) \ - : "r"(__setlogin__bn), "r"(__setlogin_name) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __setlogin__re; \ - }); \ - _setlogin__re; \ -}) - -#define __setutent() ({ \ - register struct Library * const __setutent__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - __asm volatile ("jsr a6@(-228:W)" \ - : \ - : "r"(__setutent__bn) \ - : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ -}) - -#define __getutent() ({ \ - struct utmp * _getutent__re = \ - ({ \ - register struct Library * const __getutent__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register struct utmp * __getutent__re __asm("d0"); \ - __asm volatile ("jsr a6@(-234:W)" \ - : "=r"(__getutent__re) \ - : "r"(__getutent__bn) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getutent__re; \ - }); \ - _getutent__re; \ -}) - -#define __endutent() ({ \ - register struct Library * const __endutent__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - __asm volatile ("jsr a6@(-240:W)" \ - : \ - : "r"(__endutent__bn) \ - : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ -}) - -#define __getlastlog(uid) ({ \ - LONG _getlastlog_uid = (uid); \ - struct lastlog * _getlastlog__re = \ - ({ \ - register struct Library * const __getlastlog__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register struct lastlog * __getlastlog__re __asm("d0"); \ - register LONG __getlastlog_uid __asm("d0") = (_getlastlog_uid); \ - __asm volatile ("jsr a6@(-246:W)" \ - : "=r"(__getlastlog__re) \ - : "r"(__getlastlog__bn), "r"(__getlastlog_uid) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getlastlog__re; \ - }); \ - _getlastlog__re; \ -}) - -#define __setlastlog(uid, name, host) ({ \ - LONG _setlastlog_uid = (uid); \ - UBYTE * _setlastlog_name = (name); \ - UBYTE * _setlastlog_host = (host); \ - LONG _setlastlog__re = \ - ({ \ - register struct Library * const __setlastlog__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register LONG __setlastlog__re __asm("d0"); \ - register LONG __setlastlog_uid __asm("d0") = (_setlastlog_uid); \ - register UBYTE * __setlastlog_name __asm("a0") = (_setlastlog_name); \ - register UBYTE * __setlastlog_host __asm("a1") = (_setlastlog_host); \ - __asm volatile ("jsr a6@(-252:W)" \ - : "=r"(__setlastlog__re) \ - : "r"(__setlastlog__bn), "r"(__setlastlog_uid), "r"(__setlastlog_name), "r"(__setlastlog_host) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __setlastlog__re; \ - }); \ - _setlastlog__re; \ -}) - -#define __getcredentials(task) ({ \ - struct Task * _getcredentials_task = (task); \ - struct UserGroupCredentials * _getcredentials__re = \ - ({ \ - register struct Library * const __getcredentials__bn __asm("a6") = (struct Library *) (__UserGroupBase);\ - register struct UserGroupCredentials * __getcredentials__re __asm("d0"); \ - register struct Task * __getcredentials_task __asm("a0") = (_getcredentials_task); \ - __asm volatile ("jsr a6@(-258:W)" \ - : "=r"(__getcredentials__re) \ - : "r"(__getcredentials__bn), "r"(__getcredentials_task) \ - : "d1", "a0", "a1", "fp0", "fp1", "cc", "memory"); \ - __getcredentials__re; \ - }); \ - _getcredentials__re; \ -}) - -#endif /* __amigaos4__ */ - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -#if defined(__SASC) - -LONG __ug_SetupContextTagList(UBYTE *name,struct TagItem *tags); -LONG __ug_GetErr(VOID); -UBYTE *__ug_StrError(LONG err); -LONG __getuid(VOID); -LONG __geteuid(VOID); -LONG __setreuid(LONG real,LONG effective); -LONG __setuid(LONG uid); -LONG __getgid(VOID); -LONG __getegid(VOID); -LONG __setregid(LONG real,LONG effective); -LONG __setgid(LONG gid); -LONG __getgroups(LONG gidsetlen,LONG *gidset); -LONG __setgroups(LONG gidsetlen,LONG *gidset); -LONG __initgroups(UBYTE *name,LONG basegid); -struct passwd *__getpwnam(UBYTE *login); -struct passwd *__getpwuid(LONG uid); -VOID __setpwent(VOID); -struct passwd *__getpwent(VOID); -VOID __endpwent(VOID); -struct group *__getgrnam(UBYTE *name); -struct group *__getgrgid(LONG gid); -VOID __setgrent(VOID); -struct group *__getgrent(VOID); -VOID __endgrent(VOID); -UBYTE *__crypt(UBYTE *key,UBYTE *set); -UBYTE *__ug_GetSalt(struct passwd *user,UBYTE *buf,ULONG size); -UBYTE *__getpass(UBYTE *prompt); -UWORD __umask(ULONG mask); -UWORD __getumask(VOID); -LONG __setsid(VOID); -LONG __getpgrp(VOID); -UBYTE *__getlogin(VOID); -LONG __setlogin(UBYTE *name); -VOID __setutent(VOID); -struct utmp *__getutent(VOID); -VOID __endutent(VOID); -struct lastlog *__getlastlog(LONG uid); -LONG __setlastlog(LONG uid,UBYTE *name,UBYTE *host); -struct UserGroupCredentials *__getcredentials(struct Task *task); - -#pragma libcall __UserGroupBase __ug_SetupContextTagList 1e 9802 -#pragma libcall __UserGroupBase __ug_GetErr 24 00 -#pragma libcall __UserGroupBase __ug_StrError 2a 101 -#pragma libcall __UserGroupBase __getuid 30 00 -#pragma libcall __UserGroupBase __geteuid 36 00 -#pragma libcall __UserGroupBase __setreuid 3c 1002 -#pragma libcall __UserGroupBase __setuid 42 001 -#pragma libcall __UserGroupBase __getgid 48 00 -#pragma libcall __UserGroupBase __getegid 4e 00 -#pragma libcall __UserGroupBase __setregid 54 1002 -#pragma libcall __UserGroupBase __setgid 5a 001 -#pragma libcall __UserGroupBase __getgroups 60 9002 -#pragma libcall __UserGroupBase __setgroups 66 9002 -#pragma libcall __UserGroupBase __initgroups 6c 0902 -#pragma libcall __UserGroupBase __getpwnam 72 901 -#pragma libcall __UserGroupBase __getpwuid 78 001 -#pragma libcall __UserGroupBase __setpwent 7e 00 -#pragma libcall __UserGroupBase __getpwent 84 00 -#pragma libcall __UserGroupBase __endpwent 8a 00 -#pragma libcall __UserGroupBase __getgrnam 90 901 -#pragma libcall __UserGroupBase __getgrgid 96 001 -#pragma libcall __UserGroupBase __setgrent 9c 00 -#pragma libcall __UserGroupBase __getgrent a2 00 -#pragma libcall __UserGroupBase __endgrent a8 00 -#pragma libcall __UserGroupBase __crypt ae 9802 -#pragma libcall __UserGroupBase __ug_GetSalt b4 09803 -#pragma libcall __UserGroupBase __getpass ba 901 -#pragma libcall __UserGroupBase __umask c0 001 -#pragma libcall __UserGroupBase __getumask c6 00 -#pragma libcall __UserGroupBase __setsid cc 00 -#pragma libcall __UserGroupBase __getpgrp d2 00 -#pragma libcall __UserGroupBase __getlogin d8 00 -#pragma libcall __UserGroupBase __setlogin de 901 -#pragma libcall __UserGroupBase __setutent e4 00 -#pragma libcall __UserGroupBase __getutent ea 00 -#pragma libcall __UserGroupBase __endutent f0 00 -#pragma libcall __UserGroupBase __getlastlog f6 001 -#pragma libcall __UserGroupBase __setlastlog fc 98003 -#pragma libcall __UserGroupBase __getcredentials 102 801 - -#endif /* __SASC */ - -/****************************************************************************/ - -#endif /* _USERGROUP_HEADERS_H */ diff --git a/library/usergroup_init_exit.c b/library/usergroup_init_exit.c deleted file mode 100644 index bde94c5..0000000 --- a/library/usergroup_init_exit.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * $Id: usergroup_init_exit.c,v 1.11 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_CONSTRUCTOR_H -#include "stdlib_constructor.h" -#endif /* _STDLIB_CONSTRUCTOR_H */ - -/****************************************************************************/ - -/* Pointer to errno, length == sizeof(long) */ -#define UGT_ERRNOLPTR 0x80000004 - -/****************************************************************************/ - -struct Library * NOCOMMON __UserGroupBase; - -/****************************************************************************/ - -#if defined(__amigaos4__) -struct UserGroupIFace * NOCOMMON __IUserGroup; -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -CLIB_DESTRUCTOR(usergroup_exit) -{ - ENTER(); - - #if defined(__amigaos4__) - { - if(__IUserGroup != NULL) - { - DropInterface((struct Interface *)__IUserGroup); - __IUserGroup = NULL; - } - } - #endif /* __amigaos4__ */ - - if(__UserGroupBase != NULL) - { - CloseLibrary(__UserGroupBase); - __UserGroupBase = NULL; - } - - LEAVE(); -} - -/****************************************************************************/ - -CLIB_CONSTRUCTOR(usergroup_init) -{ - struct TagItem tags[2]; - BOOL success = FALSE; - - ENTER(); - - PROFILE_OFF(); - - __UserGroupBase = OpenLibrary("usergroup.library",0); - - #if defined(__amigaos4__) - { - if(__UserGroupBase != NULL) - { - __IUserGroup = (struct UserGroupIFace *)GetInterface(__UserGroupBase, "main", 1, 0); - if (__IUserGroup == NULL) - { - CloseLibrary(__UserGroupBase); - __UserGroupBase = NULL; - } - } - } - #endif /* __amigaos4__ */ - - if(__UserGroupBase == NULL) - { - SHOWMSG("usergroup.library did not open"); - - __show_error("\"usergroup.library\" could not be opened."); - goto out; - } - - /* Wire the library's errno variable to our local errno. */ - tags[0].ti_Tag = UGT_ERRNOLPTR; - tags[0].ti_Data = (ULONG)&errno; - - tags[1].ti_Tag = TAG_END; - - if(__ug_SetupContextTagList(__program_name,tags) != 0) - { - SHOWMSG("could not initialize usergroup.library"); - - __show_error("\"usergroup.library\" could not be initialized."); - goto out; - } - - success = TRUE; - - out: - - PROFILE_ON(); - - SHOWVALUE(success); - LEAVE(); - - if(success) - CONSTRUCTOR_SUCCEED(); - else - CONSTRUCTOR_FAIL(); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_initgroups.c b/library/usergroup_initgroups.c deleted file mode 100644 index fe72eb7..0000000 --- a/library/usergroup_initgroups.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * $Id: usergroup_initgroups.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -int -initgroups(const char *name, gid_t basegroup) -{ - int result = ERROR; - - ENTER(); - - SHOWSTRING(name); - SHOWVALUE(basegroup); - - assert(name != NULL); - assert(__UserGroupBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(name == NULL) - { - SHOWMSG("invalid name"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - PROFILE_OFF(); - result = __initgroups((STRPTR)name,(LONG)basegroup); - PROFILE_ON(); - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_rootmode.c b/library/usergroup_rootmode.c deleted file mode 100644 index f2aa5d4..0000000 --- a/library/usergroup_rootmode.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id: usergroup_rootmode.c,v 1.3 2005-07-03 10:36:47 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -BOOL NOCOMMON __root_mode; - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_setegid.c b/library/usergroup_setegid.c deleted file mode 100644 index de0a663..0000000 --- a/library/usergroup_setegid.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id: usergroup_setegid.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -int -setegid(gid_t g) -{ - int result; - - ENTER(); - - SHOWVALUE(g); - - assert(__UserGroupBase != NULL); - - result = setregid((ULONG)-1,(ULONG)g); - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_seteuid.c b/library/usergroup_seteuid.c deleted file mode 100644 index fd90c0a..0000000 --- a/library/usergroup_seteuid.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id: usergroup_seteuid.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -int -seteuid(uid_t u) -{ - int result; - - ENTER(); - - SHOWVALUE(u); - - assert(__UserGroupBase != NULL); - - result = setreuid((ULONG)-1,(ULONG)u); - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_setgid.c b/library/usergroup_setgid.c deleted file mode 100644 index 70e8c6b..0000000 --- a/library/usergroup_setgid.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $Id: usergroup_setgid.c,v 1.3 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -int -setgid(gid_t id) -{ - int result; - - ENTER(); - - SHOWVALUE(id); - - assert(__UserGroupBase != NULL); - - if(__root_mode) - { - __root_gid = id; - - result = OK; - } - else - { - PROFILE_OFF(); - result = __setgid((LONG)id); - PROFILE_ON(); - } - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_setgrent.c b/library/usergroup_setgrent.c deleted file mode 100644 index 248d005..0000000 --- a/library/usergroup_setgrent.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $Id: usergroup_setgrent.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -void -setgrent(void) -{ - ENTER(); - - assert(__UserGroupBase != NULL); - - PROFILE_OFF(); - __setgrent(); - PROFILE_ON(); - - if(__check_abort_enabled) - __check_abort(); - - LEAVE(); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_setgroups.c b/library/usergroup_setgroups.c deleted file mode 100644 index 8323647..0000000 --- a/library/usergroup_setgroups.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * $Id: usergroup_setgroups.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 */ - -/****************************************************************************/ - -#if defined(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -int -setgroups(int ngroups,const gid_t *groups) -{ - int result = ERROR; - - ENTER(); - - SHOWVALUE(ngroups); - SHOWPOINTER(groups); - - assert(ngroups == 0 || groups != NULL); - assert(__UserGroupBase != NULL); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(ngroups != 0 && groups == NULL) - { - SHOWMSG("invalid groups parameter"); - - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - if(ngroups > 0) - { - PROFILE_OFF(); - result = __setgroups(ngroups,(LONG *)groups); - PROFILE_ON(); - } - else - { - result = OK; - } - - out: - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_setpwent.c b/library/usergroup_setpwent.c deleted file mode 100644 index 7a87759..0000000 --- a/library/usergroup_setpwent.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $Id: usergroup_setpwent.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -void -setpwent(void) -{ - ENTER(); - - assert(__UserGroupBase != NULL); - - PROFILE_OFF(); - __setpwent(); - PROFILE_ON(); - - if(__check_abort_enabled) - __check_abort(); - - LEAVE(); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_setregid.c b/library/usergroup_setregid.c deleted file mode 100644 index 833afdf..0000000 --- a/library/usergroup_setregid.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * $Id: usergroup_setregid.c,v 1.3 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -int -setregid(gid_t real, gid_t eff) -{ - int result; - - ENTER(); - - SHOWVALUE(real); - SHOWVALUE(eff); - - assert(__UserGroupBase != NULL); - - if(__root_mode) - { - if(real != (gid_t)-1) - __root_gid = real; - - if(eff != (gid_t)-1) - __root_egid = eff; - - result = OK; - } - else - { - PROFILE_OFF(); - result = __setregid((LONG)real,(LONG)eff); - PROFILE_ON(); - } - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_setreuid.c b/library/usergroup_setreuid.c deleted file mode 100644 index 377a38b..0000000 --- a/library/usergroup_setreuid.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * $Id: usergroup_setreuid.c,v 1.3 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -int -setreuid(uid_t real, uid_t eff) -{ - int result; - - ENTER(); - - SHOWVALUE(real); - SHOWVALUE(eff); - - assert(__UserGroupBase != NULL); - - if(__root_mode) - { - if(real != (uid_t)-1) - __root_uid = real; - - if(eff != (uid_t)-1) - __root_euid = eff; - - result = OK; - } - else - { - PROFILE_OFF(); - result = __setreuid((LONG)real,(LONG)eff); - PROFILE_ON(); - } - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_setsid.c b/library/usergroup_setsid.c deleted file mode 100644 index d3a7e5f..0000000 --- a/library/usergroup_setsid.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id: usergroup_setsid.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -long -setsid(void) -{ - long result; - - ENTER(); - - assert(__UserGroupBase != NULL); - - PROFILE_OFF(); - result = (long)__setsid(); - PROFILE_ON(); - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/usergroup_setuid.c b/library/usergroup_setuid.c deleted file mode 100644 index 3648ed4..0000000 --- a/library/usergroup_setuid.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $Id: usergroup_setuid.c,v 1.3 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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(USERGROUP_SUPPORT) - -/****************************************************************************/ - -#ifndef _USERGROUP_HEADERS_H -#include "usergroup_headers.h" -#endif /* _USERGROUP_HEADERS_H */ - -/****************************************************************************/ - -int -setuid(uid_t id) -{ - int result; - - ENTER(); - - SHOWVALUE(id); - - assert(__UserGroupBase != NULL); - - if(__root_mode) - { - __root_uid = id; - - result = OK; - } - else - { - PROFILE_OFF(); - result = __setuid((LONG)id); - PROFILE_ON(); - } - - if(__check_abort_enabled) - __check_abort(); - - RETURN(result); - return(result); -} - -/****************************************************************************/ - -#endif /* USERGROUP_SUPPORT */ diff --git a/library/utime_headers.h b/library/utime_headers.h deleted file mode 100644 index 1ec8b59..0000000 --- a/library/utime_headers.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * $Id: utime_headers.h,v 1.3 2005-03-19 10:15:56 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UTIME_HEADERS_H -#define _UTIME_HEADERS_H - -/****************************************************************************/ - -#ifndef _STDIO_HEADERS_H -#include "stdio_headers.h" -#endif /* _STDIO_HEADERS_H */ - -#ifndef _LOCALE_HEADERS_H -#include "locale_headers.h" -#endif /* _LOCALE_HEADERS_H */ - -#ifndef _TIME_HEADERS_H -#include "time_headers.h" -#endif /* _TIME_HEADERS_H */ - -/****************************************************************************/ - -#ifndef _STDLIB_PROFILE_H -#include "stdlib_profile.h" -#endif /* _STDLIB_PROFILE_H */ - -/****************************************************************************/ - -#endif /* _UTIME_HEADERS_H */ diff --git a/library/utime_utime.c b/library/utime_utime.c deleted file mode 100644 index b2fb7ab..0000000 --- a/library/utime_utime.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * $Id: utime_utime.c,v 1.10 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _UTIME_HEADERS_H -#include "utime_headers.h" -#endif /* _UTIME_HEADERS_H */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -int -utime(const char * path_name,const struct utimbuf * times) -{ - #if defined(UNIX_PATH_SEMANTICS) - struct name_translation_info path_name_nti; - #endif /* UNIX_PATH_SEMANTICS */ - struct DateStamp ds; - int result = ERROR; - LONG status; - - assert( path_name != NULL ); - - if(__check_abort_enabled) - __check_abort(); - - #if defined(CHECK_FOR_NULL_POINTERS) - { - if(path_name == NULL) - { - __set_errno(EFAULT); - goto out; - } - } - #endif /* CHECK_FOR_NULL_POINTERS */ - - /* If a modification time is provided, convert it into the local - DateStamp format, as used by the SetFileDate() function. */ - if(times != NULL) - { - if(CANNOT __convert_time_to_datestamp(times->modtime,&ds)) - { - __set_errno(EINVAL); - goto out; - } - } - else - { - /* No special modification time provided; use the current - time instead. */ - DateStamp(&ds); - } - - #if defined(UNIX_PATH_SEMANTICS) - { - if(__unix_path_semantics) - { - if(__translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0) - goto out; - - if(path_name_nti.is_root) - { - __set_errno(EACCES); - goto out; - } - } - } - #endif /* UNIX_PATH_SEMANTICS */ - - PROFILE_OFF(); - status = SetFileDate((STRPTR)path_name,&ds); - PROFILE_ON(); - - if(status == DOSFALSE) - { - __set_errno(__translate_io_error_to_errno(IoErr())); - goto out; - } - - result = OK; - - out: - - return(result); -} diff --git a/library/utsname_uname.c b/library/utsname_uname.c deleted file mode 100644 index b6ececd..0000000 --- a/library/utsname_uname.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * $Id: utsname_uname.c,v 1.4 2005-04-24 08:46:37 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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. - */ - -/****************************************************************************/ - -/* The following is not part of the ISO 'C' (1994) standard. */ - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -#if defined(SOCKET_SUPPORT) && !defined(_SOCKET_HEADERS_H) -#include "socket_headers.h" -#endif /* SOCKET_SUPPORT && !_SOCKET_HEADERS_H */ - -#ifndef _STDLIB_HEADERS_H -#include "stdlib_headers.h" -#endif /* _STDLIB_HEADERS_H */ - -/****************************************************************************/ - -#define OSNAME "AmigaOS" - -/****************************************************************************/ - -#ifdef __amigaos4__ -#define ARCH "ppc" -#else -#define ARCH "m68k" /* XXX: How should Coldfire accelerators be handled? */ -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -int -uname(struct utsname *info) -{ - struct Library * VersionBase; - int Version,Revision; - char * version_string; - int result = ERROR; - - ENTER(); - - SHOWPOINTER(info); - - if(info == NULL) - { - __set_errno(EFAULT); - goto out; - } - - strlcpy(info->sysname,OSNAME,sizeof(info->sysname)); - - #if defined(SOCKET_SUPPORT) - { - __gethostname((STRPTR)info->nodename,sizeof(info->nodename)); - } - #else - { - strlcpy(info->nodename,"localhost",sizeof(info->nodename)); - } - #endif /* SOCKET_SUPPORT */ - - VersionBase = OpenLibrary("version.library",0L); - if(VersionBase != NULL) - { - Version = VersionBase->lib_Version; - Revision = VersionBase->lib_Revision; - - CloseLibrary(VersionBase); - } - else - { - Version = 0; - Revision = 0; - } - - snprintf(info->release,sizeof(info->release),"%d.%d",Version,Revision); - - /* - * This is mostly a stab in the dark. Is there any "official" way of finding out the OS version? - * Also, this could be more detailed e.g. "3.9-BB2" instead of just "3.9". - * For the curious: - * - * V.R OS Version - * - * 30.x 1.0 (Never released) - * 31.x 1.1 (NTSC) - * 32.x 1.1 (PAL) - * 33.x 1.2 - * 34.x 1.3 - * 35.x 1.3 (with A2024 support) - * 36.x 2.0-2.02 - * 37.x 2.04-2.05 - * 38.x 2.1 - * 39.x 3.0 - * 40.x 3.1 - * 44.2 3.5 - * 44.4 3.5-BB1 - * 44.5 3.5-BB2 - * 45.1 3.9 - * 45.2 3.9-BB1 - * 45.3 3.9-BB2 - */ - - if (46 <= Version && Version <= 52) - version_string = "4.0"; - else if (Version == 45) - version_string = "3.9"; - else if (Version >= 44) - version_string = "3.5"; - else if (Version >= 40) - version_string = "3.1"; - else if (Version >= 39) - version_string = "3.0"; - else - version_string = "unknown"; - - strlcpy(info->version,version_string,sizeof(info->version)); - - strlcpy(info->machine,ARCH,sizeof(info->machine)); - - SHOWSTRING(info->sysname); - SHOWSTRING(info->nodename); - SHOWSTRING(info->release); - SHOWSTRING(info->version); - SHOWSTRING(info->machine); - - result = OK; - -out: - - RETURN(result); - return(result); -} diff --git a/library/wchar_btowc.c b/library/wchar_btowc.c deleted file mode 100644 index 32e9e15..0000000 --- a/library/wchar_btowc.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_btowc.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wint_t -btowc(int c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_fgetwc.c b/library/wchar_fgetwc.c deleted file mode 100644 index 35a9f50..0000000 --- a/library/wchar_fgetwc.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_fgetwc.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wint_t -fgetwc(FILE *stream) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_fgetws.c b/library/wchar_fgetws.c deleted file mode 100644 index 4a86b35..0000000 --- a/library/wchar_fgetws.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_fgetws.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wchar_t * -fgetws(wchar_t *s, int n, FILE *stream) -{ - /* ZZZ unimplemented */ - return(NULL); -} diff --git a/library/wchar_fputwc.c b/library/wchar_fputwc.c deleted file mode 100644 index 854e4c6..0000000 --- a/library/wchar_fputwc.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_fputwc.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wint_t -fputwc(wchar_t c,FILE *stream) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_fputws.c b/library/wchar_fputws.c deleted file mode 100644 index cf14d93..0000000 --- a/library/wchar_fputws.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_fputws.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wint_t -fputws(const wchar_t *s, FILE *stream) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_fwide.c b/library/wchar_fwide.c deleted file mode 100644 index 1c0556d..0000000 --- a/library/wchar_fwide.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_fwide.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -fwide(FILE *stream, int orient) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_fwprintf.c b/library/wchar_fwprintf.c deleted file mode 100644 index b3f43be..0000000 --- a/library/wchar_fwprintf.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_fwprintf.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -fwprintf(FILE *stream,const wchar_t *format,...) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_fwscanf.c b/library/wchar_fwscanf.c deleted file mode 100644 index ff6647e..0000000 --- a/library/wchar_fwscanf.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_fwscanf.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -fwscanf(FILE *stream, const wchar_t *format, ...) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_getwc.c b/library/wchar_getwc.c deleted file mode 100644 index 65de677..0000000 --- a/library/wchar_getwc.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_getwc.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wint_t -getwc(FILE *stream) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_getwchar.c b/library/wchar_getwchar.c deleted file mode 100644 index d991440..0000000 --- a/library/wchar_getwchar.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_getwchar.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wint_t -getwchar(void) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_headers.h b/library/wchar_headers.h deleted file mode 100644 index 1e02cd3..0000000 --- a/library/wchar_headers.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * $Id: wchar_headers.h,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#define _WCHAR_HEADERS_H - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -#ifndef _MATH_FP_SUPPORT_H -#include "math_fp_support.h" -#endif /* _MATH_FP_SUPPORT_H */ - -/****************************************************************************/ - -#endif /* _WCHAR_HEADERS_H */ diff --git a/library/wchar_mbrlen.c b/library/wchar_mbrlen.c deleted file mode 100644 index 09d9234..0000000 --- a/library/wchar_mbrlen.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_mbrlen.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -size_t -mbrlen(wchar_t *pwc, const char * s, size_t n, mbstate_t *ps) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_mbsinit.c b/library/wchar_mbsinit.c deleted file mode 100644 index 344d38f..0000000 --- a/library/wchar_mbsinit.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_mbsinit.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -mbsinit(const mbstate_t *ps) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_mbsrtowcs.c b/library/wchar_mbsrtowcs.c deleted file mode 100644 index 094609f..0000000 --- a/library/wchar_mbsrtowcs.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_mbsrtowcs.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -size_t -mbsrtowcs(wchar_t *pwcs, const char **src, size_t n, mbstate_t *ps) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_putwc.c b/library/wchar_putwc.c deleted file mode 100644 index b71b602..0000000 --- a/library/wchar_putwc.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_putwc.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wint_t -putwc(wchar_t c,FILE *stream) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_putwchar.c b/library/wchar_putwchar.c deleted file mode 100644 index 754d2f7..0000000 --- a/library/wchar_putwchar.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_putwchar.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wint_t -putwchar(wchar_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_swprintf.c b/library/wchar_swprintf.c deleted file mode 100644 index 87f0477..0000000 --- a/library/wchar_swprintf.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_swprintf.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -swprintf(wchar_t *s, const wchar_t *format, ...) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_swscanf.c b/library/wchar_swscanf.c deleted file mode 100644 index 06c8fe6..0000000 --- a/library/wchar_swscanf.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_swscanf.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -swscanf(wchar_t *s,const wchar_t *format, ...) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_ungetwc.c b/library/wchar_ungetwc.c deleted file mode 100644 index 3b529a5..0000000 --- a/library/wchar_ungetwc.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_ungetwc.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wint_t -ungetwc(wint_t c,FILE *stream) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_vfwprintf.c b/library/wchar_vfwprintf.c deleted file mode 100644 index 6fce1f1..0000000 --- a/library/wchar_vfwprintf.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_vfwprintf.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -vfwprintf(FILE *stream,const wchar_t *format,va_list arg) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_vswprintf.c b/library/wchar_vswprintf.c deleted file mode 100644 index c0e1c5c..0000000 --- a/library/wchar_vswprintf.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_vswprintf.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -vswprintf(char *s, const wchar_t *format,va_list arg) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_vwprintf.c b/library/wchar_vwprintf.c deleted file mode 100644 index 0a8b9b4..0000000 --- a/library/wchar_vwprintf.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_vwprintf.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -vwprintf(const wchar_t *format,va_list arg) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wcrtomb.c b/library/wchar_wcrtomb.c deleted file mode 100644 index ff94fc5..0000000 --- a/library/wchar_wcrtomb.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcrtomb.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -size_t -wcrtomb(char *s, wchar_t wc, mbstate_t *ps) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wcscat.c b/library/wchar_wcscat.c deleted file mode 100644 index e10d42f..0000000 --- a/library/wchar_wcscat.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcscat.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wchar_t * -wcscat(wchar_t *dest, const wchar_t *src) -{ - /* ZZZ unimplemented */ - return(NULL); -} diff --git a/library/wchar_wcschr.c b/library/wchar_wcschr.c deleted file mode 100644 index 1c08bc5..0000000 --- a/library/wchar_wcschr.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcschr.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wchar_t * -wcschr(const wchar_t *s, wchar_t c) -{ - /* ZZZ unimplemented */ - return(NULL); -} diff --git a/library/wchar_wcscmp.c b/library/wchar_wcscmp.c deleted file mode 100644 index fc7e57c..0000000 --- a/library/wchar_wcscmp.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcscmp.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -wcscmp(const wchar_t *s1, const wchar_t * s2) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wcscpy.c b/library/wchar_wcscpy.c deleted file mode 100644 index 0292e4d..0000000 --- a/library/wchar_wcscpy.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcscpy.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wchar_t * -wcscpy(wchar_t *dest, const wchar_t *src) -{ - /* ZZZ unimplemented */ - return(NULL); -} diff --git a/library/wchar_wcsftime.c b/library/wchar_wcsftime.c deleted file mode 100644 index 1258b8c..0000000 --- a/library/wchar_wcsftime.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcsftime.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -size_t -wcsftime(wchar_t *s, size_t maxsize, const wchar_t *format, const struct tm *timeptr) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wcslen.c b/library/wchar_wcslen.c deleted file mode 100644 index 340980d..0000000 --- a/library/wchar_wcslen.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcslen.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -size_t -wcslen(const wchar_t *s) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wcsncat.c b/library/wchar_wcsncat.c deleted file mode 100644 index 6cfdb35..0000000 --- a/library/wchar_wcsncat.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcsncat.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wchar_t * -wcsncat(wchar_t *dest, const wchar_t *src, size_t n) -{ - /* ZZZ unimplemented */ - return(NULL); -} diff --git a/library/wchar_wcsncmp.c b/library/wchar_wcsncmp.c deleted file mode 100644 index d6ee9fc..0000000 --- a/library/wchar_wcsncmp.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcsncmp.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wcsncpy.c b/library/wchar_wcsncpy.c deleted file mode 100644 index f1d30fe..0000000 --- a/library/wchar_wcsncpy.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcsncpy.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wchar_t * -wcsncpy(wchar_t *dest, const wchar_t *src, size_t n) -{ - /* ZZZ unimplemented */ - return(NULL); -} diff --git a/library/wchar_wcspbrk.c b/library/wchar_wcspbrk.c deleted file mode 100644 index e5c6593..0000000 --- a/library/wchar_wcspbrk.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcspbrk.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wchar_t -wcspbrk(const wchar_t *s, const wchar_t *set) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wcsrtombs.c b/library/wchar_wcsrtombs.c deleted file mode 100644 index a0c1b8f..0000000 --- a/library/wchar_wcsrtombs.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcsrtombs.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -size_t -wcsrtombs(char *s, const wchar_t **src, size_t n, mbstate_t *ps) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wcsspn.c b/library/wchar_wcsspn.c deleted file mode 100644 index 6ec82cd..0000000 --- a/library/wchar_wcsspn.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcsspn.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -size_t -wcsspn(const wchar_t *s, const wchar_t *set) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wcstod.c b/library/wchar_wcstod.c deleted file mode 100644 index 0127398..0000000 --- a/library/wchar_wcstod.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * $Id: wchar_wcstod.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -#if defined(FLOATING_POINT_SUPPORT) - -double -wcstod(const wchar_t *str, wchar_t **ptr) -{ - /* ZZZ unimplemented */ - return(0); -} - -#endif /* FLOATING_POINT_SUPPORT */ diff --git a/library/wchar_wcstok.c b/library/wchar_wcstok.c deleted file mode 100644 index fdab16a..0000000 --- a/library/wchar_wcstok.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcstok.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wchar_t * -wcstok(wchar_t *str, const wchar_t *set) -{ - /* ZZZ unimplemented */ - return(NULL); -} diff --git a/library/wchar_wcstol.c b/library/wchar_wcstol.c deleted file mode 100644 index 90c8c5d..0000000 --- a/library/wchar_wcstol.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcstol.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -long -wcstol(const wchar_t *str, wchar_t **ptr, int base) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wcstoll.c b/library/wchar_wcstoll.c deleted file mode 100644 index e2dff46..0000000 --- a/library/wchar_wcstoll.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcstoll.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -long long -wcstoll(const wchar_t *str, wchar_t **ptr, int base) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wcstoul.c b/library/wchar_wcstoul.c deleted file mode 100644 index 9ceaa86..0000000 --- a/library/wchar_wcstoul.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcstoul.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -unsigned long -wcstoul(const wchar_t *str, wchar_t **ptr, int base) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wcstoull.c b/library/wchar_wcstoull.c deleted file mode 100644 index d2640fb..0000000 --- a/library/wchar_wcstoull.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcstoull.c,v 1.1 2005-05-12 13:21:43 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -unsigned long long -wcstoull(const wchar_t *str, wchar_t **ptr, int base) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wcsxfrm.c b/library/wchar_wcsxfrm.c deleted file mode 100644 index 502a98a..0000000 --- a/library/wchar_wcsxfrm.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wcsxfrm.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -size_t -wcsxfrm(wchar_t *dest, const wchar_t *src, size_t len) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wmemchr.c b/library/wchar_wmemchr.c deleted file mode 100644 index 030eb87..0000000 --- a/library/wchar_wmemchr.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wmemchr.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wchar_t * -wmemchr(const wchar_t *ptr, wchar_t val, size_t len) -{ - /* ZZZ unimplemented */ - return(NULL); -} diff --git a/library/wchar_wmemcmp.c b/library/wchar_wmemcmp.c deleted file mode 100644 index 5061de1..0000000 --- a/library/wchar_wmemcmp.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wmemcmp.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -wmemcmp(const wchar_t *ptr1, const wchar_t *ptr2, size_t len) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wmemcpy.c b/library/wchar_wmemcpy.c deleted file mode 100644 index bb3fac8..0000000 --- a/library/wchar_wmemcpy.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wmemcpy.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wchar_t * -wmemcpy(wchar_t *dest, const wchar_t *src, size_t len) -{ - /* ZZZ unimplemented */ - return(NULL); -} diff --git a/library/wchar_wmemmove.c b/library/wchar_wmemmove.c deleted file mode 100644 index 2875ea6..0000000 --- a/library/wchar_wmemmove.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wmemmove.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wchar_t * -wmemmove(wchar_t *dest, const wchar_t * src, size_t len) -{ - /* ZZZ unimplemented */ - return(NULL); -} diff --git a/library/wchar_wmemset.c b/library/wchar_wmemset.c deleted file mode 100644 index d75d79a..0000000 --- a/library/wchar_wmemset.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wmemset.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -wchar_t * -wmemset(wchar_t *ptr, int val, size_t len) -{ - /* ZZZ unimplemented */ - return(NULL); -} diff --git a/library/wchar_wprintf.c b/library/wchar_wprintf.c deleted file mode 100644 index df87faa..0000000 --- a/library/wchar_wprintf.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wprintf.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -wprintf(const wchar_t *format, ...) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wscanf.c b/library/wchar_wscanf.c deleted file mode 100644 index b43706a..0000000 --- a/library/wchar_wscanf.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wscanf.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -wscanf(const wchar_t *format, ...) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wchar_wscoll.c b/library/wchar_wscoll.c deleted file mode 100644 index 54ed227..0000000 --- a/library/wchar_wscoll.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wchar_wscoll.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCHAR_HEADERS_H -#include "wchar_headers.h" -#endif /* _WCHAR_HEADERS_H */ - -/****************************************************************************/ - -int -wscoll(const wchar_t *s1, const wchar_t *s2) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_headers.h b/library/wctype_headers.h deleted file mode 100644 index e32f5a5..0000000 --- a/library/wctype_headers.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * $Id: wctype_headers.h,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#define _WCTYPE_HEADERS_H - -/****************************************************************************/ - -#include - -/****************************************************************************/ - -#endif /* _WCTYPE_HEADERS_H */ diff --git a/library/wctype_iswalnum.c b/library/wctype_iswalnum.c deleted file mode 100644 index 029911b..0000000 --- a/library/wctype_iswalnum.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_iswalnum.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -int -iswalnum(wint_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_iswalpha.c b/library/wctype_iswalpha.c deleted file mode 100644 index a6e463a..0000000 --- a/library/wctype_iswalpha.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_iswalpha.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -int -iswalpha(wint_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_iswblank.c b/library/wctype_iswblank.c deleted file mode 100644 index 75a40b6..0000000 --- a/library/wctype_iswblank.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_iswblank.c,v 1.1 2005-05-12 13:21:44 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -int -iswblank(wint_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_iswcntrl.c b/library/wctype_iswcntrl.c deleted file mode 100644 index cad36b7..0000000 --- a/library/wctype_iswcntrl.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_iswcntrl.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -int -iswcntrl(wint_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_iswctype.c b/library/wctype_iswctype.c deleted file mode 100644 index 2a8a6e4..0000000 --- a/library/wctype_iswctype.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_iswctype.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -int -iswctype(wint_t c, wctype_t desc) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_iswdigit.c b/library/wctype_iswdigit.c deleted file mode 100644 index d575094..0000000 --- a/library/wctype_iswdigit.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_iswdigit.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -int -iswdigit(wint_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_iswgraph.c b/library/wctype_iswgraph.c deleted file mode 100644 index fa89441..0000000 --- a/library/wctype_iswgraph.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_iswgraph.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -int -iswgraph(wint_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_iswlower.c b/library/wctype_iswlower.c deleted file mode 100644 index 3a37e77..0000000 --- a/library/wctype_iswlower.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_iswlower.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -int -iswlower(wint_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_iswprint.c b/library/wctype_iswprint.c deleted file mode 100644 index 323f548..0000000 --- a/library/wctype_iswprint.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_iswprint.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -int -iswprint(wint_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_iswpunc.c b/library/wctype_iswpunc.c deleted file mode 100644 index 27c3df1..0000000 --- a/library/wctype_iswpunc.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_iswpunc.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -int -iswpunc(wint_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_iswspace.c b/library/wctype_iswspace.c deleted file mode 100644 index a6e3531..0000000 --- a/library/wctype_iswspace.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_iswspace.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -int -iswspace(wint_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_iswupper.c b/library/wctype_iswupper.c deleted file mode 100644 index ba65500..0000000 --- a/library/wctype_iswupper.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_iswupper.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -int -iswupper(wint_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_iswxdigit.c b/library/wctype_iswxdigit.c deleted file mode 100644 index a7264d9..0000000 --- a/library/wctype_iswxdigit.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_iswxdigit.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -int -iswxdigit(wint_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_towctrans.c b/library/wctype_towctrans.c deleted file mode 100644 index b4e9bc2..0000000 --- a/library/wctype_towctrans.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_towctrans.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -wint_t -towctrans(wint_t c, wctrans_t desc) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_towlower.c b/library/wctype_towlower.c deleted file mode 100644 index b869347..0000000 --- a/library/wctype_towlower.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_towlower.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -wint_t -towlower(wint_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_towupper.c b/library/wctype_towupper.c deleted file mode 100644 index fafdd88..0000000 --- a/library/wctype_towupper.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_towupper.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -wint_t -towupper(wint_t c) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_wctrans.c b/library/wctype_wctrans.c deleted file mode 100644 index 80b10ea..0000000 --- a/library/wctype_wctrans.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_wctrans.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -wctrans_t -wctrans(const char *property) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/library/wctype_wctype.c b/library/wctype_wctype.c deleted file mode 100644 index 010dc55..0000000 --- a/library/wctype_wctype.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * $Id: wctype_wctype.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $ - * - * :ts=4 - * - * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2005 by Olaf Barthel - * 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 _WCTYPE_HEADERS_H -#include -#endif /* _WCTYPE_HEADERS_H */ - -/****************************************************************************/ - -wctype_t -wctype(const char *property) -{ - /* ZZZ unimplemented */ - return(0); -} diff --git a/test_programs/GNUmakefile.68k b/test_programs/GNUmakefile.68k deleted file mode 100644 index 49eaadf..0000000 --- a/test_programs/GNUmakefile.68k +++ /dev/null @@ -1,118 +0,0 @@ -# -# $Id: GNUmakefile.68k,v 1.7 2005-05-17 19:15:31 obarthel Exp $ -# -# :ts=8 -# - -############################################################################## - -CC = gcc -DELETE = delete all quiet - -############################################################################## - -.c.o: - @echo "Compiling $<" - @$(CC) -c $(CFLAGS) $< - -############################################################################## - -#CODE_TYPE := -fbaserel -DSMALL_DATA -m68020-60 -DM68020 -#CODE_TYPE := -fbaserel -DSMALL_DATA -m68000 -#CODE_TYPE := -fbaserel32 -DSMALL_DATA32 -m68020-60 -DM68020 - CODE_TYPE := -m68020-60 -DM68020 -#CODE_TYPE := -m68000 - -############################################################################## - -WARNINGS = \ - -Wall -W -Wshadow -Wpointer-arith -Wsign-compare -Wmissing-prototypes \ - -Wundef -Wbad-function-cast -Wmissing-declarations -Wconversion - -INCLUDE = -I../library/include -LIB = -L../library/lib - OPTIONS = -DNDEBUG -fno-builtin -fwritable-strings -DNO_INLINE_STDARG -DIEEE_FLOATING_POINT_SUPPORT -#OPTIONS = -D__MEM_DEBUG -fno-builtin -#OPTIONS = -DDEBUG -D__MEM_DEBUG -DNO_INLINE_STDARG -fno-builtin - OPTIMIZE = -O -#OPTIMIZE = -O2 -fomit-frame-pointer -DEBUG = -ggdb - -CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_TYPE) $(INCLUDE) $(LIB) - -############################################################################## - -LIBS = -lm -lc -lgcc - -############################################################################## - -all: test fgets_test iotest sscanf_test printf_test sprintf_test \ - stack_size_test translate_test strtok_test uname simple \ - fstat_stdout_test simple_sprintf - -clean: - $(DELETE) #?.o #?.map test fgets_test iotest sscanf_test printf_test \ - sprintf_test stack_size_test translate_test strtok_test uname \ - simple fstat_stdout_test simple_sprintf - -############################################################################## - -test : test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -fgets_test : fgets_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ fgets_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -strtok_test : strtok_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ strtok_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -iotest : iotest.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ iotest.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -sscanf_test : sscanf_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ sscanf_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -printf_test : printf_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ printf_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -sprintf_test : sprintf_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ sprintf_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -stack_size_test : stack_size_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ stack_size_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -translate_test : translate_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ translate_test.o -lunix $(LIBS) -Wl,--cref,-M,-Map=$@.map - -uname : uname.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ uname.o -lunix $(LIBS) -Wl,--cref,-M,-Map=$@.map - -simple : simple.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ simple.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -fstat_stdout_test : fstat_stdout_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ fstat_stdout_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -simple_sprintf : simple_sprintf.o - @echo "Linking $@" - $(CC) -nostdlib $(CFLAGS) -o $@ simple_sprintf.o -lc -Wl,--cref,-M,-Map=$@.map - -############################################################################## - -mkid: - mkid -v #?.(c|h|asm|i) - -update: - mkid -v -u diff --git a/test_programs/GNUmakefile.os4 b/test_programs/GNUmakefile.os4 deleted file mode 100644 index 1502340..0000000 --- a/test_programs/GNUmakefile.os4 +++ /dev/null @@ -1,102 +0,0 @@ -# -# $Id: GNUmakefile.os4,v 1.8 2005-05-18 07:22:51 obarthel Exp $ -# -# :ts=8 -# - -############################################################################## - -CC = ppc-amigaos-gcc -DELETE = rm -r - -############################################################################## - -.c.o: - @echo "Compiling $<" - @$(CC) -c $(CFLAGS) $< - -############################################################################## - -WARNINGS = \ - -Wall -W -Wshadow -Wpointer-arith -Wsign-compare -Wmissing-prototypes \ - -Wundef -Wbad-function-cast -Wmissing-declarations -Wconversion - -INCLUDE = -I$(V)/include -I../library/include -LIB = -L../library/lib -#OPTIONS = -DNDEBUG -fno-builtin -DNO_INLINE_STDARG -DIEEE_FLOATING_POINT_SUPPORT -#OPTIONS = -D__MEM_DEBUG -fno-builtin - OPTIONS = -DDEBUG -DNO_INLINE_STDARG -fno-builtin -#OPTIMIZE = -O -#OPTIMIZE = -O2 -fomit-frame-pointer -DEBUG = -ggdb - -CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_TYPE) $(INCLUDE) $(LIB) - -############################################################################## - -LIBS = -lm -lc -ldebug -lgcc - -############################################################################## - -all: test fgets_test iotest sscanf_test printf_test sprintf_test \ - stack_size_test translate_test strtok_test uname simple \ - fstat_stdout_test simple_sprintf - -clean: - $(DELETE) *.o *.map test fgets_test iotest sscanf_test printf_test \ - sprintf_test stack_size_test translate_test strtok_test \ - uname simple fstat_stdout_test simple_sprintf - -############################################################################## - -test : test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -fgets_test : fgets_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ fgets_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -strtok_test : strtok_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ strtok_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -iotest : iotest.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ iotest.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -sscanf_test : sscanf_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ sscanf_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -printf_test : printf_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ printf_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -sprintf_test : sprintf_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ sprintf_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -stack_size_test : stack_size_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ stack_size_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -translate_test : translate_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ translate_test.o -lunix $(LIBS) -Wl,--cref,-M,-Map=$@.map - -uname : uname.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ uname.o -lunix $(LIBS) -Wl,--cref,-M,-Map=$@.map - -simple : simple.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ simple.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -fstat_stdout_test : fstat_stdout_test.o - @echo "Linking $@" - $(CC) $(CFLAGS) -o $@ fstat_stdout_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map - -simple_sprintf : simple_sprintf.o - @echo "Linking $@" - $(CC) -nostdlib $(CFLAGS) -o $@ simple_sprintf.o -lc -lgcc -Wl,--cref,-M,-Map=$@.map diff --git a/test_programs/README b/test_programs/README deleted file mode 100644 index be6967b..0000000 --- a/test_programs/README +++ /dev/null @@ -1,5 +0,0 @@ -This is a collection of programs I'm using to test the library. These -are functional tests: the library is supposed to do something, and produce -a particular result. For example, "printf_test" exercises a bunch of -output formatting rules. Currently, there is only an smakefile for SAS/C -to build these programs with. diff --git a/test_programs/clib-bug.c b/test_programs/clib-bug.c deleted file mode 100644 index c3a554d..0000000 --- a/test_programs/clib-bug.c +++ /dev/null @@ -1,74 +0,0 @@ -#include -#include - -#define LINEBUFLENGTH 180 - -#define STRIP_LF(str) (str[strlen(str)-1]=0) -void invert_str(char * in) -{ -char t; -while(t=*in) - { - *in++=~t; - } -} - -int main(int i, char *c[]) -{ -char dest_fname[80], in_linebuffer[LINEBUFLENGTH]; -FILE * fileout, * filein; - -if(i>1) - { - sprintf(dest_fname, "%s.c", c[1]); - - fileout=fopen(dest_fname, "w"); - filein =fopen(c[1], "r"); - - if(fileout && filein) - { - fgets(in_linebuffer, LINEBUFLENGTH, filein); - STRIP_LF(in_linebuffer); - invert_str(in_linebuffer); - fputs("char *s_leading=\"", fileout); - fputs(in_linebuffer, fileout); - fputs("\";\n", fileout); - - fputs("char *s_messages[]={\n", fileout); - - while(fgets(in_linebuffer, LINEBUFLENGTH, filein)) - { - STRIP_LF(in_linebuffer); - invert_str(in_linebuffer); - - fputs("\"", fileout); - fputs(in_linebuffer, fileout); - fputs("\",\n", fileout); - } - fputs("};\n", fileout); - fputs("unsigned s_mess_num = sizeof(s_messages)/sizeof(char *);\n", fileout); - fclose(filein); - fclose(fileout); - } - } -return 0; -} - -/* -What's this stuff for ? I use it in SP_Engine to hide the usual bunch of "secret -messages". As you can see, the strings are simply not'ed . -This source shows both flaws: fgets() and the missing buffer flush. You can -change the while() statement with - -while(!feof(filein)) - { - fgets(in_linebuffer, LINEBUFLENGTH, filein); -.... - -This way you'll workaround the first problem. -The second issue manifests itself this way: the last two fputs() followed by the -fclose() don't do anything: no "};\n" and no "unsigned....." lines are output to -'fileout'. With SAS, it works perfectly. Converting the source to dos.library -calls also works perfectly. I wonder if there's some kind of strange interaction -with the dos/shell updates. -*/ diff --git a/test_programs/fgets_test.c b/test_programs/fgets_test.c deleted file mode 100644 index 7190b8d..0000000 --- a/test_programs/fgets_test.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * $Id: fgets_test.c,v 1.1.1.1 2004-07-26 16:36:07 obarthel Exp $ - * - * :ts=4 - */ - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -int -main(int argc,char ** argv) -{ - char line[256]; - size_t len; - FILE * in; - int i; - - for(i = 1 ; i < argc ; i++) - { - in = fopen(argv[i],"rb"); - if(in != NULL) - { - while(fgets(line,sizeof(line),in) != NULL) - { - len = strlen(line); - while(len > 0 && (line[len-1] == '\n' || line[len-1] == '\r')) - line[--len] = '\0'; - - printf("%s\n",line); - } - - fclose(in); - } - } - - return(0); -} diff --git a/test_programs/fstat_stdout_test.c b/test_programs/fstat_stdout_test.c deleted file mode 100644 index ae511e7..0000000 --- a/test_programs/fstat_stdout_test.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * $Id: fstat_stdout_test.c,v 1.1 2005-05-08 16:27:25 obarthel Exp $ - * - * :ts=4 - */ - -#include - -#include - -#include -#include - -/****************************************************************************/ - -int -main(int argc,char ** argv) -{ - struct stat st; - int fd; - - fd = dup(STDOUT_FILENO); - if(fd < 0) - { - perror("dup(STDOUT_FILENO)"); - return(EXIT_FAILURE); - } - - if(fstat(fd,&st) < 0) - { - perror("fstat(fd,&st)"); - return(EXIT_FAILURE); - } - - return(EXIT_SUCCESS); -} diff --git a/test_programs/iotest.c b/test_programs/iotest.c deleted file mode 100644 index 8f5c269..0000000 --- a/test_programs/iotest.c +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include -#include - -#define FILE_SIZE 2048 -#define WRITE_SIZE 32 - -char FileData[FILE_SIZE]; - -void CreateFile(char *filename) -{ - FILE *file; - - if (file = fopen(filename,"w")) { - memset(FileData,'0',FILE_SIZE); - memset(FileData,'-',WRITE_SIZE); - fwrite(FileData,1,FILE_SIZE,file); - fclose(file); - } -} - -void ReadWriteFile(char *filename) -{ - FILE *file; - - if (file = fopen(filename,"r+")) { - fseek(file,0,SEEK_SET); - fread(FileData,1,FILE_SIZE,file); - fseek(file,0,SEEK_SET); - memset(FileData,'1',WRITE_SIZE); - fwrite(FileData,1,WRITE_SIZE,file); - fclose(file); - } -} - -int main(int argc, char **argv) -{ - if (argc > 1) { - CreateFile(argv[1]); - ReadWriteFile(argv[1]); - } - - return 0; -} diff --git a/test_programs/printf_g_test.c b/test_programs/printf_g_test.c deleted file mode 100644 index 0a9edcb..0000000 --- a/test_programs/printf_g_test.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int __debug_level = 2; - -int main(void) -{ - double val = 0.0001; - - printf("%g\n", val); - - return(0); -} diff --git a/test_programs/printf_test.c b/test_programs/printf_test.c deleted file mode 100644 index 072a84e..0000000 --- a/test_programs/printf_test.c +++ /dev/null @@ -1,238 +0,0 @@ -#include -#include -#include - -double x; - -void -print_format_int(const char * format_string,int parameter1,int parameter2) -{ - printf("\""); - printf(format_string,parameter1); - printf("\"\t"); - - printf("Value = % d, Format = \"%s\"\n",parameter1,format_string); - - printf("\""); - printf(format_string,parameter2); - printf("\"\t"); - - printf("Value = % d, Format = \"%s\"\n",parameter2,format_string); -} - -void -print_format_char(const char * format_string,char parameter) -{ - printf("\""); - printf(format_string,parameter); - printf("\"\t"); - - printf("Value = '%c', Format = \"%s\"\n",parameter,format_string); -} - -void -print_format_string(const char * format_string,const char *parameter1,const char *parameter2) -{ - printf("\""); - printf(format_string,parameter1); - printf("\"\t"); - - printf("Value = \"%s\", Format = \"%s\"\n",parameter1,format_string); - - printf("\""); - printf(format_string,parameter2); - printf("\"\t"); - - printf("Value = \"%s\", Format = \"%s\"\n",parameter2,format_string); -} - -void -print_format_float(const char * format_string,double parameter1,double parameter2) -{ - printf("\""); - printf(format_string,parameter1); - printf("\"\t"); - - printf("Value = % f, Format = \"%s\"\n",parameter1,format_string); - - printf("\""); - printf(format_string,parameter2); - printf("\"\t"); - - printf("Value = % f, Format = \"%s\"\n",parameter2,format_string); -} - -int -main(void) -{ - /* - unsigned long foo[2] = { 0x41f00000, 0 }; - - memcpy(&x,foo,sizeof(x)); - - printf("%.20g\n",x); - */ - - print_format_int("%12d",45,-45); - print_format_int("%012d",45,-45); - print_format_int("% 012d",45,-45); - print_format_int("%+12d",45,-45); - print_format_int("%+012d",45,-45); - print_format_int("%-12d",45,-45); - print_format_int("%- 12d",45,-45); - print_format_int("%-+12d",45,-45); - print_format_int("%12.4d",45,-45); - print_format_int("%-12.4d",45,-45); - print_format_int("%12.0d",45,-45); - - printf("\n"); - - print_format_int("%14u",45,-45); - print_format_int("%014u",45,-45); - print_format_int("%#14u",45,-45); - print_format_int("%#014u",45,-45); - print_format_int("%-14u",45,-45); - print_format_int("%-#14u",45,-45); - print_format_int("%14.4u",45,-45); - print_format_int("%-14.4u",45,-45); - print_format_int("%14.0u",45,-45); - - printf("\n"); - - print_format_int("%14o",45,-45); - print_format_int("%014o",45,-45); - print_format_int("%#14o",45,-45); - print_format_int("%#014o",45,-45); - print_format_int("%-14o",45,-45); - print_format_int("%-#14o",45,-45); - print_format_int("%14.4o",45,-45); - print_format_int("%-14.4o",45,-45); - print_format_int("%14.0o",45,-45); - - printf("\n"); - - print_format_int("%12x",45,-45); - print_format_int("%012x",45,-45); - print_format_int("%#12X",45,-45); - print_format_int("%#012X",45,-45); - print_format_int("%-12x",45,-45); - print_format_int("%-#12x",45,-45); - print_format_int("%12.4x",45,-45); - print_format_int("%-12.4x",45,-45); - print_format_int("%12.0x",45,-45); - - printf("\n"); - - print_format_char("%12c",'*'); - print_format_char("%012c",'*'); - print_format_char("%-12c",'*'); - print_format_char("%12.0c",'*'); - - printf("\n"); - - print_format_string("%12s","zap","longish"); - print_format_string("%12.5s","zap","longish"); - print_format_string("%012s","zap","longish"); - print_format_string("%-12s","zap","longish"); - print_format_string("%12.0s","zap","longish"); - - printf("\n"); - - print_format_float("%10.2f",12.678,-12.678); - print_format_float("%010.2f",12.678,-12.678); - print_format_float("% 010.2f",12.678,-12.678); - print_format_float("%+10.2f",12.678,-12.678); - print_format_float("%+010.2f",12.678,-12.678); - print_format_float("%-10.2f",12.678,-12.678); - print_format_float("%- 10.2f",12.678,-12.678); - print_format_float("%-+10.4f",12.678,-12.678); - print_format_float("%f",12.678,-12.678); - print_format_float("%10f",12.678,-12.678); - print_format_float("%10.0f",12.678,-12.678); - - printf("\n"); - - print_format_float("%10.2e",12.678,-12.678); - print_format_float("%010.2e",12.678,-12.678); - print_format_float("% 010.2e",12.678,-12.678); - print_format_float("%+10.2E",12.678,-12.678); - print_format_float("%+010.2E",12.678,-12.678); - print_format_float("%-10.2e",12.678,-12.678); - print_format_float("%- 10.2e",12.678,-12.678); - print_format_float("%-+10.2e",12.678,-12.678); - print_format_float("%e",12.678,-12.678); - print_format_float("%10e",12.678,-12.678); - print_format_float("%10.0e",12.678,-12.678); - - printf("\n"); - - print_format_float("%10.2a",12.678,-12.678); - print_format_float("%010.2a",12.678,-12.678); - print_format_float("% 010.2a",12.678,-12.678); - print_format_float("%+10.2A",12.678,-12.678); - print_format_float("%+010.2A",12.678,-12.678); - print_format_float("%-10.2a",12.678,-12.678); - print_format_float("%- 10.2a",12.678,-12.678); - print_format_float("%-+10.2a",12.678,-12.678); - print_format_float("%a",12.678,-12.678); - print_format_float("%10a",12.678,-12.678); - print_format_float("%10.0a",12.678,-12.678); - - printf("\n"); - - print_format_float("%10.2g",12.678,-12.678); - print_format_float("%010.2g",12.678,-12.678); - print_format_float("% 010.2g",12.678,-12.678); - print_format_float("%+10.2G",12.678,-12.678); - print_format_float("%+010.2G",12.678,-12.678); - print_format_float("%-10.2g",12.678,-12.678); - print_format_float("%- 10.2g",12.678,-12.678); - print_format_float("%-+10.2g",12.678,-12.678); - print_format_float("%g",12.678,-12.678); - print_format_float("%10g",12.678,-12.678); - print_format_float("%10.0g",12.678,-12.678); - - printf("\n"); - - print_format_float("%10.2g",0.678,-0.678); - print_format_float("%010.2g",0.678,-0.678); - print_format_float("% 010.2g",0.678,-0.678); - print_format_float("%+10.2G",0.678,-0.678); - print_format_float("%+010.2G",0.678,-0.678); - print_format_float("%-10.2g",0.678,-0.678); - print_format_float("%- 10.2g",0.678,-0.678); - print_format_float("%-+10.2g",0.678,-0.678); - print_format_float("%g",0.678,-0.678); - print_format_float("%10g",0.678,-0.678); - print_format_float("%10.0g",0.678,-0.678); - - printf("\n"); - - print_format_float("%10.2g",strtod("infinity",NULL),strtod("-infinity",NULL)); - print_format_float("%010.2g",strtod("infinity",NULL),strtod("-infinity",NULL)); - print_format_float("% 010.2g",strtod("infinity",NULL),strtod("-infinity",NULL)); - print_format_float("%+10.2G",strtod("infinity",NULL),strtod("-infinity",NULL)); - print_format_float("%+010.2G",strtod("infinity",NULL),strtod("-infinity",NULL)); - print_format_float("%-10.2g",strtod("infinity",NULL),strtod("-infinity",NULL)); - print_format_float("%- 10.2g",strtod("infinity",NULL),strtod("-infinity",NULL)); - print_format_float("%-+10.2g",strtod("infinity",NULL),strtod("-infinity",NULL)); - print_format_float("%g",strtod("infinity",NULL),strtod("-infinity",NULL)); - print_format_float("%10g",strtod("infinity",NULL),strtod("-infinity",NULL)); - print_format_float("%10.0g",strtod("infinity",NULL),strtod("-infinity",NULL)); - - printf("\n"); - - print_format_float("%10.2g",strtod("nan",NULL),strtod("-nan",NULL)); - print_format_float("%010.2g",strtod("nan",NULL),strtod("-nan",NULL)); - print_format_float("% 010.2g",strtod("nan",NULL),strtod("-nan",NULL)); - print_format_float("%+10.2G",strtod("nan",NULL),strtod("-nan",NULL)); - print_format_float("%+010.2G",strtod("nan",NULL),strtod("-nan",NULL)); - print_format_float("%-10.2g",strtod("nan",NULL),strtod("-nan",NULL)); - print_format_float("%- 10.2g",strtod("nan",NULL),strtod("-nan",NULL)); - print_format_float("%-+10.2g",strtod("nan",NULL),strtod("-nan",NULL)); - print_format_float("%g",strtod("nan",NULL),strtod("-nan",NULL)); - print_format_float("%10g",strtod("nan",NULL),strtod("-nan",NULL)); - print_format_float("%10.0g",strtod("nan",NULL),strtod("-nan",NULL)); - - return(0); -} diff --git a/test_programs/simple.c b/test_programs/simple.c deleted file mode 100644 index 4b38c53..0000000 --- a/test_programs/simple.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * $Id: simple.c,v 1.1 2005-03-03 15:12:18 obarthel Exp $ - * - * :ts=4 - */ - -/****************************************************************************/ - -int -main(int argc,char ** argv) -{ - return(0); -} diff --git a/test_programs/simple_sprintf.c b/test_programs/simple_sprintf.c deleted file mode 100644 index 9919c0f..0000000 --- a/test_programs/simple_sprintf.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * $Id: simple_sprintf.c,v 1.2 2005-05-18 07:22:52 obarthel Exp $ - * - * :ts=4 - */ - -#include - -/****************************************************************************/ - -#define __NOLIBBASE__ -#define __USE_INLINE__ -#define __NOGLOBALIFACE__ - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -#include -#include -#include - -/****************************************************************************/ - -struct Library * SysBase; -struct Library * DOSBase; - -/****************************************************************************/ - -#if defined(__amigaos4__) - -struct ExecIFace * IExec; -struct DOSIFace * IDOS; - -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -BOOL __check_abort_enabled = FALSE; - -/****************************************************************************/ - -int _start(void); - -/****************************************************************************/ - -int -_start(void) -{ - char string[80]; - - SysBase = *(struct Library **)4; - - #if defined(__amigaos4__) - { - IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface; - } - #endif /* __amigaos4__ */ - - DOSBase = OpenLibrary("dos.library",37); - if(DOSBase == NULL) - goto out; - - #if defined(__amigaos4__) - { - IDOS = (struct DOSIFace *)GetInterface(DOSBase, "main", 1, 0); - if(IDOS == NULL) - goto out; - } - #endif /* __amigaos4__ */ - - sprintf(string,"a %s c\n","b"); - - Write(Output(),string,(LONG)strlen(string)); - - out: - - #if defined(__amigaos4__) - { - if(IDOS != NULL) - DropInterface((struct Interface *)IDOS); - } - #endif /* __amigaos4__ */ - - if(DOSBase != NULL) - CloseLibrary(DOSBase); - - return(0); -} - -/****************************************************************************/ - -void -__check_abort(void) -{ -} diff --git a/test_programs/smakefile b/test_programs/smakefile deleted file mode 100644 index ca3e6d8..0000000 --- a/test_programs/smakefile +++ /dev/null @@ -1,162 +0,0 @@ -# -# $Id: smakefile,v 1.7 2005-05-17 19:15:32 obarthel Exp $ -# -# :ts=8 -# - -############################################################################## - -.c.o: - @echo "Compiling $<" - @sc nover $(CFLAGS) $< - -.asm.o: - @echo "Assembling $<" - @asm $(AFLAGS) $< - -############################################################################## - -# You might want to change this to the directory where your operating system -# header files are stored. On my system, that's "V:include", but you might -# get lucky with "sc:include" instead, which is the default for SAS/C. -INCLUDE_DIR = V:include -#INCLUDE_DIR = sc:include - -############################################################################## - -# This is where the header files, the startup code and the c.lib files are -# stored; see below how this prefix is used. -LIB = /library/ - -############################################################################## - - OPTIMIZE = optimize opttime optschedule optinline -#DEBUG = debug=line noopt define=CHECK_FOR_NULL_POINTERS -#DEBUG = debug=line -#DEBUG = debug=line define=NDEBUG - DEBUG = debug=sf noopt -#DEBUG = debug=sf noopt define=CHECK_FOR_NULL_POINTERS -#PROFILE = profile - DATA = data=faronly -#CODE = code=far - CPU = cpu=060 -MATH = define=IEEE_FLOATING_POINT_SUPPORT math=IEEE -SUPPORT = define=UNIX_PATH_SEMANTICS define=SOCKET_SUPPORT define=USERGROUP_SUPPORT \ - define=__C_MACROS__ - -############################################################################## - -CFLAGS = \ - resopt \ - nover \ - memorysize=huge \ - idlen=64 \ - commentnest \ - nostackcheck \ - stringmerge \ - errorrexx \ - $(PROFILE) $(OPTIMIZE) $(CODE) $(DATA) $(CPU) $(MATH) \ - $(SUPPORT) $(DEBUG) - -AFLAGS = \ - -d -m2 - -############################################################################## - -all: \ - setup \ - test fgets_test iotest sscanf_test printf_test sprintf_test \ - stack_size_test translate_test strtok_test uname simple \ - fstat_stdout_test simple_sprintf \ - cleanup - -clean: - -delete \#?.o \#?.map \ - test fgets_test iotest sscanf_test printf_test sprintf_test \ - stack_size_test translate_test strtok_test uname simple \ - simple_sprintf - -############################################################################## - -setup: - @echo "Setting up include: assignment" - @assign include: $(LIB)include V:include - -cleanup: - @echo "Cleaning up include: assignment" - @assign include: sc:include - -############################################################################## - -test: test.o - @echo "Linking $@" - @slink $(LIB)startup.o test.o to $@ lib $(LIB)c.lib addsym \ - map $@.map,fhx fwidth 32 pwidth 32 swidth 32 - -fgets_test: fgets_test.o - @echo "Linking $@" - @slink $(LIB)startup.o fgets_test.o to $@ lib $(LIB)c.lib addsym \ - map $@.map,fhx fwidth 32 pwidth 32 swidth 32 - -strtok_test: strtok_test.o - @echo "Linking $@" - @slink $(LIB)startup.o strtok_test.o to $@ lib $(LIB)c.lib addsym \ - map $@.map,fhx fwidth 32 pwidth 32 swidth 32 - -iotest: iotest.o - @echo "Linking $@" - @slink $(LIB)startup.o iotest.o to $@ lib $(LIB)c.lib addsym \ - map $@.map,fhx fwidth 32 pwidth 32 swidth 32 - -sscanf_test: sscanf_test.o - @echo "Linking $@" - @slink $(LIB)startup.o sscanf_test.o to $@ lib $(LIB)c.lib addsym \ - map $@.map,fhx fwidth 32 pwidth 32 swidth 32 - -printf_test: printf_test.o - @echo "Linking $@" - @slink $(LIB)startup.o printf_test.o to $@ lib $(LIB)c.lib addsym \ - map $@.map,fhx fwidth 32 pwidth 32 swidth 32 - -sprintf_test: sprintf_test.o - @echo "Linking $@" - @slink $(LIB)startup.o sprintf_test.o to $@ lib $(LIB)c.lib addsym \ - map $@.map,fhx fwidth 32 pwidth 32 swidth 32 - -stack_size_test: stack_size_test.o - @echo "Linking $@" - @slink $(LIB)startup.o stack_size_test.o to $@ lib $(LIB)c.lib addsym \ - map $@.map,fhx fwidth 32 pwidth 32 swidth 32 - -translate_test: translate_test.o - @echo "Linking $@" - @slink $(LIB)startup.o translate_test.o to $@ lib $(LIB)c.lib addsym \ - map $@.map,fhx fwidth 32 pwidth 32 swidth 32 - -uname: uname.o - @echo "Linking $@" - @slink $(LIB)startup.o uname.o to $@ lib $(LIB)c.lib addsym \ - map $@.map,fhx fwidth 32 pwidth 32 swidth 32 - -simple: simple.o - @echo "Linking $@" - @slink $(LIB)startup.o simple.o to $@ lib $(LIB)c.lib addsym \ - map $@.map,fhx fwidth 32 pwidth 32 swidth 32 - -fstat_stdout_test: fstat_stdout_test.o - @echo "Linking $@" - @slink $(LIB)startup.o fstat_stdout_test.o to $@ lib $(LIB)c.lib addsym \ - map $@.map,fhx fwidth 32 pwidth 32 swidth 32 - -simple_sprintf: simple_sprintf.o - @echo "Linking $@" - @slink simple_sprintf.o to $@ lib $(LIB)c.lib addsym \ - map $@.map,fhx fwidth 32 pwidth 32 swidth 32 - -############################################################################## - -mkid: - mkid \#?.(c|h|asm|i) include/\#?.(c|h|asm|i) include/sys/\#?.(c|h|asm|i) - -update: - mkid -v -u diff --git a/test_programs/sprintf_test.c b/test_programs/sprintf_test.c deleted file mode 100644 index 40e92a1..0000000 --- a/test_programs/sprintf_test.c +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include - -static char buf[256]; - -void addsomething(void) -{ - char *p = &buf[strlen(buf)]; - sprintf(p, "yeah"); -} - -int main(void) -{ - buf[0] = '\0'; - - addsomething(); - printf("1: [%s]\n", buf); - - sprintf(buf, ""); - - addsomething(); - printf("2: [%s]\n", buf); - - return (0); -} diff --git a/test_programs/sscanf_test.c b/test_programs/sscanf_test.c deleted file mode 100644 index 428fa16..0000000 --- a/test_programs/sscanf_test.c +++ /dev/null @@ -1,135 +0,0 @@ -#include -#include -#include - -int -main(void) -{ - int first, second, third, num; - int n,a,b,c; - char str[4]; - double f; - - a = 0; - n = sscanf("060206","%x",&a); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %d\n",n,a); - - num = sscanf("day-month-year", "%d-%d-%d", &first, &second, &third); - - printf("%s:%d:",__FILE__,__LINE__);printf("%d %d %d %d\n", num, first, second, third); - - num = sscanf("8-11-2004", "%d-%d-%d", &first, &second, &third); - - printf("%s:%d:",__FILE__,__LINE__);printf("%d %d %d %d\n", num, first, second, third); - - num = sscanf("", "%d-%d-%d", &first, &second, &third); - - printf("%s:%d:",__FILE__,__LINE__);printf("%d %d %d %d\n", num, first, second, third); - - num = sscanf("6", "%d %d", &first, &second); - - printf("%s:%d:",__FILE__,__LINE__);printf("%d %d\n", num, first); - - a = b = c = 0; - n = sscanf("","%*d,%d,%d",&a,&b,&c); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %d, b = %d, c = %d\n",n,a,b,c); - - a = b = c = 0; - n = sscanf("1,2,3","%*d,%d,%d",&a,&b,&c); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %d, b = %d, c = %d\n",n,a,b,c); - - a = b = c = 0; - n = sscanf("1,2","%*d,%d,%d",&a,&b,&c); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %d, b = %d, c = %d\n",n,a,b,c); - - a = b = c = 0; - n = sscanf("asdf","*d,d,d",&a,&b,&c); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %d, b = %d, c = %d\n",n,a,b,c); - - memset(str,0,sizeof(str)); - n = sscanf("asdf","%[abc]",str); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, str = '%s'\n",n,str); - - memset(str,0,sizeof(str)); - n = sscanf("asdbbfc","%[abc]",str); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, str = '%s'\n",n,str); - - memset(str,0,sizeof(str)); - n = sscanf("","%[abc]",str); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, str = '%s'\n",n,str); - - memset(str,0,sizeof(str)); - n = sscanf("abcdef","%[abc]",str); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, str = '%s'\n",n,str); - - a = b = c = 0; - n = sscanf("-","%d",&a); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %d\n",n,a); - - a = b = c = 0; - n = sscanf("-4,-","%d,%d",&a,&b); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %d, b = %d\n",n,a,b); - - memset(str,0,sizeof(str)); - n = sscanf("1 abc","%d %4c",&a,str); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %d, str = '%s'\n",n,a,str); - - memset(str,0,sizeof(str)); - n = sscanf("abc","%4c",&a,str); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, str = '%s'\n",n,str); - - a = 0; - n = sscanf("17","%i",&a); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %d\n",n,a); - - a = 0; - n = sscanf("017","%i",&a); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %d\n",n,a); - - a = 0; - n = sscanf("0x17","%i",&a); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %d\n",n,a); - - a = 0; - n = sscanf("0x017","%i",&a); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %d\n",n,a); - - a = 0; - n = sscanf("0x017","%x",&a); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %d\n",n,a); - - a = 0; - n = sscanf("0017","%x",&a); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %d\n",n,a); - - a = 0; - n = sscanf("0x80000000","%i",&a); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, a = %u\n",n,a); - - memset(str,0,sizeof(str)); - n = sscanf("1,e","%*d,%[abc]",str); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, str = '%s'\n",n,str); - - n = sscanf("1","%lf",&f); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, f = '%f' (%f)\n",n,f,atof("1")); - - n = sscanf("1234.567","%lf",&f); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, f = '%f' (%f)\n",n,f,atof("1234.567")); - - n = sscanf("inf","%lf",&f); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, f = '%f' (%f)\n",n,f,atof("inf")); - - n = sscanf("infinity","%lf",&f); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, f = '%f' (%f)\n",n,f,atof("infinity")); - - n = sscanf("nan","%lf",&f); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, f = '%f' (%f)\n",n,f,atof("nan")); - - n = sscanf("nan(23)","%lf",&f); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, f = '%f' (%f)\n",n,f,atof("nan(23)")); - - n = sscanf("0xabc.defp+101","%lf",&f); - printf("%s:%d:",__FILE__,__LINE__);printf("n = %d, f = '%f' (%f)\n",n,f,atof("0xabc.defp+101")); - - return(0); -} diff --git a/test_programs/stack_extension_test.c b/test_programs/stack_extension_test.c deleted file mode 100644 index 589dbb2..0000000 --- a/test_programs/stack_extension_test.c +++ /dev/null @@ -1,31 +0,0 @@ -/* gcc -mstackextend -o stack_extension_test stack_extension_test.c */ - -#include -#include - -void -recursive_function(char *data,int data_size,int level) -{ - char local_data[10000]; - char line[10]; - int c; - - data_size += sizeof(local_data); - level++; - - printf("recursion level=%d, size=%d; continue? ",level,data_size); - - fgets(line,sizeof(line),stdin); - c = toupper(line[0]); - - if(c == 'Y') - recursive_function(local_data,data_size,level); -} - -int -main(int argc,char ** argv) -{ - recursive_function(NULL,0,0); - - return(0); -} diff --git a/test_programs/stack_size_test.c b/test_programs/stack_size_test.c deleted file mode 100644 index eac5df5..0000000 --- a/test_programs/stack_size_test.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -int __stack_size = 60000; - -int -main(void) -{ - int first, second, num; - - num = sscanf("6", "%d %d", &first, &second); - - printf("%d %d\n", num, first); - - return(0); -} diff --git a/test_programs/strtok_test.c b/test_programs/strtok_test.c deleted file mode 100644 index e684a34..0000000 --- a/test_programs/strtok_test.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * $Id: strtok_test.c,v 1.1 2004-10-25 19:50:33 obarthel Exp $ - * - * :ts=4 - */ - -/****************************************************************************/ - -#include -#include - -/****************************************************************************/ - -int -main(int argc,char ** argv) -{ - char test[256]; - char * one; - char * two; - char * three; - - strcpy(test," one two three"); - - strtok(test," "); - - one = strtok(NULL," "); - two = strtok(NULL," "); - three = strtok(NULL," "); - - printf("one = %p '%s'\n",one,one); - printf("two = %p '%s'\n",two,two); - printf("three = %p '%s'\n",three,three); - - return(0); -} diff --git a/test_programs/test.c b/test_programs/test.c deleted file mode 100644 index 0a62c5f..0000000 --- a/test_programs/test.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * $Id: test.c,v 1.5 2005-05-18 07:22:52 obarthel Exp $ - * - * :ts=4 - */ - -/****************************************************************************/ - -#define __USE_INLINE__ -#include - -#include -#include -#include -#include -#include -#include -#include - -/****************************************************************************/ - -/*int __stack_size = 20000;*/ - -/****************************************************************************/ - -#if defined(__GNUC__) - -void __attribute__ ((constructor)) -constructor_test1(void) -{ - fprintf(stderr,"constructor #1 called\n"); -} - -void __attribute__ ((constructor)) -constructor_test2(void) -{ - fprintf(stderr,"constructor #2 called\n"); -} - -void __attribute__ ((destructor)) -destructor_test1(void) -{ - fprintf(stderr,"destructor #1 called\n"); -} - -void __attribute__ ((destructor)) -destructor_test2(void) -{ - fprintf(stderr,"destructor #2 called\n"); -} - -void __attribute__ ((destructor)) -destructor_test3(void) -{ - DebugPrintF("__iob = 0x%08lx\n",__iob); - - fprintf(stderr,"destructor #3 called\n"); -} - -#endif /* __GNUC__ */ - -/****************************************************************************/ - -int foo = 3; -int bar = 9; - -/****************************************************************************/ - -#if 1 -int -main(int argc,char ** argv) -{ - struct timeval tv; - time_t now; - struct tm tm; - int i,j,k; - long n,r; - char time_buffer[100]; - - for(i = 0 ; i < argc ; i++) - printf("%2d) \"%s\"\n",i,argv[i]); - - printf("div %d mod %d\n",foo / 2,bar % 4); - - time(&now); - printf("%s",ctime(&now)); - - tm = (*localtime(&now)); - strftime(time_buffer,sizeof(time_buffer),"%c",&tm); - printf("local time = %s\n",time_buffer); - - tm = (*gmtime(&now)); - strftime(time_buffer,sizeof(time_buffer),"%c",&tm); - printf("gmt = %s\n",time_buffer); - - tm = (*gmtime(&now)); - strftime(time_buffer,sizeof(time_buffer),"%c %U %W %j",&tm); - printf("%s\n",time_buffer); - - tm.tm_year = 105; - tm.tm_mon = 0; - tm.tm_mday = 25; - tm.tm_hour = 12; - tm.tm_min = 3; - tm.tm_sec = 53; - tm.tm_isdst = -1; - - now = mktime(&tm); - - tm = (*localtime(&now)); - strftime(time_buffer,sizeof(time_buffer),"%c",&tm); - printf("2005-01-25 12:03:53 -> local time = %s\n",time_buffer); - - tm = (*gmtime(&now)); - strftime(time_buffer,sizeof(time_buffer),"%c",&tm); - printf("2005-01-25 12:03:53 -> gmt = %s\n",time_buffer); - - #if defined(IEEE_FLOATING_POINT_SUPPORT) || defined(M68881_FLOATING_POINT_SUPPORT) - { - const double pi = 3.14159265358979323846; - const double ten = 10.0; - const double quarter = 0.25; - const double thousand = 1000.0; - const double foo = 4 * atan((double)1); - float f1; - double d1; - - printf("pi=%3.1f (float)\n",pi); - printf("pi=%.21e (exponential)\n",pi); - printf("pi=%g (float/exponential)\n",pi); - - printf("ten=%f (float)\n",ten); - printf("ten=%.21e (exponential)\n",ten); - printf("ten=%g (float/exponential)\n",ten); - - printf("thousand=%f (float)\n",thousand); - printf("thousand=%.21e (exponential)\n",thousand); - printf("thousand=%g (float/exponential)\n",thousand); - - printf("quarter=%f (float)\n",quarter); - printf("quarter=%.21e (exponential)\n",quarter); - printf("quarter=%g (float/exponential)\n",quarter); - - printf("foo=%f (float)\n",foo); - printf("foo=%.21e (exponential)\n",foo); - printf("foo=%g (float/exponential)\n",foo); - - printf("32 bit float = %f\n",4294967295.0); - printf("32+1 bit float = %f\n",-4294967295.0); - printf("big float on the edge = %f\n",4294967296.0); - printf("big float = %f\n",429496729654321.0); - printf("small float = %f\n",-429496729654321.0); - - f1 = d1 = 9; - - r = sscanf("13.24 1.324","%f %lf",&f1,&d1); - printf("r = %ld, f1 = %f, d1 = %f\n",r,f1,d1); - } - #endif - - #ifndef NDEBUG - { - char * allocation; - - allocation = malloc(4); - if(allocation != NULL) - { - strcpy(allocation,"....FOO"); - strcpy(allocation-3,"bar"); - } - } - #endif /* NDEBUG */ - - printf("hex 0x%08x\n",1); - printf("hex 0x%08x\n",1); - printf("hex 0x%08x\n",2); - printf("big int %d\n",0x80000000L); - printf("converted big int %d\n",atoi("-2147483648")); - - r = sscanf("1324","%lx",&n); - printf("r = %ld, n = %ld\n",r,n); - - r = sscanf("1234567890","%4d%3d%3d",&i,&j,&k); - printf("r = %ld, i = %d, j = %d, k = %d\n",r,i,j,k); - - /*#if defined(IEEE_FLOATING_POINT_SUPPORT) || defined(M68881_FLOATING_POINT_SUPPORT) - { - const char *arg = "100x100"; - float xres = 0, yres = 0; - - printf("%d: ", sscanf(arg, "%fx%f", &xres, &yres)); - printf("%.02fx%.02f\n", xres, yres); - } - #endif*/ - - gettimeofday(&tv,0); - printf("time = %d.%06d\n",tv.tv_sec,tv.tv_usec); - - if(argc > 1) - { - DIR * dir; - - dir = opendir(argv[1]); - if(dir != NULL) - { - struct dirent *d; - struct stat st; - - chdir(argv[1]); - - while((d = readdir(dir)) != NULL) - { - if(stat(d->d_name,&st) == 0) - printf("%s%s\n",d->d_name,S_ISDIR(st.st_mode) ? " (dir)" : ""); - } - - closedir(dir); - } - } - - return(0); -} -#endif - -/****************************************************************************/ - -#if 0 - -#define LINEBUFLENGTH 180 - -#define STRIP_LF(str) (str[strlen(str)-1]=0) -void invert_str(char * in) -{ -char t; -while(t=*in) - { - *in++=~t; - } -} - -int main(int i, char *c[]) -{ -char dest_fname[80], in_linebuffer[LINEBUFLENGTH]; -FILE * fileout, * filein; - -if(i>1) - { - sprintf(dest_fname, "%s.c", c[1]); - - fileout=fopen(dest_fname, "w"); - filein =fopen(c[1], "r"); - - if(fileout && filein) - { - fgets(in_linebuffer, LINEBUFLENGTH, filein); - STRIP_LF(in_linebuffer); - invert_str(in_linebuffer); - fputs("char *s_leading=\"", fileout); - fputs(in_linebuffer, fileout); - fputs("\";\n", fileout); - - fputs("char *s_messages[]={\n", fileout); - - while(fgets(in_linebuffer, LINEBUFLENGTH, filein)) - { - STRIP_LF(in_linebuffer); - invert_str(in_linebuffer); - - fputs("\"", fileout); - fputs(in_linebuffer, fileout); - fputs("\",\n", fileout); - } - fputs("};\n", fileout); - fputs("unsigned s_mess_num = sizeof(s_messages)/sizeof(char *);\n", fileout); - fclose(filein); - fclose(fileout); - } - } -return 0; -} - -#endif diff --git a/test_programs/translate_test.c b/test_programs/translate_test.c deleted file mode 100644 index 9bf7c7e..0000000 --- a/test_programs/translate_test.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * $Id: translate_test.c,v 1.1.1.1 2004-07-26 16:36:08 obarthel Exp $ - * - * :ts=4 - */ - -#include -#include -#include -#include - -extern char __current_path_name[]; - -int -main(int argc,char ** argv) -{ - struct name_translation_info nti; - char * name; - int error; - int i; - - /*strcpy(__current_path_name,"/absolute_path_name/whatever");*/ - - for(i = 1 ; i < argc ; i++) - { - name = argv[i]; - - printf("'%s' -> ",name); - - error = __translate_unix_to_amiga_path_name(&name,&nti); - /*error = __translate_amiga_to_unix_path_name(&name,&nti);*/ - if(error == 0) - printf("'%s'\n",name); - else - printf("%s\n",strerror(error)); - } - - return(0); -} diff --git a/test_programs/uname.c b/test_programs/uname.c deleted file mode 100644 index 2b72438..0000000 --- a/test_programs/uname.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: uname.c,v 1.2 2005-03-03 15:12:18 obarthel Exp $ - * - * :ts=4 - */ - -/****************************************************************************/ - -#include -#include -#include -#include - -int main(int cnt,char *arg[]) -{ -struct utsname uinfo; -int Ret=EXIT_SUCCESS; - -if(cnt>1 && (!strcmp(arg[1],"-h") || !strcmp(arg[1],"--help"))) { - printf( - " -a\tPrint all information.\n" - " -m\tPrint the machine type.\n" - " -n\tPrint the node (host) name.\n" - " -r\tPrint the OS release.\n" - " -s\tPrint the OS name.\n" - " -v\tPrint the OS version.\n\n" - " -h or --help displays this message.\n\n" - ); -} else { - if(!uname(&uinfo)) { - if(cnt<2 || !strcmp(arg[1],"-s")) { - printf("%s\n",uinfo.sysname); - } else if(!strcmp(arg[1],"-a")) { - printf("%s %s %s %s %s\n",uinfo.sysname,uinfo.version,uinfo.release,uinfo.nodename,uinfo.machine); - } else if(!strcmp(arg[1],"-m")) { - printf("%s\n",uinfo.machine); - } else if(!strcmp(arg[1],"-n")) { - printf("%s\n",uinfo.nodename); - } else if(!strcmp(arg[1],"-r")) { - printf("%s\n",uinfo.release); - } else if(!strcmp(arg[1],"-v")) { - printf("%s\n",uinfo.version); - } else { - printf("Unknown option \"%s\"!\nTry -h or --help.\n",arg[1]); - Ret=EXIT_FAILURE; - } - } else { - printf("Unknown error!\n"); - } -} - -return(Ret); -} - -/* vi:set ts=3: */ -