@ GNU AS assembler header file for URI
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:46:01 2012
@ Tom Hughes, tom@compton.nu, 27 Mar 1999

@ 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 URI_Hdr
#  define URI_Hdr

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

#  ifndef Get_OS
#    define Get_OS
#    include "oslib/OS.Hdr"
#  endif

#  ifndef Get_Wimp
#    define Get_Wimp
#    include "oslib/Wimp.Hdr"
#  endif

@Symbols for constants
#  define URI_FileType 0xf91
#  define Message_URIHandlerStarted 0x4e380
#  define Message_URIHandlerDying 0x4e381
#  define Message_URIProcess 0x4e382
#  define Message_URIReturnResult 0x4e383
#  define Message_URIProcessAck 0x4e384
#  define URI_ProcessCheckOnly 0x1
#  define URI_ReturnResultNotClaimed 0x1
#  define URI_DispatchInformCaller 0x1
#  define URI_DispatchCheckOnly 0x2
#  define URI_DispatchNoExternalStartup 0x4
#  define URI_DispatchRequestRejected 0x1
#  define Error_URINoMemory 0x810a01
#  define Error_URIBadURI 0x810a02
#  define Error_URIBadHandle 0x810a03
#  define Error_URIBadFile 0x810a04

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

        .struct 0
        .skip   Bits
URI_ProcessFlags               : 

        .struct 0
        .skip   Bits
URI_ReturnResultFlags          : 

        .struct 0
URI_MessageHandlerStarted_flags: .skip   Bits
URI_MessageHandlerStarted      : 

        .struct 0
URI_MessageHandlerDying_flags  : .skip   Bits
URI_MessageHandlerDying        : 

        .struct 0
URI_MessageProcess_flags       : .skip   URI_ProcessFlags
URI_MessageProcess_uri         : .skip   Ptr
URI_MessageProcess_handle      : .skip   URI_H
URI_MessageProcess             : 

        .struct 0
URI_MessageReturnResult_flags  : .skip   URI_ReturnResultFlags
URI_MessageReturnResult_handle : .skip   URI_H
URI_MessageReturnResult        : 

        .struct 0
URI_MessageProcessAck_flags    : .skip   URI_ProcessFlags
URI_MessageProcessAck_uri      : .skip   Ptr
URI_MessageProcessAck_handle   : .skip   URI_H
URI_MessageProcessAck          : 

        .struct 0
        Wimp_MessageHeader_MEMBERS URI_FullMessageHandlerStarted
URI_FullMessageHandlerStarted_flags: .skip   Bits
URI_FullMessageHandlerStarted  : 

        .struct 0
        Wimp_MessageHeader_MEMBERS URI_FullMessageHandlerDying
URI_FullMessageHandlerDying_flags: .skip   Bits
URI_FullMessageHandlerDying    : 

        .struct 0
        Wimp_MessageHeader_MEMBERS URI_FullMessageProcess
URI_FullMessageProcess_flags   : .skip   URI_ProcessFlags
URI_FullMessageProcess_uri     : .skip   Ptr
URI_FullMessageProcess_handle  : .skip   URI_H
URI_FullMessageProcess         : 

        .struct 0
        Wimp_MessageHeader_MEMBERS URI_FullMessageReturnResult
URI_FullMessageReturnResult_flags: .skip   URI_ReturnResultFlags
URI_FullMessageReturnResult_handle: .skip   URI_H
URI_FullMessageReturnResult    : 

        .struct 0
        Wimp_MessageHeader_MEMBERS URI_FullMessageProcessAck
URI_FullMessageProcessAck_flags: .skip   URI_ProcessFlags
URI_FullMessageProcessAck_uri  : .skip   Ptr
URI_FullMessageProcessAck_handle: .skip   URI_H
URI_FullMessageProcessAck      : 

        .struct 0
        .skip   Bits
URI_DispatchFlags              : 

        .struct 0
        .skip   Bits
URI_DispatchResultFlags        : 


@Symbols for SWI's and SWI reason codes
.set XURI_Version,0x6e380
.set URI_Version,0x4e380
   @Entry
   @  R0 = flags (Bits)
   @Exit
   @  R0 = version (Int)

.set XURI_Dispatch,0x6e381
.set URI_Dispatch,0x4e381
   @Entry
   @  R0 = flags (URI_DispatchFlags)
   @  R1 -> uri (String)
   @  R2 = source_task (Wimp_T)
   @Exit
   @  R0 = flags_out (URI_DispatchResultFlags)
   @  R2 = handler_task (Wimp_T)
   @  R3 = handle (URI_H)

.set XURI_RequestURISize,0x6e382
.set URI_RequestURISize,0x4e382
   @Entry
   @  R0 = flags (Bits)
   @  R1 = &0
   @  R3 = handle (URI_H)
   @Exit
   @  R2 = buffer_size (Int)

.set XURI_RequestURI,0x6e382
.set URI_RequestURI,0x4e382
   @Entry
   @  R0 = flags (Bits)
   @  R1 = buffer (pointer to String)
   @  R2 = buffer_size (Int)
   @  R3 = handle (URI_H)
   @Exit
   @  R2 = length (Int)

.set XURI_InvalidateURI,0x6e383
.set URI_InvalidateURI,0x4e383
   @Entry
   @  R0 = flags (Bits)
   @  R3 = handle (URI_H)

#  define Service_URI 0xa7

#  define Service_URIHandlerStarted 0x0
   @Entry
   @  R0 = &0
   @  R1 = &A7

#  define Service_URIHandlerDying 0x1
   @Entry
   @  R0 = &1
   @  R1 = &A7

#  define Service_URIProcess 0x2
   @Entry
   @  R0 = &2
   @  R1 = &A7
   @  R2 = flags (URI_ProcessFlags)
   @  R3 -> uri (String)
   @  R4 = handle (URI_H)
   @Exit
   @  R1 = unclaimed (Bool)

#  define Service_URIReturnResult 0x3
   @Entry
   @  R0 = &3
   @  R1 = &A7
   @  R2 = flags (URI_ReturnResultFlags)
   @  R3 = &0
   @  R4 = handle (URI_H)
   @Exit
   @  R1 = unclaimed (Bool)

#endif
