BBC URI Fetcher Dispatch Mechanism ================================== Osword 191 (&BF) - Fetch URI An application can request a URI be dealt with by issuing Osword 191 with the following control block: On entry: A=191, XY point to control block: Control block: XY+0 string length + 5 - Length of entry control block XY+1 &04 - Length of exit control block XY+2 URI Command XY+3 Flags or handle XY+4... Text string of URI : terminated by a CR (value 13). On exit: A,X,Y may be corrupted. Control block: XY+0 undefined XY+1 undefined XY+2 Returned status byte XY+3 Returned URI handle XY+4... Text string may be overwritten The following URI commands are available, passed in XY+2: 0: Version On exit, the status byte is returned as version*100 and the URI handle is returned as zero. This call can be used to check for the presence of the URI Handler. 1: Dispatch This call is used by an application to pass a URI string to the handler for dispatch. The handler will pass the call around relavent programs and return a handle to the opened URI. On exit, the status byte: 0 = URI found, handle in XY+3 1 = URI not found, handle returned as zero. If a URI is found, the returned handle should be examined. If the handle is zero, then the URI has been handled and completed. This could be the result of a mailto: URI where a mail handler has processed the URI completely. If the handle is nonzero, then it references a file that can be accessed with OSBGet and OSGBPB for fetching. This may be a temporary file that is valid until the URI handle is closed. 2: Close Closes the URI with handle in XY+3, possibly deleting any temporary files. After this call the application must assume that the handle it passed is invalid. Notes On calling, the flags/handle field at XY+3 should be set to zero if it is not used on the call. Currently, the passed URI string should not be more than 59 characters long. A simple URI client could be written as follows: DIM X% 128:Y%=X%DIV256 OSWORD=&FFF1 REPEAT CLS:INPUT "URI: "uri$ !X%=&00010405+LENuri$:$(X%+4)=uri$ A%=191:CALL OSWORD:status%=X%?2:handle%=X%?3 IFstatus%=0 AND handle%<>0 THEN REPEAT VDU BGET#handle%:UNTIL EOF#handle% !X%=&00020404:X%?3=handle%:A%=191:CALL OSWORD UNTIL FALSE