@ GNU AS assembler header file for Zipper
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:50:43 2012
@ Tom Hughes, tom@compton.nu, 22 Sep 2002

@ OSLib---efficient, type-safe, transparent, extensible,
@ register-safe API coverage of RISC OS
@ 
@ Copyright (c) 1994-2012 Jonathan Coxhead and OSLib maintainers
@ 
@ Licence:
@ 
@    OSLib is free software; you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation; either version 1, or (at your option)
@ any later version - and this with the following clarification and
@ special exception:
@ 
@    Linking this library statically or dynamically with other modules
@ is making a combined work based on this library. Thus, the terms
@ and conditions of the GNU General Public License cover the whole
@ combination.
@ 
@    As a special exception, the copyright holders of this library
@ give you permission to link this library with independent modules
@ to produce an executable, regardless of the license terms of these
@ independent modules, and to copy and distribute the resulting
@ executable under terms of your choice, provided that you also meet,
@ for each linked independent module, the terms and conditions of the
@ license of that module. An independent module is a module which is
@ not derived from or based on this library. If you modify this
@ library, you may extend this exception to your version of the library,
@ but you are not obliged to do so. If you do not wish to do so, delete
@ this exception statement from your version.
@ 
@    OSLib 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 General Public License for more details.
@ 
@    You should have received a copy of the GNU General Public License
@ along with this programme; if not, write to the Free Software
@ Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, USA.

#ifndef Zipper_Hdr
#  define Zipper_Hdr

#  ifndef Get_Types
#    define Get_Types
#    include "oslib/Types.Hdr"
#  endif

#  ifndef Get_FileSwitch
#    define Get_FileSwitch
#    include "oslib/FileSwitch.Hdr"
#  endif

@Symbols for constants
#  define ZipperOpenFlags_Append 0x1
#  define ZipperOpenFlags_NoDiscard 0x80000000
#  define ZipperEnumerateFlags_CreatorVersionNumber 0x1
#  define ZipperEnumerateFlags_GeneralPurposeFlags 0x2
#  define ZipperEnumerateFlags_CompressionMethod 0x4
#  define ZipperEnumerateFlags_CompressedSize 0x8
#  define ZipperEnumerateFlags_ExpandedSize 0x10
#  define ZipperEnumerateFlags_InternalAttributes 0x20
#  define ZipperEnumerateFlags_ExternalAttributes 0x40
#  define ZipperEnumerateFlags_Timestamp 0x80
#  define ZipperEnumerateFlags_LoadAndExecAddress 0x100
#  define ZipperEnumerateFlags_ROExpandedSize 0x200
#  define ZipperEnumerateFlags_ROAttributes 0x400
#  define ZipperEnumerateFlags_ROObjectType 0x800
#  define ZipperEnumerateFlags_ROFileType 0x1000
#  define ZipperEnumerateFlags_GBPBFilenameLen 0x2000
#  define ZipperEnumerateFlags_FilenameLen 0x4000
#  define ZipperEnumerateFlags_ExtraInfoLen 0x8000
#  define ZipperEnumerateFlags_FileCommentLen 0x10000
#  define ZipperFileOpenFlags_ROStyleTimeSpecifier 0x1
#  define ZipperFileOpenFlags_ObjIsDir 0x2
#  define ZipperFileOpenFlags_ObjIsText 0x4
#  define ZipperFileOpenFlags_ExtraField 0x8
#  define ZipperFileOpenFlags_CommentField 0x10
#  define ZipperFileOpenFlags_FileAttributes 0x20
#  define Zipper_CompressionMethod 0xff
#  define Zipper_CompressionMethodShift 0x0
#  define Zipper_CompressionLevel 0xf00
#  define Zipper_CompressionLevelShift 0x8
#  define Zipper_CompressionMethodStore 0x0
#  define Zipper_CompressionMethodDeflate 0x8
#  define Zipper_CompressionLevelMinimum 0x1
#  define Zipper_CompressionLevelMaximum 0x9

@Symbols for structure offsets and sizes
@ abstract type
#  define Zipper_UnZipHandle 4

@ abstract type
#  define Zipper_ZipHandle 4

        .struct 0
        .skip   Bits
Zipper_OpenFlags               : 

        .struct 0
        .skip   Bits
Zipper_CloseFlags              : 

        .struct 0
        .skip   Bits
Zipper_InfoFlags               : 

        .struct 0
        .skip   Bits
Zipper_EnumerateFlags          : 

        .struct 0
        .skip   Bits
Zipper_UnZipFileOpenFlags      : 

        .struct 0
        .skip   Bits
Zipper_UnZipFileCloseFlags     : 

        .struct 0
        .skip   Bits
Zipper_UnZipFileReadFlags      : 

        .struct 0
        .skip   Bits
Zipper_UnZipFileEOFFlags       : 

        .struct 0
        .skip   Bits
Zipper_ZipFileOpenFlags        : 

        .struct 0
        .skip   Bits
Zipper_ZipFileCloseFlags       : 

        .struct 0
        .skip   Bits
Zipper_ZipFileWriteFlags       : 

        .struct 0
        .skip   Bits
Zipper_CompressionDetails      : 

        .struct 0
Zipper_TimeSpecifier_riscos_style_load_addr: .skip   Bits
Zipper_TimeSpecifier_riscos_style_exec_addr: .skip   Bits
Zipper_TimeSpecifier_riscos_style_attr: .skip   FileSwitch_Attr
        .struct 0
Zipper_TimeSpecifier_zip_style_centiseconds: .skip   Int
Zipper_TimeSpecifier_zip_style_seconds: .skip   Int
Zipper_TimeSpecifier_zip_style_minutes: .skip   Int
Zipper_TimeSpecifier_zip_style_hours: .skip   Int
Zipper_TimeSpecifier_zip_style_date: .skip   Int
Zipper_TimeSpecifier_zip_style_month: .skip   Int
Zipper_TimeSpecifier_zip_style_year: .skip   Int
Zipper_TimeSpecifier           : 

        .struct 0
Zipper_FileAttributes_internal : .skip   Bits
Zipper_FileAttributes_external : .skip   Bits
Zipper_FileAttributes          : 


@Symbols for SWI's and SWI reason codes
.set XZipper_UnZipOpen,0x759c0
.set Zipper_UnZipOpen,0x559c0
   @Entry
   @  R0 = flags (Zipper_OpenFlags)
   @  R1 -> filename (Char)
   @Exit
   @  R0 = handle (Zipper_UnZipHandle)

.set XZipper_UnZipClose,0x759c1
.set Zipper_UnZipClose,0x559c1
   @Entry
   @  R0 = flags (Zipper_CloseFlags)
   @  R1 = handle (Zipper_UnZipHandle)

.set XZipper_UnZipInfo,0x759c2
.set Zipper_UnZipInfo,0x559c2

#  define Zipper_UnZipInfoObjectCount 0x0
   @Entry
   @  R0 = &0 :OR: flags (Zipper_InfoFlags)
   @  R1 = handle (Zipper_UnZipHandle)
   @Exit
   @  R0 = objects (Int)

#  define Zipper_UnZipInfoArchiveComment 0x1
   @Entry
   @  R0 = &1 :OR: flags (Zipper_InfoFlags)
   @  R1 = handle (Zipper_UnZipHandle)
   @  R2 = buffer (pointer to data)
   @  R3 = buffer_size (Int)
   @Exit
   @  R0 = read (Int)

.set XZipper_UnZipEnumerate,0x759c3
.set Zipper_UnZipEnumerate,0x559c3
   @Entry
   @  R0 = flags (Zipper_EnumerateFlags)
   @  R1 = handle (Zipper_UnZipHandle)
   @  R2 = buffer (pointer to data)
   @  R3 = objects (Int)
   @  R4 = offset (Int)
   @  R5 = buffer_size (Int)
   @Exit
   @  R3 = objects_read (Int)
   @  R4 = next_offset (Int)
   @  R5 = buffer_unused (Int)

.set XZipper_UnZipFileInfoToBuffer,0x759c4
.set Zipper_UnZipFileInfoToBuffer,0x559c4
   @Entry
   @  R0 = flags (Zipper_EnumerateFlags)
   @  R1 = handle (Zipper_UnZipHandle)
   @  R2 -> filename (Char)
   @  R3 = data (pointer to data)
   @  R4 = data_size (Int)
   @Exit
   @  R3 = data_end (pointer to data)
   @  R4 = data_unused (Int)

#  define Zipper_UnZipFileInfoToRegisters 0x0
   @Entry
   @  R0 = &0
   @  R1 = handle (Zipper_UnZipHandle)
   @  R2 -> filename (Char)
   @Exit
   @  R0 = obj_type (FileSwitch_ObjectType)
   @  R2 = load_address (Bits)
   @  R3 = exec_address (Bits)
   @  R4 = size (Int)
   @  R5 = attr (FileSwitch_Attr)

.set XZipper_UnZipFileOpen,0x759c5
.set Zipper_UnZipFileOpen,0x559c5
   @Entry
   @  R0 = flags (Zipper_UnZipFileOpenFlags)
   @  R1 = handle (Zipper_UnZipHandle)
   @  R2 -> filename (Char)

.set XZipper_UnZipFileClose,0x759c6
.set Zipper_UnZipFileClose,0x559c6
   @Entry
   @  R0 = flags (Zipper_UnZipFileCloseFlags)
   @  R1 = handle (Zipper_UnZipHandle)

.set XZipper_UnZipFileRead,0x759c7
.set Zipper_UnZipFileRead,0x559c7
   @Entry
   @  R0 = flags (Zipper_UnZipFileReadFlags)
   @  R1 = handle (Zipper_UnZipHandle)
   @  R2 = data (pointer to data)
   @  R3 = size (Int)
   @Exit
   @  R0 = read (Int)

.set XZipper_UnZipFileEOF,0x759c8
.set Zipper_UnZipFileEOF,0x559c8
   @Entry
   @  R0 = flags (Zipper_UnZipFileEOFFlags)
   @  R1 = handle (Zipper_UnZipHandle)
   @Exit
   @  R0 = eof (Bool)

.set XZipper_ZipOpen,0x759d0
.set Zipper_ZipOpen,0x559d0
   @Entry
   @  R0 = flags (Zipper_OpenFlags)
   @  R1 -> filename (Char)
   @Exit
   @  R0 = handle (Zipper_ZipHandle)

.set XZipper_ZipClose,0x759d1
.set Zipper_ZipClose,0x559d1
   @Entry
   @  R0 = flags (Zipper_CloseFlags)
   @  R1 = handle (Zipper_ZipHandle)

.set XZipper_ZipFileOpen,0x759d2
.set Zipper_ZipFileOpen,0x559d2
   @Entry
   @  R0 = flags (Zipper_ZipFileOpenFlags)
   @  R1 = handle (Zipper_ZipHandle)
   @  R2 -> filename (Char)
   @  R3 = compression_details (Zipper_CompressionDetails)
   @  R4 -> time_specifier (Zipper_TimeSpecifier)
   @  R5 -> extra (data)
   @  R6 = extra_size (Int)
   @  R7 -> comment (Char)
   @  R8 -> attr (Zipper_FileAttributes)

.set XZipper_ZipFileClose,0x759d3
.set Zipper_ZipFileClose,0x559d3
   @Entry
   @  R0 = flags (Zipper_ZipFileCloseFlags)
   @  R1 = handle (Zipper_ZipHandle)
   @Exit
   @  R0 = uncompressed_size (Int)
   @  R1 = compressed_size (Int)

.set XZipper_ZipFileWrite,0x759d4
.set Zipper_ZipFileWrite,0x559d4
   @Entry
   @  R0 = flags (Zipper_ZipFileWriteFlags)
   @  R1 = handle (Zipper_ZipHandle)
   @  R2 = data (pointer to data)
   @  R3 = size (Int)

#endif
