From 84e9cb5d68437a68a7968351bec1b7cebd98e94e Mon Sep 17 00:00:00 2001 From: Hagbard Celine <30884074+Hagbard-Celin@users.noreply.github.com> Date: Fri, 20 Jan 2023 21:47:09 +0100 Subject: [PATCH] Quick and dirty compile fix for Amiga 68k. Some files moved from portable/clients to amiga/code/clients do allow for more sane main-library-size. Some files duplicated to same directory to make everything compile. --- Readme.md | 19 + libxad/amiga/X-Systems.TXT.info | Bin 1841 -> 1841 bytes libxad/amiga/docs.info | Bin 2146 -> 2146 bytes .../amiga/include/ASM/libraries/xadmaster.i | 2 - libxad/amiga/include/C/libraries/xadmaster.h | 2 - .../{portable => amiga/source}/clients/AMPK.c | 0 .../{portable => amiga/source}/clients/CAB.c | 0 libxad/amiga/source/clients/ConvertE.c | 92 ++ .../{portable => amiga/source}/clients/DMS.c | 0 .../source}/clients/DiskDoubler.c | 0 .../{portable => amiga/source}/clients/HA.c | 0 .../source}/clients/IFF-CDAF.c | 0 .../{portable => amiga/source}/clients/LZX.c | 0 .../{portable => amiga/source}/clients/LhA.c | 0 .../{portable => amiga/source}/clients/LhF.c | 0 .../{portable => amiga/source}/clients/MDC.c | 0 .../source}/clients/MXM-SimpleArc.c | 0 .../source}/clients/PackDev.c | 0 .../source}/clients/PackDisk.c | 0 .../{portable => amiga/source}/clients/RPM.c | 0 .../source/clients/SDI_ASM_STD_functions.lib | Bin 0 -> 2284 bytes .../amiga/source/clients/SDI_ASM_STD_protos.h | 165 +++ libxad/amiga/source/clients/SDI_compiler.h | 207 ++++ libxad/amiga/source/clients/SMakeFile | 220 +++- .../source}/clients/StuffIt.c | 0 .../source}/clients/TR-DOS.c | 0 .../{portable => amiga/source}/clients/Tar.c | 0 .../{portable => amiga/source}/clients/Zip.c | 0 .../{portable => amiga/source}/clients/Zoom.c | 0 .../source}/clients/bzip2.c | 0 .../source}/clients/xMash.c | 0 libxad/amiga/source/clients/xadCRC_1021.c | 75 ++ libxad/amiga/source/clients/xadClient.h | 133 +++ libxad/amiga/source/clients/xadIO.c | 313 +++++ libxad/amiga/source/clients/xadIO.h | 134 +++ libxad/amiga/source/clients/xadIO_Compress.c | 235 ++++ libxad/amiga/source/clients/xadIO_XPK.c | 153 +++ libxad/amiga/source/clients/xadXPK.c | 131 +++ libxad/needed_assigns | 5 + libxad/portable/amiga/SMakeFile | 36 +- libxad/portable/amiga/libinit.c | 4 +- libxad/portable/clients.c | 23 - libxad/portable/include/functions.h | 262 +++++ libxad/portable/include/xadmaster.h | 1019 +++++++++++++++++ 44 files changed, 3144 insertions(+), 86 deletions(-) create mode 100644 Readme.md rename libxad/{portable => amiga/source}/clients/AMPK.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/CAB.c (100%) create mode 100644 libxad/amiga/source/clients/ConvertE.c rename libxad/{portable => amiga/source}/clients/DMS.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/DiskDoubler.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/HA.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/IFF-CDAF.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/LZX.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/LhA.c (100%) rename libxad/{portable => amiga/source}/clients/LhF.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/MDC.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/MXM-SimpleArc.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/PackDev.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/PackDisk.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/RPM.c (100%) create mode 100644 libxad/amiga/source/clients/SDI_ASM_STD_functions.lib create mode 100644 libxad/amiga/source/clients/SDI_ASM_STD_protos.h create mode 100644 libxad/amiga/source/clients/SDI_compiler.h rename libxad/{portable => amiga/source}/clients/StuffIt.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/TR-DOS.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/Tar.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/Zip.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/Zoom.c (100%) mode change 100755 => 100644 rename libxad/{portable => amiga/source}/clients/bzip2.c (100%) rename libxad/{portable => amiga/source}/clients/xMash.c (100%) mode change 100755 => 100644 create mode 100644 libxad/amiga/source/clients/xadCRC_1021.c create mode 100644 libxad/amiga/source/clients/xadClient.h create mode 100644 libxad/amiga/source/clients/xadIO.c create mode 100644 libxad/amiga/source/clients/xadIO.h create mode 100644 libxad/amiga/source/clients/xadIO_Compress.c create mode 100644 libxad/amiga/source/clients/xadIO_XPK.c create mode 100644 libxad/amiga/source/clients/xadXPK.c create mode 100644 libxad/needed_assigns create mode 100644 libxad/portable/include/functions.h create mode 100644 libxad/portable/include/xadmaster.h diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..3cd1cab --- /dev/null +++ b/Readme.md @@ -0,0 +1,19 @@ +Firstly, I'm not the right person to maintain this. The mathematics of compression is way over my head. +This version exists only because I of my personal need. +And my only criteria for success is that it compiles/runs, and does not fill my serial-log with muForce/PatchWork hits. + +Except making most clients external, to avoid the main library getting un-practically big(in my opinion) for m68k, +the only changes I've don are the absolute minimum required to get it compiling/working on m68k Amiga again. + +The relevant files for compiling are: +libxad/portable/amiga/SMakeFile +libxad/amiga/source/clients/SMakeFile + +See also "libxad/needed_assigns" + +All copyrights belongs to the authors, see respective files for info. + +The binary release contains only the xadmaster.library for 68000-68060 and the clients that goes Libs:xad. +Anything else that might be needed can be collected from the official xadmaster v12.1a release on Aminet. + +-Hagbard Celine diff --git a/libxad/amiga/X-Systems.TXT.info b/libxad/amiga/X-Systems.TXT.info index b03ea9bf7331f92792911fd5f614f3775a8b21e0..3abc3089e827134e6e8b318325f48dc96dff106a 100755 GIT binary patch delta 21 bcmdnUw~=qd4@O3=%|98>GXtrUtQm{|TjmF+ delta 21 bcmdnUw~=qd4@O4b%|98>GXtrUtQm{|TptIm diff --git a/libxad/amiga/docs.info b/libxad/amiga/docs.info index 00465e06cf8867f3c9ee0318b0a9d69746ff1680..9394f71adfe5c01e8524aad2367bf1eba384eee3 100755 GIT binary patch delta 26 gcmaDP@JL`nFeBH-5N9SvuFW%;{xJfn=`5$20eRdAn*aa+ delta 26 gcmaDP@JL`nFeC5A5N9Sv-pw + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* EndGetXXX(a) - returns value read direct from memory in fixed size and + * endianness, returned to native order. + * + * Keep in mind, that the macros require calculation time, so avoid to use + * them double time. Call them once and reuse results. + * + * XXX can be: + * M64 - big-endian Motorola format, 64 bit value + * M32 - big-endian Motorola format, 32 bit value + * M24 - big-endian Motorola format, 24 bit value + * M16 - big-endian Motorola format, 16 bit value + * + * I64 - little-endian Intel format, 64 bit value + * I32 - little-endian Intel format, 32 bit value + * I24 - little-endian Intel format, 24 bit value + * I16 - little-endian Intel format, 16 bit value + */ + +#define EndGetM32(a) (((((unsigned char *) a)[0]) << 24) | \ + ((((unsigned char *) a)[1]) << 16) | \ + ((((unsigned char *) a)[2]) << 8) | \ + ((((unsigned char *) a)[3]))) +#define EndGetM24(a) (((((unsigned char *) a)[0]) << 16) | \ + ((((unsigned char *) a)[1]) << 8) | \ + ((((unsigned char *) a)[2]))) +#define EndGetM16(a) (((((unsigned char *) a)[0]) << 8) | \ + ((((unsigned char *) a)[1]))) + +#define EndGetI32(a) (((((unsigned char *) a)[3]) << 24) | \ + ((((unsigned char *) a)[2]) << 16) | \ + ((((unsigned char *) a)[1]) << 8) | \ + ((((unsigned char *) a)[0]))) +#define EndGetI24(a) (((((unsigned char *) a)[2]) << 16) | \ + ((((unsigned char *) a)[1]) << 8) | \ + ((((unsigned char *) a)[0]))) +#define EndGetI16(a) (((((unsigned char *) a)[1]) << 8) | \ + ((((unsigned char *) a)[0]))) + +/* 64-bit support */ +#define _convM32(a,n)(((((unsigned char *) a)[n+0]) << 24) | \ + ((((unsigned char *) a)[n+1]) << 16) | \ + ((((unsigned char *) a)[n+2]) << 8) | \ + ((((unsigned char *) a)[n+3]))) +#define _convI32(a,n)(((((unsigned char *) a)[n+3]) << 24) | \ + ((((unsigned char *) a)[n+2]) << 16) | \ + ((((unsigned char *) a)[n+1]) << 8) | \ + ((((unsigned char *) a)[n+0]))) + +#if defined(AMIGA) /* AMIGA XAD has not 64 bit types yet */ +# define EndGetI64(a) ((unsigned int) _convi32(a,0)) +# define EndGetM64(a) ((unsigned int) _convm32(a,4)) +#elif defined(HAVE_STDINT_H) +# include + /* C99 -- use "uint64_t" as 64-bit type */ +# define EndGetI64(a) ((((uint64_t) _convi32(a,4)) << 32) | \ + ((unsigned int) _convi32(a,0))) +# define EndGetM64(a) ((((uint64_t) _convm32(a,0)) << 32) | \ + ((unsigned int) _convm32(a,4))) +#else +/* GCC -- use "unsigned long long int" as 64-bit type */ +# define EndGetI64(a) ((((unsigned long long int) _convi32(a,4)) << 32) | \ + ((unsigned int) _convi32(a,0))) +# define EndGetM64(a) ((((unsigned long long int) _convm32(a,0)) << 32) | \ + ((unsigned int) _convm32(a,4))) +#endif + +#endif /* XADMASTER_CONVERTE_C */ diff --git a/libxad/portable/clients/DMS.c b/libxad/amiga/source/clients/DMS.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/DMS.c rename to libxad/amiga/source/clients/DMS.c diff --git a/libxad/portable/clients/DiskDoubler.c b/libxad/amiga/source/clients/DiskDoubler.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/DiskDoubler.c rename to libxad/amiga/source/clients/DiskDoubler.c diff --git a/libxad/portable/clients/HA.c b/libxad/amiga/source/clients/HA.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/HA.c rename to libxad/amiga/source/clients/HA.c diff --git a/libxad/portable/clients/IFF-CDAF.c b/libxad/amiga/source/clients/IFF-CDAF.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/IFF-CDAF.c rename to libxad/amiga/source/clients/IFF-CDAF.c diff --git a/libxad/portable/clients/LZX.c b/libxad/amiga/source/clients/LZX.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/LZX.c rename to libxad/amiga/source/clients/LZX.c diff --git a/libxad/portable/clients/LhA.c b/libxad/amiga/source/clients/LhA.c similarity index 100% rename from libxad/portable/clients/LhA.c rename to libxad/amiga/source/clients/LhA.c diff --git a/libxad/portable/clients/LhF.c b/libxad/amiga/source/clients/LhF.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/LhF.c rename to libxad/amiga/source/clients/LhF.c diff --git a/libxad/portable/clients/MDC.c b/libxad/amiga/source/clients/MDC.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/MDC.c rename to libxad/amiga/source/clients/MDC.c diff --git a/libxad/portable/clients/MXM-SimpleArc.c b/libxad/amiga/source/clients/MXM-SimpleArc.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/MXM-SimpleArc.c rename to libxad/amiga/source/clients/MXM-SimpleArc.c diff --git a/libxad/portable/clients/PackDev.c b/libxad/amiga/source/clients/PackDev.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/PackDev.c rename to libxad/amiga/source/clients/PackDev.c diff --git a/libxad/portable/clients/PackDisk.c b/libxad/amiga/source/clients/PackDisk.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/PackDisk.c rename to libxad/amiga/source/clients/PackDisk.c diff --git a/libxad/portable/clients/RPM.c b/libxad/amiga/source/clients/RPM.c similarity index 100% rename from libxad/portable/clients/RPM.c rename to libxad/amiga/source/clients/RPM.c diff --git a/libxad/amiga/source/clients/SDI_ASM_STD_functions.lib b/libxad/amiga/source/clients/SDI_ASM_STD_functions.lib new file mode 100644 index 0000000000000000000000000000000000000000..0a82f6723c735e6de3bec1c85619c9b529dc2e2f GIT binary patch literal 2284 zcmb7FO=}ZD7=E+a=F3phG}J`Wu#^&{R0&?B&_lnpF@!{#gV0M8YO)PvH%mUM?Liws zdhIXp7f7jk@=|i}DAJ>cVv3j8ixH7hMUC&w?(8OJ)9Ap?&d$8^JkR^FGXT~m&}RLF zFKcS)&RV7*S0(u3!p~Eja~;e=L<(X*Q}kn>k@&q?5O6dv*|1+Natb7>1jO31V7Ep< z@?{lrd>-*5RP_u~-KCis55QDPd0EFC zLd?ga%drDQy-?7i(S^%448W}_O19Lg^{)tbVKU(t#h{i=; z=J}MeQaM`zRy%yGCOT5J(H%dezxC9JW^90(W76Q|bWB^c33Z_e?!^{(60gbbc*9C7 z(Auh@FsgY|+Xa9n3B!6_>eGzXoU^Rksdb5*cf-huydLEBFhZK16lh`A&U*uQj z(&xRnWP{QA;>zoif@U;M?r2j0rLAEHU#T2E1$+UIe~*iCq#8s%2IA*<1NdG}4NRlG zfK%CGoI`>`92T6S3v11ms(Ih%&dhM>hJmJ0V8)8)&Q=F5Zvo`9NtA9(!gsLQhx z<{8OT4Le$om13dzfd1SZiU{Kq#JW&x26HH@#F{?x>gziq>3MW2py~3uN8nm+c<~f0 zs-~r#L^bhU1?_TV@oUB`Y#zKS!EL#`l9b8qX}E62MbE;{$F9-WIW$Ch)h z01rEwb)Id?W89o4l;^ihZ&DK;25=#dal}y`Kb}!HZvB8zveo_=PA-g2lV1c9 z`@hbTEeORMaXddt;2piZDO7j Wv4r}^>T2#yI9({l> + #include + #include + #include +#else + +#include "SDI_compiler.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ASM(signed char) SDI_strnicmp( REG(a0,const char *), /* string 1 */ + REG(a1,const char *), /* string 2 */ + REG(d1,unsigned long)); /* highest testlength */ +ASM(signed char) SDI_strncmp( REG(a0,const char *), /* string 1 */ + REG(a1,const char *), /* string 2 */ + REG(d1,unsigned long)); /* highest testlength */ +ASM(char) SDI_tolower( REG(d0,char)); /* character to convert */ +ASM(char) SDI_toupper( REG(d0,char)); /* character to convert */ +ASM(unsigned long) SDI_strlen( REG(a0,const char *)); /* string */ +ASM(long) SDI_isprint( REG(d0,unsigned char)); /* character to test */ +ASM(long) SDI_isdigit( REG(d0,unsigned char)); /* character to test */ +ASM(long) SDI_isxdigit( REG(d0,unsigned char)); /* character to test */ +ASM(long) SDI_isalnum( REG(d0,unsigned char)); /* character to test */ +ASM(long) SDI_isalpha( REG(d0,unsigned char)); /* character to test */ +ASM(long) SDI_isupper( REG(d0,unsigned char)); /* character to test */ +ASM(unsigned long) SDI_strtoul(REG(a1,const char *), /* buffer */ + REG(a0,char **), /* char var for error position */ + REG(d2,unsigned char)); /* base */ +ASM(long) SDI_strtol( REG(a1,const char *), /* buffer */ + REG(a0,char **), /* char var for error position */ + REG(d2,unsigned char)); /* base */ +ASM(char *) SDI_strncpy( REG(a1,char *), /* string 1 */ + REG(a0,const char *), /* string 2 */ + REG(d1,unsigned long)); /* highest copy number */ +ASM(void) SDI_memset( REG(a1,void *), /* buffer */ + REG(d0,unsigned char), /* fill character */ + REG(d1,unsigned long)); /* number of bytes */ +ASM(char *) SDI_strchr( REG(a1,const char *), /* buffer */ + REG(d0,char)); /* character to scan for */ +ASM(void) SDI_vsprintf( REG(a3,char *), /* buffer */ + REG(a0,const char *), /* formatstring */ + REG(a1,void *)); /* data */ +ASM(void) SDI_vprintf( REG(a0,const char *), /* formatstring */ + REG(a1,void *)); /* data */ +void SDI_sprintf(char *, const char *, ...); /* buffer, formatstring, data */ +void SDI_printf(const char *, ...); /* formatstring, data */ + +#ifdef __cplusplus +} +#endif + +#define SDI_stricmp(a,b) SDI_strnicmp(a,b,~0) +#define SDI_strcmp(a,b) SDI_strncmp(a,b,~0) +#define SDI_strcpy(a,b) SDI_strncpy(a,b,~0) +#define SDI_strcat(a,b) SDI_strncpy(a+SDI_strlen(a),b,~0) +#define SDI_strncat(a,b,c) SDI_strncpy((a)+SDI_strlen(a),b,c) + +/* Set SDI_TO_ANSI if you want to use normal ANSI names. Do not include +the ANSI files stdio.h / stdlib.h ... , because this may result in an error */ + +#ifdef SDI_TO_ANSI + #define strnicmp SDI_strnicmp + #define strncmp SDI_strncmp + #define stricmp SDI_stricmp + #define strcmp SDI_strcmp + #define tolower SDI_tolower + #define toupper SDI_toupper + #define strlen SDI_strlen + #define isprint SDI_isprint + #define isdigit SDI_isdigit + #define isxdigit SDI_isxdigit + #define isalnum SDI_isalnum + #define isalpha SDI_isalpha + #define isupper SDI_isupper + #define strtoul SDI_strtoul + #define strtol SDI_strtol + #define strncat SDI_strncat + #define strncpy SDI_strncpy + #define strcat SDI_strcat + #define strcpy SDI_strcpy + #define strchr SDI_strchr + #define memset SDI_memset + #define sprintf SDI_sprintf + #define printf SDI_printf + #define vsprintf SDI_vsprintf + #define vprintf SDI_vprintf + + extern void exit(int); + typedef unsigned long size_t; +#endif + +/* Use the following with care, as they may collide with ANSI-C Standard + a lot more, than the above ones. The FILE * parameter of the functions + is converted into a filehandle of dos.library. Do not mix normal ANSI-C + and these functions! */ + +/* These defines are in experimental state !!! */ + +#ifdef AMIGA_TO_ANSI + #define memcpy(a,b,c) CopyMem(b,a,c) + #define remove(a) !DeleteFile(a) + #define rename(a,b) !Rename(a,b) + #define putchar(a) FPutC(Output(),a) + #define putc(a, b) FPutC((BPTR) b, a) + #define getchar() FGetC(Input()) + #define getc(a) FGetC((BPTR) a) + #define ungetc(a,b) UnGetC((BPTR) b,a) + #define vprintf(a,b) VPrintf(a,b) + #define vfprintf(a,b,c) VFPrintf((BPTR) a, b, c) + #define fclose(a) Close(a) +#endif + +#endif /* SDI_TO_ANSI && __GNUC__ */ +#endif /* SDI_ASM_STD_PROTOS_H */ diff --git a/libxad/amiga/source/clients/SDI_compiler.h b/libxad/amiga/source/clients/SDI_compiler.h new file mode 100644 index 0000000..a57e3ea --- /dev/null +++ b/libxad/amiga/source/clients/SDI_compiler.h @@ -0,0 +1,207 @@ +#ifndef SDI_COMPILER_H +#define SDI_COMPILER_H + +/* Includeheader + + Name: SDI_compiler.h + Versionstring: $VER: SDI_compiler.h 1.13 (23.05.2004) + Author: SDI + Distribution: PD + Description: defines to hide compiler stuff + + 1.1 25.06.98 : created from data made by Gunter Nikl + 1.2 17.11.99 : added VBCC + 1.3 29.02.00 : fixed VBCC REG define + 1.4 30.03.00 : fixed SAVEDS for VBCC + 1.5 29.07.00 : added #undef statements (needed e.g. for AmiTCP together + with vbcc) + 1.6 19.05.01 : added STACKEXT and Dice stuff + 1.7 16.06.02 : added MorphOS specials and VARARGS68K + 1.8 21.09.02 : added MorphOS register stuff + 1.9 26.09.02 : added OFFSET macro. Thanks Frank Wille for suggestion + 1.10 18.10.02 : reverted to old MorphOS-method for GCC + 1.11 09.11.02 : added REGARGS define to MorphOS section + 1.12 21.01.04 : added SDI_MORPHOSNOREG define to change behaviour + 1.13 23.05.04 : added machine definitions +*/ + +/* Define SDI_MORPHOSNOREG in your makefile to switch register based functions + to normal C-Style functions as it is default for PPC. */ + +/* +** This is PD (Public Domain). This means you can do with it whatever you want +** without any restrictions. I only ask you to tell me improvements, so I may +** fix the main line of this files as well. +** +** To keep confusion level low: When changing this file, please note it in +** above history list and indicate that the change was not made by myself +** (e.g. add your name or nick name). +** +** Dirk Stöcker +*/ + +#ifdef ASM +#undef ASM +#endif +#ifdef REG +#undef REG +#endif +#ifdef LREG +#undef LREG +#endif +#ifdef CONST +#undef CONST +#endif +#ifdef SAVEDS +#undef SAVEDS +#endif +#ifdef INLINE +#undef INLINE +#endif +#ifdef REGARGS +#undef REGARGS +#endif +#ifdef STDARGS +#undef STDARGS +#endif +#ifdef OFFSET +#undef OFFSET +#endif + +/* first "exceptions" */ + +#if defined(__MAXON__) + #define STDARGS + #define STACKEXT + #define REGARGS + #define SAVEDS + #define INLINE inline +#elif defined(__VBCC__) + #define STDARGS + #define STACKEXT + #define REGARGS + #define INLINE + #define OFFSET(p,m) __offsetof(struct p,m) + #if defined(__MORPHOS__) + #define REG(reg,arg) __reg(MOS__##reg) arg + + /* NOTE: This assumes "quick native mode" when compiling libraries. */ + #define MOS__a0 "r24" + #define MOS__a1 "r25" + #define MOS__a2 "r26" + #define MOS__a3 "r27" + #define MOS__a4 "r28" + #define MOS__a5 "r29" + #define MOS__a6 "r30" + /* #define MOS__a7 "r31" */ + #define MOS__d0 "r16" + #define MOS__d1 "r17" + #define MOS__d2 "r18" + #define MOS__d3 "r19" + #define MOS__d4 "r20" + #define MOS__d5 "r21" + #define MOS__d6 "r22" + #define MOS__d7 "r23" + + #else + #define REG(reg,arg) __reg(#reg) arg + #endif +#elif defined(__STORM__) + #define STDARGS + #define STACKEXT + #define REGARGS + #define INLINE inline +#elif defined(__SASC) + #define ASM(arg) arg __asm +#elif defined(__GNUC__) + + #if defined(__amigaos4__) + #define REG(reg,arg) arg + #define ASM(arg) arg + #else + #define REG(reg,arg) arg __asm(#reg) + #define LREG(reg,arg) register REG(reg,arg) + #endif + + /* Don`t use __stackext for the MorphOS version + because we anyway don`t have a libnix ppc with stackext + Also we define a VARARGS68K define here to specify + functions that should work with that special attribute + of the MOS gcc compiler for varargs68k handling. */ + #if defined(__MORPHOS__) + #define STDARGS + #define STACKEXT + #define REGARGS + #define VARARGS68K __attribute__((varargs68k)) + #endif +#elif defined(_DCC) + #define REG(reg,arg) __##reg arg + #define STACKEXT __stkcheck + #define STDARGS __stkargs + #define INLINE static +#endif + +/* then "common" ones */ +#if defined(__MORPHOS__) && defined(SDI_MORPHOSNOREG) + #ifdef REG + #undef REG + #endif + #define REG(reg,arg) arg +#endif + +#if !defined(ASM) + #define ASM(arg) arg +#endif +#if !defined(REG) + #define REG(reg,arg) register __##reg arg +#endif +#if !defined(LREG) + #define LREG(reg,arg) register arg +#endif +#if !defined(CONST) + #define CONST const +#endif +#if !defined(SAVEDS) + #define SAVEDS __saveds +#endif +#if !defined(INLINE) + #define INLINE static __inline +#endif +#if !defined(REGARGS) + #define REGARGS __regargs +#endif +#if !defined(STDARGS) + #define STDARGS __stdargs +#endif +#if !defined(STACKEXT) + #define STACKEXT __stackext +#endif +#if !defined(VARARGS68K) + #define VARARGS68K +#endif +#if !defined(OFFSET) + #define OFFSET(structName, structEntry) \ + ((char *)(&(((struct structName *)0)->structEntry))-(char *)0) +#endif + +#if defined(__GNUC__) || defined(__VBCC__) + #if !defined(__mc68060) && !defined(__M68060) + #if !defined(__mc68040) && !defined(__M68040) + #if !defined(__mc68030) && !defined(__mc68020) \ + && !defined(__M68030) && !defined(__M68020) + #define _M68000 + #else + #define _M68020 + #endif + #else + #define _M68040 + #endif + #else + #define _M68060 + #endif + #if defined(__HAVE_68881__) || defined(__M68881) || defined(__M68882) + #define _M68881 + #endif +#endif + +#endif /* SDI_COMPILER_H */ diff --git a/libxad/amiga/source/clients/SMakeFile b/libxad/amiga/source/clients/SMakeFile index 01e2271..26bc414 100644 --- a/libxad/amiga/source/clients/SMakeFile +++ b/libxad/amiga/source/clients/SMakeFile @@ -23,7 +23,7 @@ SCOPTS = RESOPT NOSTACKCHECK STRINGMERGE UNSIGNEDCHARS\ NOCHECKABORT NOICONS MEMSIZE=HUGE DATA=FARONLY\ PARAM=REGISTERS DEFINE=__NOLIBBASE__ $(OPT) -ODIR = //obj/clients/ +ODIR = /////Build/Clients/ HEAD = $(ODIR)extheader.o SLOPTS = STRIPDEBUG SMALLDATA SMALLCODE NOICONS FROM $(HEAD) @@ -40,21 +40,25 @@ FARLIB = LIB:scnb.lib # # ************* +DEF: AMPK ar bzip bzip2 CAB COP DiskDoubler DMS \ + HA id IFF-CDAF LhA LhF LZX MDC MS-TNEF MXM-SimpleArc \ + PackDev PackDir PackDisk RPM StuffIt Tar TR-DOS \ + UnrealUMX Wrapster xMash ZAP Zip Zoom EXTERN: HA TR-DOS EXTERN.060: HA.060 TR-DOS.060 EXTERN.020: HA.020 TR-DOS.020 -ALL: Ace AMPK Cpio CrunchDisk DCS DiskDoubler DMS IFF-CDAF FS_Amiga \ +ALL: Ace AMPK Cpio CrunchDisk DCS DImp DiskDoubler DMS IFF-CDAF FS_Amiga \ FS_FAT FS_SOS HA LhA LhF LZX MDC MXM-SimpleArc \ PackDev PackDisk StuffIt SuperDuper3 Tar TR-DOS xDisk xMash \ Zip Zoom DEPXPK = xadXPK.c -DEPSPR = xadSPrintF.c +#DEPSPR = xadSPrintF.c DEPINP = xadIO.c xadIO.h DEPCON = ConvertE.c -DEPCPU = xadCPU.h +#DEPCPU = xadCPU.h Flush: Tools:AntiVirus/Schutz/VT.Utilities/VTFlush2 @@ -70,23 +74,34 @@ InstallEXTERN: EXTERN.060 Flush InstallAll: InstallEXTERN InstallOTHERS Install -HA: HA.000 HA.020 HA.060 +HA: HA.000 HA.020 HA.030 HA.040 HA.060 HA.000: $(ODIR)HA.000 HA.020: $(ODIR)HA.020 +HA.030: $(ODIR)HA.030 +HA.040: $(ODIR)HA.040 HA.060: $(ODIR)HA.060 -TR-DOS: TR-DOS.000 TR-DOS.020 TR-DOS.060 +TR-DOS: TR-DOS.000 TR-DOS.020 TR-DOS.030 TR-DOS.040 TR-DOS.060 TR-DOS.000: $(ODIR)TR-DOS.000 TR-DOS.020: $(ODIR)TR-DOS.020 +TR-DOS.030: $(ODIR)TR-DOS.030 +TR-DOS.040: $(ODIR)TR-DOS.040 TR-DOS.060: $(ODIR)TR-DOS.060 Ace: $(ODIR)Ace AMPK: $(ODIR)AMPK +ar: $(ODIR)ar +bzip: $(ODIR)bzip +bzip2: $(ODIR)bzip2 +CAB: $(ODIR)CAB +COP: $(ODIR)COP Cpio: $(ODIR)Cpio CrunchDisk: $(ODIR)CrunchDisk DCS: $(ODIR)DCS +DImp: $(ODIR)DImp DiskDoubler: $(ODIR)DiskDoubler DMS: $(ODIR)DMS +id: $(ODIR)id IFF-CDAF: $(ODIR)IFF-CDAF FS_Amiga: $(ODIR)FS_Amiga FS_FAT: $(ODIR)FS_FAT @@ -95,14 +110,21 @@ LhA: $(ODIR)LhA LhF: $(ODIR)LhF LZX: $(ODIR)LZX MDC: $(ODIR)MDC +MS-TNEF: $(ODIR)MS-TNEF +MSA: $(ODIR)MSA MXM-SimpleArc: $(ODIR)MXM-SimpleArc PackDev: $(ODIR)PackDev PackDisk: $(ODIR)PackDisk +PackDir: $(ODIR)PackDir +RPM: $(ODIR)RPM StuffIt: $(ODIR)StuffIt SuperDuper3: $(ODIR)SuperDuper3 Tar: $(ODIR)Tar +UnrealUMX: $(ODIR)UnrealUMX +Wrapster: $(ODIR)Wrapster xDisk: $(ODIR)xDisk xMash: $(ODIR)xMash +ZAP: $(ODIR)ZAP Zip: $(ODIR)Zip Zoom: $(ODIR)Zoom @@ -127,6 +149,46 @@ $(ODIR)AMPK: $(HEAD) $(ODIR)AMPK.o $(ODIR)AMPK.o: AMPK.c $(DEPXPK) $(DEPINP) $(DEPCON) xadIO_Compress.c sc $(SCOPTS) AMPK.c OBJNAME=$@ +# ************* ar + +$(ODIR)ar: $(HEAD) $(ODIR)ar.o + slink $(SLOPTS) $(ODIR)ar.o TO $@ LIB $(FARLIB) # $(SDILIB) + +$(ODIR)ar.o: ar.c $(DEPCON) + sc $(SCOPTS) ar.c OBJNAME=$@ + +# ************* bzip + +$(ODIR)bzip: $(HEAD) $(ODIR)bzip.o + slink $(SLOPTS) $(ODIR)bzip.o TO $@ LIB $(FARLIB) # $(SDILIB) + +$(ODIR)bzip.o: bzip.c + sc $(SCOPTS) bzip.c OBJNAME=$@ + +# ************* bzip2 + +$(ODIR)bzip2: $(HEAD) $(ODIR)bzip2.o + slink $(SLOPTS) $(ODIR)bzip2.o TO $@ LIB $(FARLIB) # $(SDILIB) + +$(ODIR)bzip2.o: bzip2.c # $(DEPCON) + sc $(SCOPTS) bzip2.c OBJNAME=$@ + +# ************* CAB + +$(ODIR)CAB: $(HEAD) $(ODIR)CAB.o + slink $(SLOPTS) $(ODIR)CAB.o TO $@ LIB $(FARLIB) $(SDILIB) + +$(ODIR)CAB.o: CAB.c + sc $(SCOPTS) CAB.c OBJNAME=$@ + +# ************* COP + +$(ODIR)COP: $(HEAD) $(ODIR)COP.o + slink $(SLOPTS) $(ODIR)COP.o TO $@ LIB $(FARLIB) + +$(ODIR)COP.o: COP.c + sc $(SCOPTS) COP.c OBJNAME=$@ + # ************* Cpio $(ODIR)Cpio: $(HEAD) $(ODIR)Cpio.o @@ -151,10 +213,18 @@ $(ODIR)DCS: $(HEAD) $(ODIR)DCS.o $(ODIR)DCS.o: DCS.c $(DEPCON) sc $(SCOPTS) DCS.c OBJNAME=$@ +# ************* DImp + +$(XADIR)DImp: $(HEAD) $(ODIR)DImp.o + slink $(SLOPTS) $(ODIR)DImp.o TO $@ LIB $(FARLIB) + +$(ODIR)DImp.o: DImp.c $(DEPCON) + sc $(SCOPTS) DImp.c OBJNAME=$@ + # ************* DiskDoubler $(ODIR)DiskDoubler: $(HEAD) $(ODIR)DiskDoubler.o - slink $(SLOPTS) $(ODIR)DiskDoubler.o TO $@ LIB $(SDILIB) + slink $(SLOPTS) $(ODIR)DiskDoubler.o TO $@ LIB $(SDILIB) $(FARLIB) $(ODIR)DiskDoubler.o: DiskDoubler.c $(DEPCON) sc $(SCOPTS) DiskDoubler.c OBJNAME=$@ @@ -167,6 +237,14 @@ $(ODIR)DMS: $(HEAD) $(ODIR)DMS.o $(ODIR)DMS.o: DMS.c $(DEPCON) sc $(SCOPTS) DMS.c OBJNAME=$@ +# ************* id + +$(ODIR)id: $(HEAD) $(ODIR)id.o + slink $(SLOPTS) $(ODIR)id.o TO $@ LIB $(FARLIB) + +$(ODIR)id.o: id.c $(DEPXPK) $(DEPCON) + sc $(SCOPTS) id.c OBJNAME=$@ + # ************* FS_Amiga $(ODIR)FS_Amiga: $(HEAD) $(ODIR)FS_Amiga.o @@ -202,7 +280,7 @@ $(ODIR)IFF-CDAF.o: IFF-CDAF.c $(DEPXPK) $(DEPCON) # ************* LhA $(ODIR)LhA: $(HEAD) $(ODIR)LhA.o - slink $(SLOPTS) $(ODIR)LhA.o TO $@ LIB $(SDILIB) + slink $(SLOPTS) $(ODIR)LhA.o TO $@ LIB $(SDILIB) $(FARLIB) $(ODIR)LhA.o: LhA.c $(DEPCON) $(DEPINP) sc $(SCOPTS) LhA.c OBJNAME=$@ @@ -223,14 +301,6 @@ $(ODIR)LZX: $(HEAD) $(ODIR)LZX.o $(ODIR)LZX.o: LZX.c $(DEPCON) $(DEPCPU) sc $(SCOPTS) LZX.c OBJNAME=$@ -# ************* MXM-SimpleArc - -$(ODIR)MXM-SimpleArc: $(HEAD) $(ODIR)MXM-SimpleArc.o - slink $(SLOPTS) $(ODIR)MXM-SimpleArc.o TO $@ LIB $(SDILIB) - -$(ODIR)MXM-SimpleArc.o: MXM-SimpleArc.c - sc $(SCOPTS) MXM-SimpleArc.c OBJNAME=$@ - # ************* MDC $(ODIR)MDC: $(HEAD) $(ODIR)MDC.o @@ -239,6 +309,30 @@ $(ODIR)MDC: $(HEAD) $(ODIR)MDC.o $(ODIR)MDC.o: MDC.c $(DEPXPK) sc $(SCOPTS) MDC.c OBJNAME=$@ +# ************* MS-TNEF + +$(ODIR)MS-TNEF: $(HEAD) $(ODIR)MS-TNEF.o + slink $(SLOPTS) $(ODIR)MS-TNEF.o TO $@ LIB $(FARLIB) + +$(ODIR)MS-TNEF.o: MS-TNEF.c $(DEPCON) # $(DEPCPU) + sc $(SCOPTS) MS-TNEF.c OBJNAME=$@ + +# ************* MSA + +$(ODIR)MSA: $(HEAD) $(ODIR)MSA.o + slink $(SLOPTS) $(ODIR)MSA.o TO $@ LIB $(FARLIB) + +$(ODIR)MSA.o: MSA.c $(DEPCON) # $(DEPCPU) + sc $(SCOPTS) MSA.c OBJNAME=$@ + +# ************* MXM-SimpleArc + +$(ODIR)MXM-SimpleArc: $(HEAD) $(ODIR)MXM-SimpleArc.o + slink $(SLOPTS) $(ODIR)MXM-SimpleArc.o TO $@ LIB $(SDILIB) + +$(ODIR)MXM-SimpleArc.o: MXM-SimpleArc.c + sc $(SCOPTS) MXM-SimpleArc.c OBJNAME=$@ + # ************* PackDev $(ODIR)PackDev: $(HEAD) $(ODIR)PackDev.o @@ -247,14 +341,30 @@ $(ODIR)PackDev: $(HEAD) $(ODIR)PackDev.o $(ODIR)PackDev.o: PackDev.c $(DEPXPK) $(DEPCON) sc $(SCOPTS) PackDev.c OBJNAME=$@ +# ************* PackDir + +$(ODIR)PackDir: $(HEAD) $(ODIR)PackDir.o + slink $(SLOPTS) $(ODIR)PackDir.o TO $@ LIB $(FARLIB) $(SDILIB) + +$(ODIR)PackDir.o: PackDir.c $(DEPXPK) $(DEPCON) + sc $(SCOPTS) PackDir.c OBJNAME=$@ + # ************* PackDisk $(ODIR)PackDisk: $(HEAD) $(ODIR)PackDisk.o - slink $(SLOPTS) $(ODIR)PackDisk.o TO $@ + slink $(SLOPTS) $(ODIR)PackDisk.o TO $@ LIB $(FARLIB) $(ODIR)PackDisk.o: PackDisk.c $(DEPXPK) $(DEPCON) sc $(SCOPTS) PackDisk.c OBJNAME=$@ +# ************* RPM + +$(ODIR)RPM: $(HEAD) $(ODIR)RPM.o + slink $(SLOPTS) $(ODIR)RPM.o TO $@ LIB $(FARLIB) $(SDILIB) + +$(ODIR)RPM.o: RPM.c $(DEPXPK) $(DEPCON) + sc $(SCOPTS) RPM.c OBJNAME=$@ + # ************* StuffIt $(ODIR)StuffIt: $(HEAD) $(ODIR)StuffIt.o @@ -266,9 +376,9 @@ $(ODIR)StuffIt.o: StuffIt.c $(DEPCON) $(DEPINP) xadCRC_1021.c xadIO_Compress.c # ************* SuperDuper3 $(ODIR)SuperDuper3: $(HEAD) $(ODIR)SuperDuper3.o - slink $(SLOPTS) $(ODIR)SuperDuper3.o TO $@ + slink $(SLOPTS) $(ODIR)SuperDuper3.o TO $@ LIB $(SDILIB) $(FARLIB) -$(ODIR)SuperDuper3.o: SuperDuper3.c $(DEPXPK) +$(ODIR)SuperDuper3.o: SuperDuper3.c $(DEPXPK) $(DEPINP) $(DEPCON) xadIO_Compress.c sc $(SCOPTS) SuperDuper3.c OBJNAME=$@ # ************* Tar @@ -279,6 +389,22 @@ $(ODIR)Tar: $(HEAD) $(ODIR)Tar.o $(ODIR)Tar.o: Tar.c sc $(SCOPTS) Tar.c OBJNAME=$@ +# ************* UnrealUMX + +$(ODIR)UnrealUMX: $(HEAD) $(ODIR)UnrealUMX.o + slink $(SLOPTS) $(ODIR)UnrealUMX.o TO $@ LIB $(FARLIB) + +$(ODIR)UnrealUMX.o: UnrealUMX.c $(DEPXPK) + sc $(SCOPTS) UnrealUMX.c OBJNAME=$@ + +# ************* Wrapster + +$(ODIR)Wrapster: $(HEAD) $(ODIR)Wrapster.o + slink $(SLOPTS) $(ODIR)Wrapster.o TO $@ LIB $(FARLIB) + +$(ODIR)Wrapster.o: Wrapster.c $(DEPXPK) + sc $(SCOPTS) Wrapster.c OBJNAME=$@ + # ************* xDisk $(ODIR)xDisk: $(HEAD) $(ODIR)xDisk.o @@ -295,20 +421,28 @@ $(ODIR)xMash: $(HEAD) $(ODIR)xMash.o $(ODIR)xMash.o: xMash.c $(DEPXPK) sc $(SCOPTS) xMash.c OBJNAME=$@ +# ************* ZAP + +$(ODIR)ZAP: $(HEAD) $(ODIR)ZAP.o + slink $(SLOPTS) $(ODIR)ZAP.o TO $@ LIB $(FARLIB) + +$(ODIR)ZAP.o: ZAP.c $(DEPXPK) + sc $(SCOPTS) ZAP.c OBJNAME=$@ + # ************* Zip $(ODIR)Zip: $(HEAD) $(ODIR)Zip.o slink $(SLOPTS) $(ODIR)Zip.o TO $@ LIB $(FARLIB) $(SDILIB) -$(ODIR)Zip.o: Zip.c $(DEPCON) $(DEPSPR) +$(ODIR)Zip.o: Zip.c $(DEPCON) # $(DEPSPR) sc $(SCOPTS) Zip.c OBJNAME=$@ # ************* Zoom $(ODIR)Zoom: $(HEAD) $(ODIR)Zoom.o - slink $(SLOPTS) $(ODIR)Zoom.o TO $@ LIB $(FARLIB) + slink $(SLOPTS) $(ODIR)Zoom.o TO $@ LIB $(FARLIB) $(SDILIB) -$(ODIR)Zoom.o: Zoom.c $(DEPSPR) xadCRC_1021.c +$(ODIR)Zoom.o: Zoom.c xadCRC_1021.c sc $(SCOPTS) Zoom.c OBJNAME=$@ @@ -319,38 +453,62 @@ $(ODIR)Zoom.o: Zoom.c $(DEPSPR) xadCRC_1021.c $(ODIR)HA.000: $(HEAD) $(ODIR)HA.000.o slink $(SLOPTS) $(ODIR)HA.000.o TO $@ LIB $(FARLIB) -$(ODIR)HA.000.o: HA.c $(DEPCON) $(DEPCPU) +$(ODIR)HA.000.o: HA.c $(DEPCON) #$(DEPCPU) sc $(SCOPTS) HA.c OBJNAME=$@ $(ODIR)HA.020: $(HEAD) $(ODIR)HA.020.o slink $(SLOPTS) $(ODIR)HA.020.o TO $@ -$(ODIR)HA.020.o: HA.c $(DEPCON) $(DEPCPU) +$(ODIR)HA.020.o: HA.c $(DEPCON) #$(DEPCPU) sc $(SCOPTS) HA.c OBJNAME=$@ CPU=68020 +$(ODIR)HA.030: $(HEAD) $(ODIR)HA.030.o + slink $(SLOPTS) $(ODIR)HA.030.o TO $@ + +$(ODIR)HA.030.o: HA.c $(DEPCON) #$(DEPCPU) + sc $(SCOPTS) HA.c OBJNAME=$@ CPU=68030 + +$(ODIR)HA.040: $(HEAD) $(ODIR)HA.040.o + slink $(SLOPTS) $(ODIR)HA.040.o TO $@ + +$(ODIR)HA.040.o: HA.c $(DEPCON) #$(DEPCPU) + sc $(SCOPTS) HA.c OBJNAME=$@ CPU=68040 + $(ODIR)HA.060: $(HEAD) $(ODIR)HA.060.o slink $(SLOPTS) $(ODIR)HA.060.o TO $@ -$(ODIR)HA.060.o: HA.c $(DEPCON) $(DEPCPU) +$(ODIR)HA.060.o: HA.c $(DEPCON) #$(DEPCPU) sc $(SCOPTS) HA.c OBJNAME=$@ CPU=68060 # ************* TR-DOS $(ODIR)TR-DOS.000: $(HEAD) $(ODIR)TR-DOS.000.o - slink $(SLOPTS) $(ODIR)TR-DOS.000.o TO $@ + slink $(SLOPTS) $(ODIR)TR-DOS.000.o TO $@ LIB $(SDILIB) $(FARLIB) -$(ODIR)TR-DOS.000.o: TR-DOS.c $(DEPCON) $(DEPCPU) $(DEPSPR) +$(ODIR)TR-DOS.000.o: TR-DOS.c $(DEPCON) #$(DEPCPU) $(DEPSPR) sc $(SCOPTS) TR-DOS.c OBJNAME=$@ $(ODIR)TR-DOS.020: $(HEAD) $(ODIR)TR-DOS.020.o - slink $(SLOPTS) $(ODIR)TR-DOS.020.o TO $@ + slink $(SLOPTS) $(ODIR)TR-DOS.020.o TO $@ LIB $(SDILIB) $(FARLIB) -$(ODIR)TR-DOS.020.o: TR-DOS.c $(DEPCON) $(DEPCPU) $(DEPSPR) +$(ODIR)TR-DOS.020.o: TR-DOS.c $(DEPCON) #$(DEPCPU) $(DEPSPR) sc $(SCOPTS) TR-DOS.c OBJNAME=$@ CPU=68020 +$(ODIR)TR-DOS.030: $(HEAD) $(ODIR)TR-DOS.030.o + slink $(SLOPTS) $(ODIR)TR-DOS.030.o TO $@ LIB $(SDILIB) $(FARLIB) + +$(ODIR)TR-DOS.030.o: TR-DOS.c $(DEPCON) #$(DEPCPU) $(DEPSPR) + sc $(SCOPTS) TR-DOS.c OBJNAME=$@ CPU=68030 + +$(ODIR)TR-DOS.040: $(HEAD) $(ODIR)TR-DOS.040.o + slink $(SLOPTS) $(ODIR)TR-DOS.040.o TO $@ LIB $(SDILIB) $(FARLIB) + +$(ODIR)TR-DOS.040.o: TR-DOS.c $(DEPCON) #$(DEPCPU) $(DEPSPR) + sc $(SCOPTS) TR-DOS.c OBJNAME=$@ CPU=68040 + $(ODIR)TR-DOS.060: $(HEAD) $(ODIR)TR-DOS.060.o - slink $(SLOPTS) $(ODIR)TR-DOS.060.o TO $@ + slink $(SLOPTS) $(ODIR)TR-DOS.060.o TO $@ LIB $(SDILIB) $(FARLIB) -$(ODIR)TR-DOS.060.o: TR-DOS.c $(DEPCON) $(DEPCPU) $(DEPSPR) +$(ODIR)TR-DOS.060.o: TR-DOS.c $(DEPCON) #$(DEPCPU) $(DEPSPR) sc $(SCOPTS) TR-DOS.c OBJNAME=$@ CPU=68060 diff --git a/libxad/portable/clients/StuffIt.c b/libxad/amiga/source/clients/StuffIt.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/StuffIt.c rename to libxad/amiga/source/clients/StuffIt.c diff --git a/libxad/portable/clients/TR-DOS.c b/libxad/amiga/source/clients/TR-DOS.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/TR-DOS.c rename to libxad/amiga/source/clients/TR-DOS.c diff --git a/libxad/portable/clients/Tar.c b/libxad/amiga/source/clients/Tar.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/Tar.c rename to libxad/amiga/source/clients/Tar.c diff --git a/libxad/portable/clients/Zip.c b/libxad/amiga/source/clients/Zip.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/Zip.c rename to libxad/amiga/source/clients/Zip.c diff --git a/libxad/portable/clients/Zoom.c b/libxad/amiga/source/clients/Zoom.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/Zoom.c rename to libxad/amiga/source/clients/Zoom.c diff --git a/libxad/portable/clients/bzip2.c b/libxad/amiga/source/clients/bzip2.c similarity index 100% rename from libxad/portable/clients/bzip2.c rename to libxad/amiga/source/clients/bzip2.c diff --git a/libxad/portable/clients/xMash.c b/libxad/amiga/source/clients/xMash.c old mode 100755 new mode 100644 similarity index 100% rename from libxad/portable/clients/xMash.c rename to libxad/amiga/source/clients/xMash.c diff --git a/libxad/amiga/source/clients/xadCRC_1021.c b/libxad/amiga/source/clients/xadCRC_1021.c new file mode 100644 index 0000000..65952ce --- /dev/null +++ b/libxad/amiga/source/clients/xadCRC_1021.c @@ -0,0 +1,75 @@ +#ifndef XADMASTER_XADCRC_1021_C +#define XADMASTER_XADCRC_1021_C + +/* $Id: xadCRC_1021.c,v 1.4 2005/06/23 14:54:41 stoecker Exp $ + 16 bit CRC + + XAD library system for archive handling + Copyright (C) 1998 and later by Dirk Stöcker + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +static const xadUINT16 xadCRC_1021_crctable[256] = { + 0x0000,0x1021,0x2042,0x3063,0x4084,0x50A5,0x60C6,0x70E7,0x8108,0x9129, + 0xA14A,0xB16B,0xC18C,0xD1AD,0xE1CE,0xF1EF,0x1231,0x0210,0x3273,0x2252, + 0x52B5,0x4294,0x72F7,0x62D6,0x9339,0x8318,0xB37B,0xA35A,0xD3BD,0xC39C, + 0xF3FF,0xE3DE,0x2462,0x3443,0x0420,0x1401,0x64E6,0x74C7,0x44A4,0x5485, + 0xA56A,0xB54B,0x8528,0x9509,0xE5EE,0xF5CF,0xC5AC,0xD58D,0x3653,0x2672, + 0x1611,0x0630,0x76D7,0x66F6,0x5695,0x46B4,0xB75B,0xA77A,0x9719,0x8738, + 0xF7DF,0xE7FE,0xD79D,0xC7BC,0x48C4,0x58E5,0x6886,0x78A7,0x0840,0x1861, + 0x2802,0x3823,0xC9CC,0xD9ED,0xE98E,0xF9AF,0x8948,0x9969,0xA90A,0xB92B, + 0x5AF5,0x4AD4,0x7AB7,0x6A96,0x1A71,0x0A50,0x3A33,0x2A12,0xDBFD,0xCBDC, + 0xFBBF,0xEB9E,0x9B79,0x8B58,0xBB3B,0xAB1A,0x6CA6,0x7C87,0x4CE4,0x5CC5, + 0x2C22,0x3C03,0x0C60,0x1C41,0xEDAE,0xFD8F,0xCDEC,0xDDCD,0xAD2A,0xBD0B, + 0x8D68,0x9D49,0x7E97,0x6EB6,0x5ED5,0x4EF4,0x3E13,0x2E32,0x1E51,0x0E70, + 0xFF9F,0xEFBE,0xDFDD,0xCFFC,0xBF1B,0xAF3A,0x9F59,0x8F78,0x9188,0x81A9, + 0xB1CA,0xA1EB,0xD10C,0xC12D,0xF14E,0xE16F,0x1080,0x00A1,0x30C2,0x20E3, + 0x5004,0x4025,0x7046,0x6067,0x83B9,0x9398,0xA3FB,0xB3DA,0xC33D,0xD31C, + 0xE37F,0xF35E,0x02B1,0x1290,0x22F3,0x32D2,0x4235,0x5214,0x6277,0x7256, + 0xB5EA,0xA5CB,0x95A8,0x8589,0xF56E,0xE54F,0xD52C,0xC50D,0x34E2,0x24C3, + 0x14A0,0x0481,0x7466,0x6447,0x5424,0x4405,0xA7DB,0xB7FA,0x8799,0x97B8, + 0xE75F,0xF77E,0xC71D,0xD73C,0x26D3,0x36F2,0x0691,0x16B0,0x6657,0x7676, + 0x4615,0x5634,0xD94C,0xC96D,0xF90E,0xE92F,0x99C8,0x89E9,0xB98A,0xA9AB, + 0x5844,0x4865,0x7806,0x6827,0x18C0,0x08E1,0x3882,0x28A3,0xCB7D,0xDB5C, + 0xEB3F,0xFB1E,0x8BF9,0x9BD8,0xABBB,0xBB9A,0x4A75,0x5A54,0x6A37,0x7A16, + 0x0AF1,0x1AD0,0x2AB3,0x3A92,0xFD2E,0xED0F,0xDD6C,0xCD4D,0xBDAA,0xAD8B, + 0x9DE8,0x8DC9,0x7C26,0x6C07,0x5C64,0x4C45,0x3CA2,0x2C83,0x1CE0,0x0CC1, + 0xEF1F,0xFF3E,0xCF5D,0xDF7C,0xAF9B,0xBFBA,0x8FD9,0x9FF8,0x6E17,0x7E36, + 0x4E55,0x5E74,0x2E93,0x3EB2,0x0ED1,0x1EF0 +}; + +static xadUINT16 xadCRC_1021(const xadUINT8 * Mem, xadINT32 Size) +{ + xadUINT16 CRC = 0; + + while(Size--) + CRC = xadCRC_1021_crctable[((CRC>>8) ^ *(Mem++)) & 0xFF] ^ (CRC<<8); + + return CRC; +} + +static xadUINT16 xadCRC_1021_2(const xadUINT8 * Mem, xadINT32 Size) +{ + xadUINT16 CRC = 0; + + while(Size--) + CRC = xadCRC_1021_crctable[((CRC>>8) & 0xFF)] ^ ((CRC << 8) ^ *Mem++); + + return CRC; +} + +#endif /* XADMASTER_XADCRC_1021_C */ + diff --git a/libxad/amiga/source/clients/xadClient.h b/libxad/amiga/source/clients/xadClient.h new file mode 100644 index 0000000..5484a77 --- /dev/null +++ b/libxad/amiga/source/clients/xadClient.h @@ -0,0 +1,133 @@ +#ifndef XADMASTER_XADCLIENT_H +#define XADMASTER_XADCLIENT_H + +/* $Id: xadClient.h,v 1.9 2005/06/23 14:54:40 stoecker Exp $ + Amiga part of client interface to get portable clients + + XAD library system for archive handling + Copyright (C) 1998 and later by Dirk Stöcker + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include +#include +#include "SDI_compiler.h" +#include "ConvertE.c" +#define SDI_TO_ANSI +#include "SDI_ASM_STD_protos.h" +#ifdef NO_INLINE_STDARG +#include "stubs.h" +#endif + +#ifdef XADMASTERFILE +#else +/* The defines _M680x0 are done automatically by SAS-C. Do them in makefile +for other compilers. */ +#ifdef _M68060 + #define CPUCHECK if(!(xadMasterBase->xmb_SysBase->AttnFlags & AFF_68060)) return 0; + #define CPUCHECKGI if(!(xadMasterBase->xmb_SysBase->AttnFlags & AFF_68060)) return XADERR_FILESYSTEM; + #define CPUTEXT " 060" +#elif defined (_M68040) + #define CPUCHECK if(!(xadMasterBase->xmb_SysBase->AttnFlags & AFF_68040)) return 0; + #define CPUCHECKGI if(!(xadMasterBase->xmb_SysBase->AttnFlags & AFF_68040)) return XADERR_FILESYSTEM; + #define CPUTEXT " 040" +#elif defined (_M68030) + #define CPUCHECK if(!(xadMasterBase->xmb_SysBase->AttnFlags & AFF_68030)) return 0; + #define CPUCHECKGI if(!(xadMasterBase->xmb_SysBase->AttnFlags & AFF_68030)) return XADERR_FILESYSTEM; + #define CPUTEXT " 030" +#elif defined (_M68020) + #define CPUCHECK if(!(xadMasterBase->xmb_SysBase->AttnFlags & AFF_68020)) return 0; + #define CPUCHECKGI if(!(xadMasterBase->xmb_SysBase->AttnFlags & AFF_68020)) return XADERR_FILESYSTEM; + #define CPUTEXT " 020" +#else + #define CPUTEXT +#endif +#endif + +/* The macro CPUCHECK is used in xcRecogData() as first command. A inline +function is used to encapsulate the real function. +For filesystem clients CPUCKECKGI is used in xc_GetInfo(). + +These macros are security macros only. It is still not very clever to install +wrong CPU version, but if this macro is used, the computer does not crash, +but this client is skipped always. + +The string CPUTEXT is used in version string after date. +*/ + +#if !defined(XADMASTERFILE) && defined(CPUCHECK) +#define XADRECOGDATA(name) INLINE xadBOOL _name##_RecogData( xadSize size, \ + const xadUINT8 *data, struct xadMasterBase *xadMasterBase); \ + static ASM(xadBOOL) name##_RecogData( \ + REG(d0, xadSize size), \ + REG(a0, const xadUINT8 *data), \ + REG(a6, struct xadMasterBase *xadMasterBase)) \ + { CPUCHECK return _name##_RecogData(size,data,xadMasterBase); } \ + INLINE xadBOOL _name##_RecogData( xadSize size, \ + const xadUINT8 *data, struct xadMasterBase *xadMasterBase) +#else +#define XADRECOGDATA(name) static ASM(xadBOOL) name##_RecogData( \ + REG(d0, xadSize size), \ + REG(a0, const xadUINT8 *data), \ + REG(a6, struct xadMasterBase *xadMasterBase)) +#endif + +#if !defined(XADMASTERFILE) && defined(CPUCHECKGI) +#define XADGETINFO(name) INLINE xadERROR _name##_GetInfo( \ + struct xadArchiveInfo *ai, struct xadMasterBase *xadMasterBase); \ + static ASM(xadERROR) name##_GetInfo( \ + REG(a0, struct xadArchiveInfo *ai), \ + REG(a6, struct xadMasterBase *xadMasterBase)) \ + { CPUCHECKGI return _name##_GetInfo(ai,xadMasterBase); } \ + INLINE xadERROR _name##_GetInfo( \ + struct xadArchiveInfo *ai, struct xadMasterBase *xadMasterBase) +#else +#define XADGETINFO(name) static ASM(xadERROR) name##_GetInfo( \ + REG(a0, struct xadArchiveInfo *ai), \ + REG(a6, struct xadMasterBase *xadMasterBase)) +#endif + +#define XADUNARCHIVE(name) static ASM(xadERROR) name##_UnArchive( \ + REG(a0, struct xadArchiveInfo *ai), \ + REG(a6, struct xadMasterBase *xadMasterBase)) + +#define XADFREE(name) static ASM(void) name##_Free( \ + REG(a0, struct xadArchiveInfo *ai), \ + REG(a6, struct xadMasterBase *xadMasterBase)) + +#define XADRECOGDATAP(name) (xadBOOL (*)()) name##_RecogData + +#define XADGETINFOP(name) (xadERROR (*)()) name##_GetInfo + +#define XADUNARCHIVEP(name) (xadERROR (*)()) name##_UnArchive + +#define XADFREEP(name) (void (*)()) name##_Free + +#ifdef XADMASTERFILE + #define XADFIRSTCLIENT(name) static const struct xadClient name##_Client = + #define XADCLIENTVERSTR(text) +#else + #define XADFIRSTCLIENT(name) const struct xadClient FirstClient = + #define XADCLIENTVERSTR(text) \ + const xadSTRING version[] = "$VER: " text CPUTEXT; +#endif + +#define XADCLIENT(name) static const struct xadClient name##_Client = +#define XADNEXTCLIENT 0 + +#define XADNEXTCLIENTNAME(name) (struct xadClient *) &name##_Client + +#endif /* XADMASTER_XADCLIENT_H */ diff --git a/libxad/amiga/source/clients/xadIO.c b/libxad/amiga/source/clients/xadIO.c new file mode 100644 index 0000000..4f52a2a --- /dev/null +++ b/libxad/amiga/source/clients/xadIO.c @@ -0,0 +1,313 @@ +#ifndef XADMASTER_IO_C +#define XADMASTER_IO_C + +/* $Id: xadIO.c,v 1.11 2005/06/23 14:54:41 stoecker Exp $ + input/output functions + + XAD library system for archive handling + Copyright (C) 1998 and later by Dirk Stöcker + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* In case you are calling this file directly from source, you may use this +defines to make the functions static, inlined or whatever else. In case it +should be used a sobject file, they must be cleared, as they default to +static. */ + +/* the main functions */ +#ifndef XADIOFUNCMODE +#define XADIOFUNCMODE static +#endif + +/* the bit functions */ +#ifndef XADIOFUNCMODEBITS +#define XADIOFUNCMODEBITS XADIOFUNCMODE +#endif + +#define XADIODIRECTMODE +#include "xadIO.h" + +#define XIDBUFSIZE 10240 + +static xadUINT8 xadIOPutFunc(struct xadInOut *io, xadUINT8 data) +{ + if(!io->xio_Error) + { + if(!io->xio_OutSize && !(io->xio_Flags & XADIOF_NOOUTENDERR)) + { + io->xio_Error = XADERR_DECRUNCH; + io->xio_Flags |= XADIOF_ERROR; + } + else + { + if(io->xio_OutBufferPos >= io->xio_OutBufferSize) + xadIOWriteBuf(io); + io->xio_OutBuffer[io->xio_OutBufferPos++] = data; + if(!--io->xio_OutSize) + io->xio_Flags |= XADIOF_LASTOUTBYTE; + } + } + return data; +} + +static xadUINT8 xadIOGetFunc(struct xadInOut *io) +{ + xadUINT8 res = 0; + + if(!io->xio_Error) + { + if(!io->xio_InSize) + { + if(!(io->xio_Flags & XADIOF_NOINENDERR)) + { + io->xio_Error = XADERR_DECRUNCH; + io->xio_Flags |= XADIOF_ERROR; + } + } + else + { + if(io->xio_InBufferPos >= io->xio_InBufferSize) + { + xadUINT32 i; + struct xadMasterBase *xadMasterBase = io->xio_xadMasterBase; + + if((i = io->xio_InBufferSize) > io->xio_InSize) + i = io->xio_InSize; + if(!io->xio_ArchiveInfo) + { + io->xio_Flags |= XADIOF_ERROR; + io->xio_Error = XADERR_DECRUNCH; + } + else + { + xadUINT32 j; +#ifdef DEBUG + DebugClient(io->xio_ArchiveInfo, + "xadIOGetFunc NeedData BufferPos %ld InSize %ld Load %ld BufferSize %ld", + io->xio_InBufferPos, io->xio_InSize, i, io->xio_InBufferSize); +#endif + j = io->xio_ArchiveInfo->xai_InSize-io->xio_ArchiveInfo->xai_InPos; + if(i > j) + i = j; + if(!i) + { + io->xio_Flags |= XADIOF_ERROR; + io->xio_Error = XADERR_INPUT; + } + else if(!(io->xio_Error = xadHookTagAccess(XADM XADAC_READ, i, + io->xio_InBuffer, io->xio_ArchiveInfo, + XAD_USESKIPINFO, 1, TAG_DONE))) + { + if(io->xio_InFunc) + (*(io->xio_InFunc))(io, i); + res = *io->xio_InBuffer; + } + else + io->xio_Flags |= XADIOF_ERROR; +#ifdef DEBUG + if(io->xio_Error) + { + DebugClient(io->xio_ArchiveInfo, "xadIOGetFunc Load Error '%s' (%ld)", + xadGetErrorText(XADM io->xio_Error), io->xio_Error); + } +#endif + } + io->xio_InBufferPos = 1; + } + else + res = io->xio_InBuffer[io->xio_InBufferPos++]; + --io->xio_InSize; + } + if(!io->xio_InSize) + io->xio_Flags |= XADIOF_LASTINBYTE; + } + + return res; +} + +XADIOFUNCMODE struct xadInOut *xadIOAlloc(xadUINT32 flags, +struct xadArchiveInfo *ai, struct xadMasterBase *xadMasterBase) +{ + xadUINT32 size = sizeof(struct xadInOut); + struct xadInOut *io; + +#ifdef DEBUG + DebugClient(ai, "xadIOAlloc Flags %lx", flags); +#endif + + if(flags & XADIOF_ALLOCINBUFFER) + size += XIDBUFSIZE; + if(flags & XADIOF_ALLOCOUTBUFFER) + size += XIDBUFSIZE; + if((io = (struct xadInOut *) xadAllocVec(XADM size, + XADMEMF_CLEAR|XADMEMF_PUBLIC))) + { + xadSTRPTR b; + + b = (xadSTRPTR) (io+1); + io->xio_Flags = flags; + io->xio_PutFunc = xadIOPutFunc; + io->xio_GetFunc = xadIOGetFunc; + io->xio_ArchiveInfo = ai; + io->xio_xadMasterBase = xadMasterBase; + if(flags & XADIOF_ALLOCINBUFFER) + { + io->xio_InBuffer = b; b += XIDBUFSIZE; + io->xio_InBufferSize = io->xio_InBufferPos = XIDBUFSIZE; + } + if(flags & XADIOF_ALLOCOUTBUFFER) + { + io->xio_OutBuffer = b; + io->xio_OutBufferSize = XIDBUFSIZE; + } + } + return io; +} + +#ifdef XADIOGETBITSLOW +XADIOFUNCMODEBITS xadUINT32 xadIOGetBitsLow(struct xadInOut *io, xadUINT8 bits) +{ + xadUINT32 x; + + while(io->xio_BitNum < bits) + { + io->xio_BitBuf |= xadIOGetChar(io) << io->xio_BitNum; + io->xio_BitNum += 8; + } + x = io->xio_BitBuf & ((1<xio_BitBuf >>= bits; + io->xio_BitNum -= bits; + return x; +} +#endif + +#ifdef XADIOGETBITSLOWR +XADIOFUNCMODEBITS xadUINT32 xadIOGetBitsLowR(struct xadInOut *io, xadUINT8 bits) +{ + xadUINT32 x; + + while(io->xio_BitNum < bits) + { + io->xio_BitBuf |= xadIOGetChar(io) << io->xio_BitNum; + io->xio_BitNum += 8; + } + x = 0; + io->xio_BitNum -= bits; + while(bits) + { + x = (x<<1) | (io->xio_BitBuf & 1); + io->xio_BitBuf >>= 1; + --bits; + } + return x; +} +#endif + +#ifdef XADIOREADBITSLOW +XADIOFUNCMODEBITS xadUINT32 xadIOReadBitsLow(struct xadInOut *io, xadUINT8 bits) +{ + while(io->xio_BitNum < bits) + { + io->xio_BitBuf |= xadIOGetChar(io) << io->xio_BitNum; + io->xio_BitNum += 8; + } + return io->xio_BitBuf & ((1<xio_BitBuf >>= bits; + io->xio_BitNum -= bits; +} +#endif + +#ifdef XADIOGETBITSHIGH +XADIOFUNCMODEBITS xadUINT32 xadIOGetBitsHigh(struct xadInOut *io, xadUINT8 bits) +{ + xadUINT32 x; + + while(io->xio_BitNum < bits) + { + io->xio_BitBuf = (io->xio_BitBuf << 8) | xadIOGetChar(io); + io->xio_BitNum += 8; + } + x = (io->xio_BitBuf >> (io->xio_BitNum-bits)) & ((1<xio_BitNum -= bits; + return x; +} +#endif + +#ifdef XADIOREADBITSHIGH +XADIOFUNCMODEBITS xadUINT32 xadIOReadBitsHigh(struct xadInOut *io, xadUINT8 bits) +{ + while(io->xio_BitNum < bits) + { + io->xio_BitBuf = (io->xio_BitBuf << 8) | xadIOGetChar(io); + io->xio_BitNum += 8; + } + return (io->xio_BitBuf >> (io->xio_BitNum-bits)) & ((1<xio_BitNum -= bits; +} +#endif + +XADIOFUNCMODE xadERROR xadIOWriteBuf(struct xadInOut *io) +{ + struct xadMasterBase *xadMasterBase = io->xio_xadMasterBase; + +#ifdef DEBUG + DebugClient(io->xio_ArchiveInfo, + "xadIOWriteBuf BufferPos %ld OutSize %lu Error '%s' (%ld)", + io->xio_OutBufferPos, io->xio_OutSize, + xadGetErrorText(XADM io->xio_Error), io->xio_Error); +#endif + if(!io->xio_Error && io->xio_OutBufferPos) + { + + if(io->xio_OutFunc) + io->xio_OutFunc(io, io->xio_OutBufferPos); + if(!(io->xio_Flags & XADIOF_COMPLETEOUTFUNC)) + { + if(!io->xio_ArchiveInfo) + { + io->xio_Flags |= XADIOF_ERROR; + io->xio_Error = XADERR_DECRUNCH; + } + else if((io->xio_Error = xadHookTagAccess(XADM XADAC_WRITE, + io->xio_OutBufferPos, io->xio_OutBuffer, io->xio_ArchiveInfo, + io->xio_Flags & XADIOF_NOCRC16 ? TAG_IGNORE : XAD_GETCRC16, &io->xio_CRC16, + io->xio_Flags & XADIOF_NOCRC32 ? TAG_DONE : XAD_GETCRC32, &io->xio_CRC32, + TAG_DONE))) + io->xio_Flags |= XADIOF_ERROR; + } + io->xio_OutBufferPos = 0; + } +#ifdef DEBUG + if(io->xio_Error) + { + DebugClient(io->xio_ArchiveInfo, + "xadIOWriteBuf BufferPos %ld OutSize %lu leaving with Error '%s' (%ld)", + io->xio_OutBufferPos, io->xio_OutSize, + xadGetErrorText(XADM io->xio_Error), io->xio_Error); + } +#endif + return io->xio_Error; +} + +#endif /* XADMASTER_IO_C */ diff --git a/libxad/amiga/source/clients/xadIO.h b/libxad/amiga/source/clients/xadIO.h new file mode 100644 index 0000000..0ef1e38 --- /dev/null +++ b/libxad/amiga/source/clients/xadIO.h @@ -0,0 +1,134 @@ +#ifndef XADMASTER_XADIO_H +#define XADMASTER_XADIO_H + +/* $Id: xadIO.h,v 1.4 2005/06/23 14:54:41 stoecker Exp $ + Input/output function header + + XAD library system for archive handling + Copyright (C) 1998 and later by Dirk Stöcker + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "xadClient.h" + +/* These are used to keep definitions in sync when called in source + direct mode */ +#ifndef XADIODIRECTMODE +#define XADIOFUNCMODE extern +#define XADIOFUNCMODEBITS extern +#endif + +struct xadInOut { + struct xadArchiveInfo * xio_ArchiveInfo; /* filled by xadIOAlloc */ + struct xadMasterBase * xio_xadMasterBase; /* filled by xadIOAlloc */ + xadERROR xio_Error; /* cleared */ + xadUINT32 xio_Flags; /* filled by xadIOAlloc, functions or user */ + + /* xio_GetFunc and xio_PutFunc are filled by xadIOAlloc or user */ + xadUINT8 (*xio_GetFunc)(struct xadInOut *); + xadPTR xio_GetFuncPrivate; + xadUINT8 (*xio_PutFunc)(struct xadInOut *, xadUINT8); + xadPTR xio_PutFuncPrivate; + + void (*xio_InFunc)(struct xadInOut *, xadUINT32); + xadPTR xio_InFuncPrivate; + xadSize xio_InSize; + xadSize xio_InBufferSize; + xadSize xio_InBufferPos; + xadUINT8 * xio_InBuffer; + xadUINT32 xio_BitBuf; /* for xadIOGetBits functions */ + xadUINT16 xio_BitNum; /* for xadIOGetBits functions */ + + xadUINT16 xio_CRC16; /* crc16 from output functions */ + xadUINT32 xio_CRC32; /* crc32 from output functions */ + + void (*xio_OutFunc)(struct xadInOut *, xadUINT32); + xadPTR xio_OutFuncPrivate; + xadSize xio_OutSize; + xadSize xio_OutBufferSize; + xadSize xio_OutBufferPos; + xadUINT8 * xio_OutBuffer; + + /* These 3 can be reused. Algorithms should be prepared to find this + initialized! The window, alloc always has to use xadAllocVec. */ + xadSize xio_WindowSize; + xadSize xio_WindowPos; + xadUINT8 * xio_Window; + + /* If the algorithms need to remember additional data for next run, this + should be passed as argument structure of type (void **) and allocated + by the algorithms themself using xadAllocVec(). */ +}; + +/* setting BufferPos to buffer size activates first time read! */ + +#define XADIOF_ALLOCINBUFFER (1<<0) /* allocate input buffer */ +#define XADIOF_ALLOCOUTBUFFER (1<<1) /* allocate output buffer */ +#define XADIOF_NOINENDERR (1<<2) /* xadIOGetChar does not produce err at buffer end */ +#define XADIOF_NOOUTENDERR (1<<3) /* xadIOPutChar does not check out size */ +#define XADIOF_LASTINBYTE (1<<4) /* last byte was read, set by xadIOGetChar */ +#define XADIOF_LASTOUTBYTE (1<<5) /* output length was reached, set by xadIOPutChar */ +#define XADIOF_ERROR (1<<6) /* an error occured */ +#define XADIOF_NOCRC16 (1<<7) /* calculate no CRC16 */ +#define XADIOF_NOCRC32 (1<<8) /* calculate no CRC32 */ +#define XADIOF_COMPLETEOUTFUNC (1<<9) /* outfunc completely replaces write stuff */ + +/* allocates the xadInOut structure and the buffers */ +XADIOFUNCMODE struct xadInOut *xadIOAlloc(xadUINT32 flags, +struct xadArchiveInfo *ai, struct xadMasterBase *xadMasterBase); + +/* writes the buffer out */ +XADIOFUNCMODE xadERROR xadIOWriteBuf(struct xadInOut *io); + +#define xadIOGetChar(io) (*((io)->xio_GetFunc))((io)) /* reads one byte */ +#define xadIOPutChar(io,a) (*((io)->xio_PutFunc))((io), (a)) /* stores one byte */ + +/* This skips any left bits and rounds up the whole to next byte boundary. */ +/* Sometimes needed for block-based algorithms, where there blocks are byte aligned. */ +#define xadIOByteBoundary(io) ((io)->xio_BitNum = 0) + +/* The read bits function only read the bits without flushing from buffer. This is +done by DropBits. Some compressors need this method, as the flush different amount +of data than they read in. Normally the GetBits functions are used. +When including the source file directly, do not forget to set the correct defines +to include the necessary functions. */ + +#if !defined(XADIODIRECTMODE) || defined(XADIOGETBITSLOW) +/* new bytes inserted from left, get bits from right end, max 32 bits, no checks */ +XADIOFUNCMODEBITS xadUINT32 xadIOGetBitsLow(struct xadInOut *io, xadUINT8 bits); +#endif +#if !defined(XADIODIRECTMODE) || defined(XADIOGETBITSLOWR) +/* new bytes inserted from left, get bits from right end, max 32 bits, no checks, bits reversed */ +XADIOFUNCMODEBITS xadUINT32 xadIOGetBitsLowR(struct xadInOut *io, xadUINT8 bits); +#endif + +#if !defined(XADIODIRECTMODE) || defined(XADIOREADBITSLOW) +XADIOFUNCMODEBITS xadUINT32 xadIOReadBitsLow(struct xadInOut *io, xadUINT8 bits); +XADIOFUNCMODEBITS void xadIODropBitsLow(struct xadInOut *io, xadUINT8 bits); +#endif + +#if !defined(XADIODIRECTMODE) || defined(XADIOGETBITSHIGH) +/* new bytes inserted from right, get bits from left end, max 32 bits, no checks */ +XADIOFUNCMODEBITS xadUINT32 xadIOGetBitsHigh(struct xadInOut *io, xadUINT8 bits); +#endif + +#if !defined(XADIODIRECTMODE) || defined(XADIOREADBITSHIGH) +XADIOFUNCMODEBITS xadUINT32 xadIOReadBitsHigh(struct xadInOut *io, xadUINT8 bits); +XADIOFUNCMODEBITS void xadIODropBitsHigh(struct xadInOut *io, xadUINT8 bits); +#endif + +#endif /* XADMASTER_XADIO_H */ diff --git a/libxad/amiga/source/clients/xadIO_Compress.c b/libxad/amiga/source/clients/xadIO_Compress.c new file mode 100644 index 0000000..1b1dcbf --- /dev/null +++ b/libxad/amiga/source/clients/xadIO_Compress.c @@ -0,0 +1,235 @@ +#ifndef XADMASTER_XADIO_COMPRESS_C +#define XADMASTER_XADIO_COMPRESS_C + +/* $Id: xadIO_Compress.c,v 1.6 2005/06/23 14:54:41 stoecker Exp $ + UNIX Compress + + XAD library system for archive handling + Copyright (C) 1998 and later by Dirk Stöcker + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#define UCOMPMAXCODE(n) (((xadUINT32) 1 << (n)) - 1) +#define UCOMPBITS 16 +#define UCOMPSTACKSIZE 8000 +#define UCOMPFIRST 257 /* first free entry */ +#define UCOMPCLEAR 256 /* table clear output code */ +#define UCOMPINIT_BITS 9 /* initial number of bits/code */ +#define UCOMPBIT_MASK 0x1f +#define UCOMPBLOCK_MASK 0x80 + +struct UCompData { + xadINT16 clear_flg; + xadUINT16 n_bits; /* number of bits/code */ + xadUINT16 maxbits; /* user settable max # bits/code */ + xadUINT32 maxcode; /* maximum code, given n_bits */ + xadUINT32 maxmaxcode; + xadINT32 free_ent; + xadINT32 offset; + xadINT32 size; + xadUINT16 * tab_prefixof; + xadSTRPTR tab_suffixof; + xadUINT8 stack[UCOMPSTACKSIZE]; + xadUINT8 buf[UCOMPBITS]; +}; + +/* Read one code from input. If EOF, return -1. */ +static xadINT32 UCompgetcode(struct xadInOut *io, struct UCompData *cd) +{ + xadINT32 code, r_off, bits; + xadUINT8 *bp = cd->buf; + + if(cd->clear_flg > 0 || cd->offset >= cd->size || cd->free_ent > cd->maxcode) + { + /* + * If the next entry will be too big for the current code + * size, then we must increase the size. This implies reading + * a new buffer full, too. + */ + if(cd->free_ent > cd->maxcode) + { + if(++cd->n_bits == cd->maxbits) + cd->maxcode = cd->maxmaxcode; /* won't get any bigger now */ + else + cd->maxcode = UCOMPMAXCODE(cd->n_bits); + } + if(cd->clear_flg > 0) + { + cd->maxcode = UCOMPMAXCODE(cd->n_bits = UCOMPINIT_BITS); + cd->clear_flg = 0; + } + + /* This reads maximum n_bits characters into buf */ + cd->size = 0; + while(cd->size < cd->n_bits && !(io->xio_Flags + & (XADIOF_LASTINBYTE|XADIOF_ERROR))) + cd->buf[cd->size++] = xadIOGetChar(io); + if(cd->size <= 0) + return -1; + + cd->offset = 0; + /* Round size down to integral number of codes */ + cd->size = (cd->size << 3) - (cd->n_bits - 1); + } + + r_off = cd->offset; + bits = cd->n_bits; + + /* Get to the first byte. */ + bp += (r_off >> 3); + r_off &= 7; + + /* Get first part (low order bits) */ + code = (*bp++ >> r_off); + bits -= (8 - r_off); + r_off = 8 - r_off; /* now, offset into code word */ + + /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */ + if(bits >= 8) + { + code |= *bp++ << r_off; + r_off += 8; + bits -= 8; + } + + /* high order bits. */ + code |= (*bp & ((1<offset += cd->n_bits; + + return code; +} + +/* Decompress. This routine adapts to the codes in the file building the + * "string" table on-the-fly; requiring no table to be stored in the + * compressed file. + */ +static xadINT32 xadIO_Compress(struct xadInOut *io, xadUINT8 bitinfo) +{ + xadINT32 err = 0; + struct UCompData *cd; + struct xadMasterBase *xadMasterBase = io->xio_xadMasterBase; + + if((bitinfo & UCOMPBIT_MASK) < UCOMPINIT_BITS) + return XADERR_ILLEGALDATA; + + if((cd = (struct UCompData *) xadAllocVec(XADM sizeof(struct UCompData), + XADMEMF_CLEAR|XADMEMF_PUBLIC))) + { + xadINT32 finchar, code, oldcode, incode, blockcomp; + xadSTRPTR stackp, stack, stackend; + + stackp = (xadSTRPTR) (stack = (xadSTRPTR) cd->stack); + stackend = stack+UCOMPSTACKSIZE; + cd->maxbits = bitinfo & UCOMPBIT_MASK; + blockcomp = bitinfo & UCOMPBLOCK_MASK; + cd->maxmaxcode = 1 << cd->maxbits; + cd->maxcode = UCOMPMAXCODE(cd->n_bits = UCOMPINIT_BITS); + cd->free_ent = blockcomp ? UCOMPFIRST : 256; +/* cd->clear_flg = cd->offset = cd->size = 0; */ + + if((cd->tab_prefixof = (xadUINT16 *) xadAllocVec(XADM sizeof(xadUINT16) + *cd->maxmaxcode, XADMEMF_PUBLIC|XADMEMF_CLEAR))) + { + if((cd->tab_suffixof = (xadSTRPTR) xadAllocVec(XADM cd->maxmaxcode, + XADMEMF_PUBLIC|XADMEMF_CLEAR))) + { + /* Initialize the first 256 entries in the table. */ + for(code = 255; code >= 0; code--) + { +/* cd->tab_prefixof[code] = 0; */ + cd->tab_suffixof[code] = (xadUINT8) code; + } + + if((finchar = oldcode = UCompgetcode(io, cd)) == -1) + err = XADERR_DECRUNCH; + else + { + xadIOPutChar(io, finchar); /* first code must be 8 bits = xadUINT8 */ + + while((code = UCompgetcode(io, cd)) > -1) + { + if((code == UCOMPCLEAR) && blockcomp) + { + for(code = 255; code >= 0; code--) + cd->tab_prefixof[code] = 0; + cd->clear_flg = 1; + cd->free_ent = UCOMPFIRST - 1; + if((code = UCompgetcode(io, cd)) == -1) + break; /* O, untimely death! */ + } + incode = code; + + /* Special case for KwKwK string. */ + if(code >= cd->free_ent) + { + if(code > cd->free_ent) + { + io->xio_Error = XADERR_ILLEGALDATA; + break; + } + *stackp++ = finchar; + code = oldcode; + } + + /* Generate output characters in reverse order */ + while(stackp < stackend && code >= 256) + { + *stackp++ = cd->tab_suffixof[code]; + code = cd->tab_prefixof[code]; + } + if(stackp >= stackend) + { + err = XADERR_ILLEGALDATA; + break; + } + *(stackp++) = finchar = cd->tab_suffixof[code]; + + /* And put them out in forward order */ + do + { + xadIOPutChar(io, *(--stackp)); + } while(stackp > stack); + + /* Generate the new entry. */ + if((code = cd->free_ent) < cd->maxmaxcode) + { + cd->tab_prefixof[code] = (xadUINT16) oldcode; + cd->tab_suffixof[code] = finchar; + cd->free_ent = code+1; + } + /* Remember previous code. */ + oldcode = incode; + } + if(!err) + err = io->xio_Error; + } + xadFreeObjectA(XADM cd->tab_suffixof, 0); + } + else + err = XADERR_NOMEMORY; + xadFreeObjectA(XADM cd->tab_prefixof, 0); + } + else + err = XADERR_NOMEMORY; + xadFreeObjectA(XADM cd, 0); + } + else + err = XADERR_NOMEMORY; + + return err; +} + +#endif /* XADMASTER_XADIO_COMPRESS_C */ diff --git a/libxad/amiga/source/clients/xadIO_XPK.c b/libxad/amiga/source/clients/xadIO_XPK.c new file mode 100644 index 0000000..13c953d --- /dev/null +++ b/libxad/amiga/source/clients/xadIO_XPK.c @@ -0,0 +1,153 @@ +#ifndef XADMASTER_XADIO_XPK_C +#define XADMASTER_XADIO_XPK_C + +/* $Id: xadIO_XPK.c,v 1.10 2005/06/23 14:54:41 stoecker Exp $ + XPK files meta archiver + + XAD library system for archive handling + Copyright (C) 1998 and later by Dirk Stöcker + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "xadIO.h" + +#ifndef AMIGA +static xadINT32 xadIO_XPK(struct xadInOut *io, xadSTRPTR password) +{ + return XADERR_NOTSUPPORTED; +} +#else + +#include +#include +#include +extern struct ExecBase *SysBase; + +static xadINT32 xadIO_XPK(struct xadInOut *io, xadSTRPTR password) +{ + xadINT32 err; + struct xadMasterBase *xadMasterBase = io->xio_xadMasterBase; + struct Library *XpkBase; + struct XpkFib xfib; + xadUINT8 head[8] = {0}, *mem, *mem2; + xadUINT32 i,s; + +#ifdef DEBUG + DebugClient(io->xio_ArchiveInfo, "XPK - Password '%s'", password); +#endif + for(i = 0; i < 8 && !io->xio_Error; ++i) + { + head[i] = xadIOGetChar(io); + } + if(EndGetM32(head) == 0x58504B46 && !io->xio_Error) + { + i = EndGetM32(head+4)+8; + if((XpkBase = OpenLibrary("xpkmaster.library", 4))) + { + #ifdef __amigaos4__ + struct XpkIFace *IXpk; + if (!(IXpk = (struct XpkIFace *)GetInterface(XpkBase, "main", 1L, NULL))) + { + CloseLibrary(XpkBase); + return XADERR_RESOURCE; + } + #endif + + if((mem = (xadSTRPTR) xadAllocVec(XADM i, XADMEMF_PUBLIC))) + { + for(s = 0; s < 8; ++s) + mem[s] = head[s]; + for(;s < i && !io->xio_Error; ++s) + mem[s] = xadIOGetChar(io); +#ifdef DEBUG + DebugClient(io->xio_ArchiveInfo, "XPK - Position %ld, Size %ld, Error %ld", + s, i, io->xio_Error); +#endif + if(!(io->xio_Error) && (XpkExamineTags(&xfib, XPK_InBuf, mem, + XPK_InLen, i, TAG_DONE)) == 0) + { + if((mem2 = (xadSTRPTR) xadAllocVec(XADM xfib.xf_ULen+XPK_MARGIN, + XADMEMF_PUBLIC|XADMEMF_CLEAR))) + { + if((err = XpkUnpackTags(XPK_InBuf, mem, XPK_InLen, i, + XPK_OutBuf, mem2, XPK_OutBufLen, xfib.xf_ULen + XPK_MARGIN, + password ? XPK_Password : TAG_IGNORE, password, + XPK_UseXfdMaster, 0, XPK_PassRequest, FALSE, TAG_DONE))) + { +#ifdef DEBUG + DebugClient(io->xio_ArchiveInfo, "XPK - Error %d", err); +#endif + switch(err) + { + case XPKERR_IOERRIN: err = XADERR_INPUT; break; + case XPKERR_IOERROUT: err = XADERR_OUTPUT; break; + case XPKERR_CORRUPTPKD: + case XPKERR_TRUNCATED: err = XADERR_ILLEGALDATA; break; + case XPKERR_NOMEM: err = XADERR_NOMEMORY; break; + case XPKERR_WRONGCPU: + case XPKERR_MISSINGLIB: + case XPKERR_VERSION: + case XPKERR_OLDMASTLIB: + case XPKERR_OLDSUBLIB: + case XPKERR_NOHARDWARE: + case XPKERR_BADHARDWARE: err = XADERR_DATAFORMAT; break; + case XPKERR_NEEDPASSWD: + case XPKERR_WRONGPW: err = XADERR_PASSWORD; break; + default: err = XADERR_DECRUNCH; break; + } + } + else + { + for(s=0; s < xfib.xf_ULen && !io->xio_Error; ++s) + xadIOPutChar(io, mem2[s]); + } + xadFreeObjectA(XADM mem2, 0); + } + else + err = XADERR_NOMEMORY; + } + else + err = XADERR_ILLEGALDATA; + xadFreeObjectA(XADM mem, 0); + } /* xadAllocVec */ + else + err = XADERR_NOMEMORY; + #ifdef __amigaos4__ + DropInterface((struct Interface *)IXpk); + #endif + CloseLibrary(XpkBase); + } /* OpenLibrary */ + else + err = XADERR_RESOURCE; + } + else + { +#ifdef DEBUG + DebugClient(io->xio_ArchiveInfo, "XPK - Header error %08lx != 0x48504B46", + EndGetM32(head)); +#endif + + err = XADERR_DATAFORMAT; + } + + if(io->xio_Error) + err = io->xio_Error; + + return err; +} +#endif /* AMIGA */ + +#endif /* XADMASTER_XADIO_COMPRESS_C */ diff --git a/libxad/amiga/source/clients/xadXPK.c b/libxad/amiga/source/clients/xadXPK.c new file mode 100644 index 0000000..6368684 --- /dev/null +++ b/libxad/amiga/source/clients/xadXPK.c @@ -0,0 +1,131 @@ +#ifndef XADMASTER_XADXPK_C +#define XADMASTER_XADXPK_C + +/* $Id: xadXPK.c,v 1.5 2005/06/23 14:54:40 stoecker Exp $ + xpk decrunch handling + + XAD library system for archive handling + Copyright (C) 1998 and later by Dirk Stöcker + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include +#include +#include + +extern struct ExecBase *SysBase; + +static xadERROR GetXpkError(xadINT32 err) +{ + xadERROR ret; + + switch(err) + { + case XPKERR_OK: ret = XADERR_OK; break; + case XPKERR_IOERRIN: ret = XADERR_INPUT; break; + case XPKERR_IOERROUT: ret = XADERR_OUTPUT; break; + case XPKERR_CORRUPTPKD: + case XPKERR_TRUNCATED: ret = XADERR_ILLEGALDATA; break; + case XPKERR_NOMEM: ret = XADERR_NOMEMORY; break; + case XPKERR_WRONGCPU: + case XPKERR_MISSINGLIB: + case XPKERR_VERSION: + case XPKERR_OLDMASTLIB: + case XPKERR_OLDSUBLIB: + case XPKERR_NOHARDWARE: + case XPKERR_BADHARDWARE: ret = XADERR_RESOURCE; break; + case XPKERR_NEEDPASSWD: + case XPKERR_WRONGPW: ret = XADERR_PASSWORD; break; + default: ret = XADERR_DECRUNCH; break; + }; + return ret; +} + +/* reads XPKF file from current input stream and stores a pointer to +decrunched file in *str and the size in *size */ +static xadERROR xpkDecrunch(xadUINT8 **str, xadUINT32 *size, +struct xadArchiveInfo *ai, struct xadMasterBase *xadMasterBase) +{ + struct Library *XpkBase; + xadUINT32 buf[2]; + xadERROR err; + xadUINT32 *mem; + + if((XpkBase = OpenLibrary("xpkmaster.library", 4))) + { + #ifdef __amigaos4__ + struct XpkIFace *IXpk; + + if (!(IXpk = (struct XpkIFace *) GetInterface(XpkBase, "main", 1, NULL))) + { + CloseLibrary(XpkBase); + return XADERR_NOMEMORY; + } + #endif + + if(!(err = xadHookAccess(XADAC_READ, 8, buf, ai))) + { + if((mem = xadAllocVec(buf[1]+8, XADMEMF_PUBLIC))) + { + if(!(err = xadHookAccess(XADAC_READ, buf[1], mem+2, ai))) + { + struct XpkFib xfib; + + mem[0] = buf[0]; + mem[1] = buf[1]; + + if(!XpkExamineTags(&xfib, XPK_InBuf, mem, + XPK_InLen, buf[1]+8, TAG_DONE)) + { + xadUINT8 *mem2; + + if((mem2 = (xadUINT8 *) xadAllocVec(xfib.xf_ULen+XPK_MARGIN, + XADMEMF_PUBLIC|XADMEMF_CLEAR))) + { + *str = mem2; + *size = xfib.xf_ULen; + + if((err = GetXpkError(XpkUnpackTags(XPK_InBuf, mem, + XPK_InLen, buf[1]+8, XPK_OutBuf, mem2, XPK_OutBufLen, + *size + XPK_MARGIN, ai->xai_Password ? XPK_Password : + TAG_IGNORE, ai->xai_Password, XPK_UseXfdMaster, 0, + XPK_PassRequest, FALSE, TAG_DONE)))) + { + xadFreeObjectA(mem2, 0); *str = 0; *size = 0; + } + } + } + else + err = XADERR_ILLEGALDATA; + } + xadFreeObjectA(mem, 0); + } /* xadAllocVec */ + else + err = XADERR_NOMEMORY; + } /* Hook Read */ + #ifdef __amigaos4__ + DropInterface((struct Interface *)IXpk); + #endif + CloseLibrary(XpkBase); + } /* OpenLibrary */ + else + err = XADERR_RESOURCE; + + return err; +} + +#endif /* XADMASTER_XADXPK_C */ diff --git a/libxad/needed_assigns b/libxad/needed_assigns new file mode 100644 index 0000000..d22272a --- /dev/null +++ b/libxad/needed_assigns @@ -0,0 +1,5 @@ +Needed assigns: + +assign include: amiga/include/c add +assign lib: portable/include add +assign include path:to/xpk/includes add diff --git a/libxad/portable/amiga/SMakeFile b/libxad/portable/amiga/SMakeFile index 6774d7e..bc3db5a 100755 --- a/libxad/portable/amiga/SMakeFile +++ b/libxad/portable/amiga/SMakeFile @@ -18,7 +18,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -ODIR = T: +ODIR = CODE:XadLib/Build/Library/ CDIR = /clients/ IDIR = /include/ LDIR = / @@ -47,35 +47,15 @@ HFILES = \ $(IDIR)xadmaster.h CFILES = \ - $(CDIR)HA.c \ - $(CDIR)TR-DOS.c \ $(CDIR)Ace.c \ - $(CDIR)AMPK.c \ - $(CDIR)bzip2.c \ - $(CDIR)CAB.c \ $(CDIR)Cpio.c \ $(CDIR)CrunchDisk.c \ - $(CDIR)DMS.c \ $(CDIR)DCS.c \ - $(CDIR)IFF-CDAF.c \ $(CDIR)FS_Amiga.c \ - $(CDIR)FS_FAT.c \ - $(CDIR)FS_SOS.c \ - $(CDIR)LhA.c \ - $(CDIR)LhF.c \ - $(CDIR)LZX.c \ - $(CDIR)MDC.c \ - $(CDIR)MXM-SimpleArc.c \ - $(CDIR)PackDev.c \ - $(CDIR)PackDisk.c \ - $(CDIR)RPM.c \ - $(CDIR)StuffIt.c \ - $(CDIR)SuperDuper3.c \ - $(CDIR)Tar.c \ - $(CDIR)xDisk.c \ - $(CDIR)xMash.c \ - $(CDIR)Zip.c \ - $(CDIR)Zoom.c \ + $(CDIR)FS_FAT.c \ + $(CDIR)FS_SOS.c \ + $(CDIR)SuperDuper3.c \ + $(CDIR)xDisk.c \ $(CDIR)xadIO_Compress.c \ $(CDIR)xadIO_XPK.c \ $(CDIR)xadIO.h \ @@ -134,7 +114,8 @@ DEBOBJ = \ $(DEBODIR)objects.o \ $(DEBODIR)protection.o -DEF: Install DEBUG +#DEF: Install DEBUG +DEF: 030 DEBUG CPU: 000 020 030 040 060 RES: 060RES ALL: CPU DEBUG @@ -151,6 +132,9 @@ Install: 060 Flush Install040: 040 Flush Copy $(ODIR)xadmaster.library040 LIBS:xadmaster.library +Install030: 030 Flush + Copy $(ODIR)xadmaster.library030 LIBS:xadmaster.library + Install020: 020 Flush Copy $(ODIR)xadmaster.library020 LIBS:xadmaster.library diff --git a/libxad/portable/amiga/libinit.c b/libxad/portable/amiga/libinit.c index b214ff9..9aaad63 100755 --- a/libxad/portable/amiga/libinit.c +++ b/libxad/portable/amiga/libinit.c @@ -406,13 +406,13 @@ struct ExecBase * SysBase = 0; #if defined(DEBUG) || defined(DEBUGRESOURCE) struct DosLibrary * DOSBase = 0; -struct UtilityBase * UtilityBase = 0; +struct Library * UtilityBase = 0; struct xadMasterBase * xadMasterBase = 0; static void MakeGlobalLibs(struct xadMasterBaseP *xadBase) { DOSBase = xadBase->xmb_DOSBase; - UtilityBase = xadBase->xmb_UtilityBase; + UtilityBase = (struct Library *) xadBase->xmb_UtilityBase; xadMasterBase = (struct xadMasterBase *) xadBase; } #endif diff --git a/libxad/portable/clients.c b/libxad/portable/clients.c index 1c8f55a..38dfd44 100755 --- a/libxad/portable/clients.c +++ b/libxad/portable/clients.c @@ -45,38 +45,15 @@ void DebugClient(const struct xadArchiveInfo *ai, const xadSTRING *, ...); #define XADNEXTCLIENT 0 -#ifdef XAD_GPLCLIENTS -#include "clients/HA.c" -#include "clients/TR-DOS.c" -#endif - #include "clients/Ace.c" -#include "clients/AMPK.c" -#include "clients/bzip2.c" -#include "clients/CAB.c" #include "clients/Cpio.c" #include "clients/CrunchDisk.c" #include "clients/DCS.c" -#include "clients/DMS.c" #include "clients/FS_Amiga.c" #include "clients/FS_FAT.c" #include "clients/FS_SOS.c" -#include "clients/IFF-CDAF.c" -#include "clients/LhA.c" -#include "clients/LhF.c" -#include "clients/LZX.c" -#include "clients/MDC.c" -#include "clients/MXM-SimpleArc.c" -#include "clients/PackDev.c" -#include "clients/PackDisk.c" -#include "clients/RPM.c" -#include "clients/StuffIt.c" #include "clients/SuperDuper3.c" -#include "clients/Tar.c" #include "clients/xDisk.c" -#include "clients/xMash.c" -#include "clients/Zip.c" -#include "clients/Zoom.c" const struct xadClient * const RealFirstClient = XADNEXTCLIENT; diff --git a/libxad/portable/include/functions.h b/libxad/portable/include/functions.h new file mode 100644 index 0000000..7e7f0c8 --- /dev/null +++ b/libxad/portable/include/functions.h @@ -0,0 +1,262 @@ +#ifndef XADMASTER_FUNCTIONS_H +#define XADMASTER_FUNCTIONS_H + +/* $Id: functions.h.in,v 1.11 2005/06/23 14:54:42 stoecker Exp $ + declarations and prototypes + + XAD library system for archive handling + Copyright (C) 1998 and later by Dirk Stöcker + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* xadmaster.h is included without its public library prototypes, so we + * can define them ourselves using xadMasterBaseP instead of xadMasterBase */ +#define XAD_NO_PROTOTYPES 1 +#include + +/* include all library-internal structures, including xadMasterBaseP */ +#include + +/************************************************************************ +* * +* library accessable function * +* * +************************************************************************/ + +/*** BEGIN auto-generated section (INTERNAL AMIGA) */ +#include +#define SDI_TO_ANSI +#include "SDI_ASM_STD_protos.h" +#include "SDI_compiler.h" +#ifdef NO_INLINE_STDARG +#include "stubs.h" +#endif + +#define PROTOHOOK(name) \ + ASM(xadINT32) name( \ + REG(a0, struct Hook * hook), \ + REG(a2, struct xadArchiveInfoP *ai), \ + REG(a1, struct xadHookParam * param)) + +#define FUNCHOOK(name) PROTOHOOK(name) { + +#define ENDFUNC } + +/* xadAddDiskEntry - clientfunc.c */ +ASM(xadERROR) LIBxadAddDiskEntryA(REG(a0, struct xadDiskInfo *di), REG(a1, struct xadArchiveInfoP *ai), REG(a2, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadAddDiskEntry ASM(xadERROR) LIBxadAddDiskEntryA(REG(a0, struct xadDiskInfo *di), REG(a1, struct xadArchiveInfoP *ai), REG(a2, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/* xadAddFileEntry - clientfunc.c */ +ASM(xadERROR) LIBxadAddFileEntryA(REG(a0, struct xadFileInfo *fi), REG(a1, struct xadArchiveInfoP *ai), REG(a2, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadAddFileEntry ASM(xadERROR) LIBxadAddFileEntryA(REG(a0, struct xadFileInfo *fi), REG(a1, struct xadArchiveInfoP *ai), REG(a2, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/* xadAllocObject - objects.c */ +ASM(xadPTR) LIBxadAllocObjectA(REG(d0, xadUINT32 type), REG(a0, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadAllocObject ASM(xadPTR) LIBxadAllocObjectA(REG(d0, xadUINT32 type), REG(a0, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/* xadAllocVec - objects.c */ +ASM(xadPTR) LIBxadAllocVec(REG(d0, xadSize size), REG(d1, xadUINT32 flags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadAllocVec ASM(xadPTR) LIBxadAllocVec(REG(d0, xadSize size), REG(d1, xadUINT32 flags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { + +/* xadCalcCRC16 - crc.c */ +ASM(xadUINT16) LIBxadCalcCRC16(REG(d0, xadUINT16 id), REG(d1, xadUINT16 init), REG(d2, xadSize size), REG(a0, const xadUINT8 *buffer), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadCalcCRC16 ASM(xadUINT16) LIBxadCalcCRC16(REG(d0, xadUINT16 id), REG(d1, xadUINT16 init), REG(d2, xadSize size), REG(a0, const xadUINT8 *buffer), REG(a6, struct xadMasterBaseP *xadMasterBase)) { + +/* xadCalcCRC32 - crc.c */ +ASM(xadUINT32) LIBxadCalcCRC32(REG(d0, xadUINT32 id), REG(d1, xadUINT32 init), REG(d2, xadSize size), REG(a0, const xadUINT8 *buffer), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadCalcCRC32 ASM(xadUINT32) LIBxadCalcCRC32(REG(d0, xadUINT32 id), REG(d1, xadUINT32 init), REG(d2, xadSize size), REG(a0, const xadUINT8 *buffer), REG(a6, struct xadMasterBaseP *xadMasterBase)) { + +/* xadConvertDates - dates.c */ +ASM(xadERROR) LIBxadConvertDatesA(REG(a0, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadConvertDates ASM(xadERROR) LIBxadConvertDatesA(REG(a0, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/* xadConvertName - filename.c */ +ASM(xadSTRPTR) LIBxadConvertNameA(REG(d0, xadUINT32 charset), REG(a0, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadConvertName ASM(xadSTRPTR) LIBxadConvertNameA(REG(d0, xadUINT32 charset), REG(a0, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/* xadConvertProtection - protection.c */ +ASM(xadERROR) LIBxadConvertProtectionA(REG(a0, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadConvertProtection ASM(xadERROR) LIBxadConvertProtectionA(REG(a0, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/* xadCopyMem - copymem.c */ +ASM(void) LIBxadCopyMem(REG(a0, const void *s), REG(a1, xadPTR d), REG(d0, xadSize size)); +#define FUNCxadCopyMem ASM(void) LIBxadCopyMem(REG(a0, const void *s), REG(a1, xadPTR d), REG(d0, xadSize size)) { + +/* xadDiskUnArc - diskunarc.c */ +ASM(xadERROR) LIBxadDiskUnArcA(REG(a0, struct xadArchiveInfoP *ai), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadDiskUnArc ASM(xadERROR) LIBxadDiskUnArcA(REG(a0, struct xadArchiveInfoP *ai), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/* xadFileUnArc - fileunarc.c */ +ASM(xadERROR) LIBxadFileUnArcA(REG(a0, struct xadArchiveInfoP *ai), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadFileUnArc ASM(xadERROR) LIBxadFileUnArcA(REG(a0, struct xadArchiveInfoP *ai), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/* xadFreeHookAccess - hook.c */ +ASM(void) LIBxadFreeHookAccessA(REG(a0, struct xadArchiveInfoP *ai), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadFreeHookAccess ASM(void) LIBxadFreeHookAccessA(REG(a0, struct xadArchiveInfoP *ai), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/* xadFreeInfo - info.c */ +ASM(void) LIBxadFreeInfo(REG(a0, struct xadArchiveInfoP *ai), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadFreeInfo ASM(void) LIBxadFreeInfo(REG(a0, struct xadArchiveInfoP *ai), REG(a6, struct xadMasterBaseP *xadMasterBase)) { + +/* xadFreeObject - objects.c */ +ASM(void) LIBxadFreeObjectA(REG(a0, xadPTR object), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadFreeObject ASM(void) LIBxadFreeObjectA(REG(a0, xadPTR object), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { + +/* xadGetClientInfo - clientfunc.c */ +ASM(struct xadClient *) LIBxadGetClientInfo(REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadGetClientInfo ASM(struct xadClient *) LIBxadGetClientInfo(REG(a6, struct xadMasterBaseP *xadMasterBase)) { + +/* xadGetDefaultName - filename.c */ +ASM(xadSTRPTR) LIBxadGetDefaultNameA(REG(a0, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadGetDefaultName ASM(xadSTRPTR) LIBxadGetDefaultNameA(REG(a0, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/* xadGetDiskInfo - diskfile.c */ +ASM(xadERROR) LIBxadGetDiskInfoA(REG(a0, struct xadArchiveInfoP *ai), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadGetDiskInfo ASM(xadERROR) LIBxadGetDiskInfoA(REG(a0, struct xadArchiveInfoP *ai), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/* xadGetErrorText - error.c */ +ASM(xadSTRPTR) LIBxadGetErrorText(REG(d0, xadERROR errnum)); +#define FUNCxadGetErrorText ASM(xadSTRPTR) LIBxadGetErrorText(REG(d0, xadERROR errnum)) { + +/* xadGetFilename - filename.c */ +ASM(xadERROR) LIBxadGetFilenameA(REG(d0, xadUINT32 buffersize), REG(a0, xadSTRPTR buffer), REG(a1, const xadSTRING *path), REG(a2, const xadSTRING *name), REG(a3, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadGetFilename ASM(xadERROR) LIBxadGetFilenameA(REG(d0, xadUINT32 buffersize), REG(a0, xadSTRPTR buffer), REG(a1, const xadSTRING *path), REG(a2, const xadSTRING *name), REG(a3, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/* xadGetInfo - info.c */ +ASM(xadERROR) LIBxadGetInfoA(REG(a0, struct xadArchiveInfoP *ai), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadGetInfo ASM(xadERROR) LIBxadGetInfoA(REG(a0, struct xadArchiveInfoP *ai), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { + +/* xadGetHookAccess - hook.c */ +ASM(xadERROR) LIBxadGetHookAccessA(REG(a0, struct xadArchiveInfoP *ai), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadGetHookAccess ASM(xadERROR) LIBxadGetHookAccessA(REG(a0, struct xadArchiveInfoP *ai), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/* xadGetSystemInfo - info.c */ +ASM(struct xadSystemInfo *) LIBxadGetSystemInfo(REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadGetSystemInfo ASM(struct xadSystemInfo *) LIBxadGetSystemInfo(REG(a6, struct xadMasterBaseP *xadMasterBase)) { + +/* xadHookAccess - clientfunc.c */ +ASM(xadERROR) LIBxadHookAccess(REG(d0, xadUINT32 command), REG(d1, xadSignSize data), REG(a0, xadPTR buffer), REG(a1, struct xadArchiveInfoP *ai), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadHookAccess ASM(xadERROR) LIBxadHookAccess(REG(d0, xadUINT32 command), REG(d1, xadSignSize data), REG(a0, xadPTR buffer), REG(a1, struct xadArchiveInfoP *ai), REG(a6, struct xadMasterBaseP *xadMasterBase)) { + +/* xadHookTagAccess - clientfunc.c */ +ASM(xadERROR) LIBxadHookTagAccessA(REG(d0, xadUINT32 command), REG(d1, xadSignSize data), REG(a0, xadPTR buffer), REG(a1, struct xadArchiveInfoP *ai), REG(a2, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadHookTagAccess ASM(xadERROR) LIBxadHookTagAccessA(REG(d0, xadUINT32 command), REG(d1, xadSignSize data), REG(a0, xadPTR buffer), REG(a1, struct xadArchiveInfoP *ai), REG(a2, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/* xadRecogFile - info.c */ +ASM(struct xadClient *) LIBxadRecogFileA(REG(d0, xadSize size), REG(a0, const void *mem), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)); +#define FUNCxadRecogFile ASM(struct xadClient *) LIBxadRecogFileA(REG(d0, xadSize size), REG(a0, const void *mem), REG(a1, xadTAGPTR tags), REG(a6, struct xadMasterBaseP *xadMasterBase)) { \ + struct UtilityBase *UtilityBase = xadMasterBase->xmb_UtilityBase; + +/*** END auto-generated section */ + +PROTOHOOK(InHookFH); /* hook_fh.c */ +PROTOHOOK(OutHookFH); /* hook_fh.c */ +PROTOHOOK(InHookMem); /* hook_mem.c */ +PROTOHOOK(OutHookMem); /* hook_mem.c */ +PROTOHOOK(InHookStream); /* hook_stream.c */ +PROTOHOOK(OutHookStream); /* hook_stream.c */ +PROTOHOOK(InHookDisk); /* hook_disk.c */ +PROTOHOOK(OutHookDisk); /* hook_disk.c */ +PROTOHOOK(InHookSplitted); /* hook_splitted.c */ +PROTOHOOK(InHookDiskArc); /* hook_diskarc.c */ + +/* clientfunc.c */ +xadUINT32 callprogress( + const struct xadArchiveInfoP *ai, + xadUINT32 stat, xadUINT32 mode, + struct xadMasterBaseP *xadMasterBase); + +xadUINT32 callprogressFN( + const struct xadArchiveInfoP *ai, + xadUINT32 stat, xadUINT32 mode, xadSTRPTR *filename, + struct xadMasterBaseP *xadMasterBase); + +xadSignSize getskipsize( + xadSignSize data, + const struct xadArchiveInfoP *ai); + +xadBOOL xadAddClients(struct xadMasterBaseP *xadMasterBase, + const struct xadClient *clients, + xadUINT32 add_flags); + +void xadFreeClients(struct xadMasterBaseP *xadMasterBase); + +void MakeCRC16(xadUINT16 *buf, xadUINT16 ID); +void MakeCRC32(xadUINT32 *buf, xadUINT32 ID); + +extern const struct xadClient * const RealFirstClient; + +#ifdef DEBUG +void DebugFlagged(xadUINT32 flags, const xadSTRING *fmt, ...); + +void DebugTagList(const xadSTRING *, xadTAGPTR, ...); /* print with 'R' and tags with 'T' */ +void DebugTagListOther(const xadSTRING *, xadTAGPTR, ...); /* print with 'O' and tags with 'T' */ +void DebugTagListMem(const xadSTRING *, xadTAGPTR, ...); /* print with 'R' or 'M' and tags with 'T' */ +void DebugError(const xadSTRING *, ...); /* print with 'E' */ +void DebugHook(const xadSTRING *, ...); /* print with 'H' */ +void DebugHookTagList(const xadSTRING *, xadTAGPTR, ...); /* print with 'H' and tags with 'T' */ +void DebugRunTime(const xadSTRING *, ...); /* print with 'R' */ +void DebugOther(const xadSTRING *, ...); /* print with 'O' */ +void DebugMem(const xadSTRING *, ...); /* print with 'M' */ +void DebugMemError(const xadSTRING *, ...); /* print with 'M' or 'E' */ +void DebugFileSearched(const struct xadArchiveInfo *ai, const xadSTRING *, ...); /* print with 'D' */ +void DebugClient(const struct xadArchiveInfo *ai, const xadSTRING *, ...); /* print with 'D' */ +#endif +#ifdef DEBUGRESOURCE +#define XADOBJCOOKIE 0x58414494 +void DebugResource(struct xadMasterBaseP *, const xadSTRING *, ...); /* print with 'C' */ +/* called with 0 does end result check for this task */ +/* called with 1 does end result check for all tasks */ +#endif +#if defined(DEBUG) || defined(DEBUGRESOURCE) +#define DEBUGFLAG_ERROR (1<<0) +#define DEBUGFLAG_RUNTIME (1<<1) +#define DEBUGFLAG_TAGLIST (1<<2) +#define DEBUGFLAG_HOOK (1<<3) +#define DEBUGFLAG_OTHER (1<<4) +#define DEBUGFLAG_MEM (1<<5) +#define DEBUGFLAG_FLAGS (1<<6) +#define DEBUGFLAG_RESOURCE (1<<7) +#define DEBUGFLAG_CLIENT (1<<8) +#define DEBUGFLAG_SEARCHED (1<<9) +#define DEBUGFLAG_STATIC (1<<10) +#define DEBUGFLAG_CONTINUESTART (1<<11) +#define DEBUGFLAG_CONTINUE (1<<12) +#define DEBUGFLAG_CONTINUEEND (1<<13) + +extern struct ExecBase * SysBase; +extern struct DosLibrary * DOSBase; +extern struct Library * UtilityBase; +extern struct xadMasterBase * xadMasterBase; + +xadSTRPTR xadGetObjectTypeName(xadUINT32 type); /* objects.c */ +#endif + +#endif /* XADMASTER_FUNCTIONS_H */ diff --git a/libxad/portable/include/xadmaster.h b/libxad/portable/include/xadmaster.h new file mode 100644 index 0000000..b86e4e7 --- /dev/null +++ b/libxad/portable/include/xadmaster.h @@ -0,0 +1,1019 @@ +#ifndef LIBRARIES_XADMASTER_H +#define LIBRARIES_XADMASTER_H + +/* $Id: xadmaster.h.in,v 1.26 2006/06/21 07:18:12 stoecker Exp $ + xadmaster.library defines and structures + + XAD library system for archive handling + Copyright (C) 1998 and later by Dirk Stöcker + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_STDINT_H +#include +typedef uint32_t xadUINT32; +typedef int32_t xadINT32; +typedef uint16_t xadUINT16; +typedef int16_t xadINT16; +typedef uint8_t xadUINT8; +typedef int8_t xadINT8; +typedef uint32_t xadSize; +typedef int32_t xadSignSize; +#define XADSIZE "ld" +#define XADSSIZE "lu" +#else +typedef unsigned long xadUINT32; +typedef signed long xadINT32; +typedef unsigned short xadUINT16; +typedef signed short xadINT16; +typedef unsigned char xadUINT8; +typedef signed char xadINT8; +typedef xadUINT32 xadSize; +typedef xadINT32 xadSignSize; +#define XADSIZE "ld" +#define XADSSIZE "lu" +#endif +typedef void * xadPTR; +typedef char xadSTRING; +typedef xadSTRING * xadSTRPTR; +typedef unsigned int xadUINT; +typedef int xadINT; +typedef xadINT32 xadERROR; +typedef xadINT16 xadBOOL; + +#define XADFALSE 0 +#define XADTRUE 1 +#define XADMEMF_ANY (0) +#define XADMEMF_CLEAR (1L << 16) +#define XADMEMF_PUBLIC (1L << 0) + +#ifndef DOS_DOS_H +#include +#endif + +#ifndef EXEC_LIBRARIES_H +#include +#endif + +#ifndef UTILITY_TAGITEM_H +#include +#endif + +#define XADNAME "xadmaster.library" + +/* portability defines */ +#define XADM + +typedef BPTR xadFileHandle; +typedef Tag xadTag; +typedef struct TagItem * xadTAGPTR; + +/* on the Amiga, pointer size == int size == 32 bits */ +#define TAG_PTR TAG_USER +#define TAG_INT TAG_USER +#define TAG_SIZ TAG_USER + +/* NOTE: Nearly all structures need to be allocated using the + xadAllocObject function. */ + +/************************************************************************ +* * +* library base structure * +* * +************************************************************************/ + +struct xadMasterBase { + struct Library xmb_LibNode; + struct ExecBase * xmb_SysBase; + struct DosLibrary * xmb_DOSBase; + struct UtilityBase * xmb_UtilityBase; + xadSize xmb_RecogSize; /* read only */ + xadSTRPTR xmb_DefaultName; /* name for XADFIF_NOFILENAME (V6) */ +}; + +/************************************************************************ +* * +* tag-function call flags * +* * +************************************************************************/ + +/* input tags for xadGetInfo, only one can be specified per call */ +#define XAD_INSIZE (TAG_SIZ+ 1) /* input data size */ +#define XAD_INFILENAME (TAG_PTR+ 2) +#define XAD_INFILEHANDLE (TAG_PTR+ 3) +#define XAD_INMEMORY (TAG_PTR+ 4) +#define XAD_INHOOK (TAG_PTR+ 5) +#define XAD_INSPLITTED (TAG_PTR+ 6) /* (V2) */ +#define XAD_INDISKARCHIVE (TAG_PTR+ 7) /* (V4) */ +#define XAD_INXADSTREAM (TAG_PTR+ 8) /* (V8) */ +#define XAD_INDEVICE (TAG_PTR+ 9) /* (V11) */ + +/* output tags, only one can be specified per call, xadXXXXUnArc */ +#define XAD_OUTSIZE (TAG_SIZ+ 10) /* output data size */ +#define XAD_OUTFILENAME (TAG_PTR+ 11) +#define XAD_OUTFILEHANDLE (TAG_PTR+ 12) +#define XAD_OUTMEMORY (TAG_PTR+ 13) +#define XAD_OUTHOOK (TAG_PTR+ 14) +#define XAD_OUTDEVICE (TAG_PTR+ 15) +#define XAD_OUTXADSTREAM (TAG_PTR+ 16) /* (V8) */ + +/* object allocation tags for xadAllocObjectA */ +#define XAD_OBJNAMESIZE (TAG_INT+ 20) /* XADOBJ_FILEINFO, size of needed name space */ +#define XAD_OBJCOMMENTSIZE (TAG_INT+ 21) /* XADOBJ_FILEINFO, size of needed comment space */ +#define XAD_OBJPRIVINFOSIZE (TAG_INT+ 22) /* XADOBJ_FILEINFO & XADOBJ_DISKINFO, self use size */ +#define XAD_OBJBLOCKENTRIES (TAG_INT+ 23) /* XADOBJ_DISKINFO, number of needed entries */ + +/* tags for xadGetInfo, xadFileUnArc and xadDiskUnArc */ +#define XAD_NOEXTERN (TAG_INT+ 50) /* do not use extern clients */ +#define XAD_PASSWORD (TAG_PTR+ 51) /* password when needed */ +#define XAD_ENTRYNUMBER (TAG_INT+ 52) /* number of wanted entry */ +#define XAD_PROGRESSHOOK (TAG_PTR+ 53) /* the progress hook */ +#define XAD_OVERWRITE (TAG_INT+ 54) /* overwrite file ? */ +#define XAD_MAKEDIRECTORY (TAG_INT+ 55) /* create directory tree */ +#define XAD_IGNOREGEOMETRY (TAG_INT+ 56) /* ignore drive geometry ? */ +#define XAD_LOWCYLINDER (TAG_INT+ 57) /* lowest cylinder */ +#define XAD_HIGHCYLINDER (TAG_INT+ 58) /* highest cylinder */ +#define XAD_VERIFY (TAG_INT+ 59) /* verify for disk hook */ +#define XAD_NOKILLPARTIAL (TAG_INT+ 60) /* do not delete partial/corrupt files (V3.3) */ +#define XAD_FORMAT (TAG_INT+ 61) /* format output device (V5) */ +#define XAD_USESECTORLABELS (TAG_INT+ 62) /* sector labels are stored on disk (V9) */ +#define XAD_IGNOREFLAGS (TAG_INT+ 63) /* ignore the client, if certain flags are set (V11) */ +#define XAD_ONLYFLAGS (TAG_INT+ 64) /* ignore the client, if certain flags are NOT set (V11) */ + +/* input tags for xadConvertDates, only one can be passed */ +#define XAD_DATEUNIX (TAG_INT+ 70) /* unix date variable */ +#define XAD_DATEAMIGA (TAG_INT+ 71) /* Amiga date variable */ +#define XAD_DATEDATESTAMP (TAG_PTR+ 72) /* Amiga struct DateStamp */ +#define XAD_DATEXADDATE (TAG_PTR+ 73) /* struct xadDate */ +#define XAD_DATECLOCKDATA (TAG_PTR+ 74) /* Amiga struct ClockData */ +#define XAD_DATECURRENTTIME (TAG_INT+ 75) /* input is system time */ +#define XAD_DATEMSDOS (TAG_INT+ 76) /* MS-DOS packed format (V2) */ +#define XAD_DATEMAC (TAG_INT+ 77) /* Mac date variable (V8) */ +#define XAD_DATECPM (TAG_PTR+ 78) /* CP/M data structure (V10) */ +#define XAD_DATECPM2 (TAG_INT+ 79) /* CP/M data structure type 2 (V10) */ +#define XAD_DATEISO9660 (TAG_PTR+300) /* ISO9660 date structure (V11) */ + +/* output tags, there can be specified multiple tags for one call */ +#define XAD_GETDATEUNIX (TAG_PTR+ 80) /* unix date variable */ +#define XAD_GETDATEAMIGA (TAG_PTR+ 81) /* Amiga date variable */ +#define XAD_GETDATEDATESTAMP (TAG_PTR+ 82) /* Amiga struct DateStamp */ +#define XAD_GETDATEXADDATE (TAG_PTR+ 83) /* struct xadDate */ +#define XAD_GETDATECLOCKDATA (TAG_PTR+ 84) /* Amiga struct ClockData */ +#define XAD_GETDATEMSDOS (TAG_PTR+ 86) /* MS-DOS packed format (V2) */ +#define XAD_GETDATEMAC (TAG_PTR+ 87) /* Mac date variable (V8) */ +#define XAD_GETDATECPM (TAG_PTR+ 88) /* CP/M data structure (V10) */ +#define XAD_GETDATECPM2 (TAG_PTR+ 89) /* CP/M data structure type 2 (V10) */ +#define XAD_GETDATEISO9660 (TAG_PTR+320) /* ISO9660 date structure (V11) */ + +/* following tags need locale.library to be installed on Amiga */ +#define XAD_MAKEGMTDATE (TAG_INT+ 90) /* make local to GMT time */ +#define XAD_MAKELOCALDATE (TAG_INT+ 91) /* make GMT to local time */ + +/* tags for xadHookTagAccess (V3) */ +#define XAD_USESKIPINFO (TAG_INT+104) /* the hook uses xadSkipInfo (V3) */ +#define XAD_SECTORLABELS (TAG_PTR+105) /* pass sector labels with XADAC_WRITE (V9) */ + +#define XAD_GETCRC16 (TAG_PTR+120) /* pointer to xadUINT16 value (V3) */ +#define XAD_GETCRC32 (TAG_PTR+121) /* pointer to xadUINT32 value (V3) */ + +#define XAD_CRC16ID (TAG_INT+130) /* ID for crc calculation (V3) */ +#define XAD_CRC32ID (TAG_INT+131) /* ID for crc calculation (V3) */ + +/* tags for xadConvertProtection (V4) */ +#define XAD_PROTAMIGA (TAG_INT+160) /* Amiga type protection bits (V4) */ +#define XAD_PROTUNIX (TAG_INT+161) /* protection bits in UNIX mode (V4) */ +#define XAD_PROTMSDOS (TAG_INT+162) /* MSDOS type protection bits (V4) */ +#define XAD_PROTFILEINFO (TAG_PTR+163) /* input is a xadFileInfo structure (V11) */ + +#define XAD_GETPROTAMIGA (TAG_PTR+170) /* return Amiga protection bits (V4) */ +#define XAD_GETPROTUNIX (TAG_PTR+171) /* return UNIX protection bits (V11) */ +#define XAD_GETPROTMSDOS (TAG_PTR+172) /* return MSDOS protection bits (V11) */ +#define XAD_GETPROTFILEINFO (TAG_PTR+173) /* fill xadFileInfo protection fields (V11) */ + +/* tags for xadGetDiskInfo (V7) */ +#define XAD_STARTCLIENT (TAG_PTR+180) /* the client to start with (V7) */ +#define XAD_NOEMPTYERROR (TAG_INT+181) /* do not create XADERR_EMPTY (V8) */ + +/* tags for xadFreeHookAccess (V8) */ +#define XAD_WASERROR (TAG_INT+190) /* error occured, call abort method (V8) */ + +/* tags for miscellaneous stuff */ +#define XAD_ARCHIVEINFO (TAG_PTR+200) /* xadArchiveInfo for stream hooks (V8) */ +#define XAD_ERRORCODE (TAG_PTR+201) /* error code of function (V12) */ +#define XAD_EXTENSION (TAG_PTR+202) /* argument for xadGetDefaultName() (V13) */ + +/* tags for xadAddFileEntry and xadAddDiskEntry (V10) */ +#define XAD_SETINPOS (TAG_SIZ+240) /* set xai_InPos after call (V10) */ +#define XAD_INSERTDIRSFIRST (TAG_INT+241) /* insert dirs at list start (V10) */ + +/* tags for xadConvertName (V12) */ +#define XAD_PATHSEPERATOR (TAG_PTR+260) /* xadUINT16 *, default is {'/','\\',0} in source charset (V12) */ +#define XAD_CHARACTERSET (TAG_INT+261) /* the characterset of string (V12) */ +#define XAD_STRINGSIZE (TAG_INT+262) /* maximum size of following (V12) */ +#define XAD_CSTRING (TAG_PTR+263) /* zero-terminated string (V12) */ +#define XAD_PSTRING (TAG_PTR+264) /* lengthed Pascal string (V12) */ +#define XAD_XADSTRING (TAG_PTR+265) /* an xad string (V12) */ +#define XAD_ADDPATHSEPERATOR (TAG_INT+266) /* default is TRUE (V12) */ + +/* tags for xadGetFilename (V12) */ +#define XAD_NOLEADINGPATH (TAG_INT+280) /* default is FALSE (V12) */ +#define XAD_NOTRAILINGPATH (TAG_INT+281) /* default is FALSE (V12) */ +#define XAD_MASKCHARACTERS (TAG_PTR+282) /* default are #?()[]~%*:|",1-31,127-160 (V12) */ +#define XAD_MASKINGCHAR (TAG_INT+283) /* default is '_' (V12) */ +#define XAD_REQUIREDBUFFERSIZE (TAG_PTR+284) /* pointer which should hold buf size (V12) */ + +/* Places 300-339 used for dates! */ + +/************************************************************************ +* * +* objects for xadAllocObjectA * +* * +************************************************************************/ + +#define XADOBJ_ARCHIVEINFO 0x0001 /* struct xadArchiveInfo */ +#define XADOBJ_FILEINFO 0x0002 /* struct xadFileInfo */ +#define XADOBJ_DISKINFO 0x0003 /* struct xadDiskInfo */ +#define XADOBJ_HOOKPARAM 0x0004 /* struct HookParam */ +#define XADOBJ_DEVICEINFO 0x0005 /* struct xadDeviceInfo */ +#define XADOBJ_PROGRESSINFO 0x0006 /* struct xadProgressInfo */ +#define XADOBJ_TEXTINFO 0x0007 /* struct xadTextInfo */ +#define XADOBJ_SPLITFILE 0x0008 /* struct xadSplitFile (V2) */ +#define XADOBJ_SKIPINFO 0x0009 /* struct xadSkipInfo (V3) */ +#define XADOBJ_IMAGEINFO 0x000A /* struct xadImageInfo (V4) */ +#define XADOBJ_SPECIAL 0x000B /* struct xadSpecial (V11) */ + +/* result type of xadAllocVec */ +#define XADOBJ_MEMBLOCK 0x0100 /* memory of requested size and type */ +/* private type */ +#define XADOBJ_STRING 0x0101 /* a typed XAD string (V12) */ + +/************************************************************************ +* * +* modes for xadCalcCRC126 and xadCalcCRC32 * +* * +************************************************************************/ + +#define XADCRC16_ID1 0xA001 +#define XADCRC32_ID1 0xEDB88320 + +/************************************************************************ +* * +* hook related stuff * +* * +************************************************************************/ + +#define XADHC_READ 1 /* read data into buffer */ +#define XADHC_WRITE 2 /* write buffer data to file/memory */ +#define XADHC_SEEK 3 /* seek in file */ +#define XADHC_INIT 4 /* initialize the hook */ +#define XADHC_FREE 5 /* end up hook work, free stuff */ +#define XADHC_ABORT 6 /* an error occured, delete partial stuff */ +#define XADHC_FULLSIZE 7 /* complete input size is needed */ +#define XADHC_IMAGEINFO 8 /* return disk image info (V4) */ + +struct xadHookParam { + xadUINT32 xhp_Command; + xadSignSize xhp_CommandData; + xadPTR xhp_BufferPtr; + xadSize xhp_BufferSize; + xadSize xhp_DataPos; /* current seek position */ + xadPTR xhp_PrivatePtr; + xadTAGPTR xhp_TagList; /* allows to transport tags to hook (V9) */ +}; + +/* xadHookAccess commands */ +#define XADAC_READ 10 /* get data */ +#define XADAC_WRITE 11 /* write data */ +#define XADAC_COPY 12 /* copy input to output */ +#define XADAC_INPUTSEEK 13 /* seek in input file */ +#define XADAC_OUTPUTSEEK 14 /* seek in output file */ + +/************************************************************************ +* * +* support structures * +* * +************************************************************************/ + +/* Own date structure to cover all possible dates in a human friendly + format. xadConvertDates may be used to convert between different date + structures and variables. */ +struct xadDate { + xadUINT32 xd_Micros; /* values 0 to 999999 */ + xadINT32 xd_Year; /* values 1 to 2147483648 */ + xadUINT8 xd_Month; /* values 1 to 12 */ + xadUINT8 xd_WeekDay; /* values 1 to 7 */ + xadUINT8 xd_Day; /* values 1 to 31 */ + xadUINT8 xd_Hour; /* values 0 to 23 */ + xadUINT8 xd_Minute; /* values 0 to 59 */ + xadUINT8 xd_Second; /* values 0 to 59 */ +}; + +#define XADDAY_MONDAY 1 /* monday is the first day and */ +#define XADDAY_TUESDAY 2 +#define XADDAY_WEDNESDAY 3 +#define XADDAY_THURSDAY 4 +#define XADDAY_FRIDAY 5 +#define XADDAY_SATURDAY 6 +#define XADDAY_SUNDAY 7 /* sunday the last day of a week */ + +struct xadDeviceInfo { /* for XAD_OUTDEVICE tag */ + xadSTRPTR xdi_DeviceName; /* name of device */ + xadUINT32 xdi_Unit; /* unit of device */ + xadSTRPTR xdi_DOSName; /* instead of Device+Unit, dos name without ':' */ +}; + +struct xadSplitFile { /* for XAD_INSPLITTED */ + struct xadSplitFile *xsf_Next; + xadUINT32 xsf_Type; /* XAD_INFILENAME, XAD_INFILEHANDLE, XAD_INMEMORY, XAD_INHOOK */ + xadSize xsf_Size; /* necessary for XAD_INMEMORY, useful for others */ + xadUINT32 xsf_Data; /* FileName, Filehandle, Hookpointer or Memory */ +}; + +struct xadSkipInfo { + struct xadSkipInfo *xsi_Next; + xadSize xsi_Position; /* position, where it should be skipped */ + xadSize xsi_SkipSize; /* size to skip */ +}; + +struct xadImageInfo { /* for XADHC_IMAGEINFO */ + xadUINT32 xii_SectorSize; /* usually 512 */ + xadUINT32 xii_FirstSector; /* of the image file */ + xadUINT32 xii_NumSectors; /* of the image file */ + xadUINT32 xii_TotalSectors; /* of this device type */ +}; +/* If the image file holds total data of disk xii_TotalSectors equals + xii_NumSectors and xii_FirstSector is zero. Addition of xii_FirstSector + and xii_NumSectors cannot exceed xii_TotalSectors value! +*/ + +/************************************************************************ +* * +* system information structure * +* * +************************************************************************/ +struct xadSystemInfo { + xadUINT16 xsi_Version; /* master library version */ + xadUINT16 xsi_Revision; /* master library revision */ + xadSize xsi_RecogSize; /* size for recognition */ +}; + +/************************************************************************ +* * +* information structures * +* * +************************************************************************/ + +struct xadArchiveInfo { + struct xadClient * xai_Client; /* pointer to unarchiving client */ + xadPTR xai_PrivateClient; /* private client data */ + xadSTRPTR xai_Password; /* password for crypted archives */ + xadUINT32 xai_Flags; /* read only XADAIF_ flags */ + xadUINT32 xai_LowCyl; /* lowest cylinder to unarchive */ + xadUINT32 xai_HighCyl; /* highest cylinder to unarchive */ + xadSize xai_InPos; /* input position, read only */ + xadSize xai_InSize; /* input size, read only */ + xadSize xai_OutPos; /* output position, read only */ + xadSize xai_OutSize; /* output file size, read only */ + struct xadFileInfo * xai_FileInfo; /* data pointer for file arcs */ + struct xadDiskInfo * xai_DiskInfo; /* data pointer for disk arcs */ + struct xadFileInfo * xai_CurFile; /* data pointer for current file arc */ + struct xadDiskInfo * xai_CurDisk; /* data pointer for current disk arc */ + xadERROR xai_LastError; /* last error, when XADAIF_FILECORRUPT (V2) */ + xadSize * xai_MultiVolume; /* array of start offsets from parts (V2) */ + struct xadSkipInfo * xai_SkipInfo; /* linked list of skip entries (V3) */ + struct xadImageInfo *xai_ImageInfo; /* for filesystem clients (V5) */ + xadSTRPTR xai_InName; /* Input archive name if available (V7) */ +}; +/* This structure is nearly complete private to either xadmaster or its +clients. An application program may access for reading only xai_Client, +xai_Flags, xai_FileInfo and xai_DiskInfo. For xai_Flags only XADAIF_CRYPTED +and XADAIF_FILECORRUPT are useful. All the other stuff is private and should +not be accessed! */ + +#define XADAIB_CRYPTED 0 /* archive entries are encrypted */ +#define XADAIB_FILECORRUPT 1 /* file is corrupt, but valid entries are in the list */ +#define XADAIB_FILEARCHIVE 2 /* unarchive file entry */ +#define XADAIB_DISKARCHIVE 3 /* unarchive disk entry */ +#define XADAIB_OVERWRITE 4 /* overwrite the file (PRIVATE) */ +#define XADAIB_MAKEDIRECTORY 5 /* create directory when missing (PRIVATE) */ +#define XADAIB_IGNOREGEOMETRY 6 /* ignore drive geometry (PRIVATE) */ +#define XADAIB_VERIFY 7 /* verify is turned on for disk hook (PRIVATE) */ +#define XADAIB_NOKILLPARTIAL 8 /* do not delete partial files (PRIVATE) */ +#define XADAIB_DISKIMAGE 9 /* is disk image extraction (V5) */ +#define XADAIB_FORMAT 10 /* format in disk hook (PRIVATE) */ +#define XADAIB_NOEMPTYERROR 11 /* do not create empty error (PRIVATE) */ +#define XADAIB_ONLYIN 12 /* in stuff only (PRIVATE) */ +#define XADAIB_ONLYOUT 13 /* out stuff only (PRIVATE) */ +#define XADAIB_USESECTORLABELS 14 /* use SectorLabels (PRIVATE) */ + +#define XADAIF_CRYPTED (1<) are currently not supported with normal + Amiga filesystem. But the clients support them, if archive format holds + such information. + + The protection bits (all 3 fields) should always be set using the + xadConvertProtection procedure. Call it with as much protection information + as possible. It extracts the relevant data at best (and also sets the 2 flags). + DO NOT USE these fields directly, but always through xadConvertProtection + call. +*/ + +#define XADFIB_CRYPTED 0 /* entry is crypted */ +#define XADFIB_DIRECTORY 1 /* entry is a directory */ +#define XADFIB_LINK 2 /* entry is a link */ +#define XADFIB_INFOTEXT 3 /* file is an information text */ +#define XADFIB_GROUPED 4 /* file is in a crunch group */ +#define XADFIB_ENDOFGROUP 5 /* crunch group ends here */ +#define XADFIB_NODATE 6 /* no date supported, CURRENT date is set */ +#define XADFIB_DELETED 7 /* file is marked as deleted (V3) */ +#define XADFIB_SEEKDATAPOS 8 /* before unarchiving the datapos is set (V3) */ +#define XADFIB_NOFILENAME 9 /* there was no filename, using internal one (V6) */ +#define XADFIB_NOUNCRUNCHSIZE 10 /* file size is unknown and thus set to zero (V6) */ +#define XADFIB_PARTIALFILE 11 /* file is only partial (V6) */ +#define XADFIB_MACDATA 12 /* file is Apple data fork (V7) */ +#define XADFIB_MACRESOURCE 13 /* file is Apple resource fork (V7) */ +#define XADFIB_EXTRACTONBUILD 14 /* allows extract file during scanning (V10) */ +#define XADFIB_UNIXPROTECTION 15 /* UNIX protection bits are present (V11) */ +#define XADFIB_DOSPROTECTION 16 /* MSDOS protection bits are present (V11) */ +#define XADFIB_ENTRYMAYCHANGE 17 /* this entry may change until GetInfo is finished (V11) */ +#define XADFIB_XADSTRFILENAME 18 /* the xfi_FileName fields is an XAD string (V12) */ +#define XADFIB_XADSTRLINKNAME 19 /* the xfi_LinkName fields is an XAD string (V12) */ +#define XADFIB_XADSTRCOMMENT 20 /* the xfi_Comment fields is an XAD string (V12) */ + +#define XADFIF_CRYPTED (1<