Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/oslib In directory sc8-pr-cvs1:/tmp/cvs-serv28678/!OsLib/Tools/oslib Added Files: Tag: unix-build OS.Hdr Types.Hdr fileswitch.h font.h hostfs.h macros.h messagetrans.h os.h osargs.h osfile.h osfind.h osgbpb.h osmodule.h osspriteop.h taskwindow.h territory.h types.h wimp.h Log Message: Unix Build --- NEW FILE: OS.Hdr --- [ :LNOT: :DEF: Get_Types GBLS Get_Types ] [ :LNOT: :DEF: Types_Hdr Get_Types SETS "GET Hdr.Types" | Get_Types SETS "" ] $Get_Types [ :LNOT: :DEF: OS_Hdr GBLS OS_Hdr XOS_ReadVarVal * &20023 OS_ReadVarVal * &23 ;Entry ; R0 -> var (String) ; R1 = value (pointer to String) ; R2 = size (Int) ; R3 = context (Int) ; R4 = var_type (OS_VarType) ;Exit ; R0 corrupted ; R2 = used (Int) ; R3 = context_out (Int) ; R4 = var_type_out (OS_VarType) ] END --- NEW FILE: Types.Hdr --- [ :LNOT: :DEF: Types_Hdr GBLL Types_Hdr R0 RN 0 R1 RN 1 R2 RN 2 R3 RN 3 R4 RN 4 R5 RN 5 R6 RN 6 R7 RN 7 R8 RN 8 R9 RN 9 R10 RN 10 R11 RN 11 R12 RN 12 R13 RN 13 R14 RN 14 R15 RN 15 A1 RN 0 A2 RN 1 A3 RN 2 A4 RN 3 V1 RN 4 V2 RN 5 V3 RN 6 V4 RN 7 V5 RN 8 V6 RN 9 R RN 0 SL RN 10 FP RN 11 IP RN 12 SP RN 13 LR RN 14 PC RN 15 Int * 4 Bits * 4 Bool * 4 Short * 2 Char * 1 Byte * 1 Ptr * 4 Float * 4 Double * 8 Null * 0 False * 0 True * 1 None * 0 All * &FFFFFFFF Skip * 0 ;may be used as a "don't care" value V * 1 :SHL: 28 C * 1 :SHL: 29 Z * 1 :SHL: 30 N * 1 :SHL: 31 Error * -2 ] END --- NEW FILE: fileswitch.h --- #ifndef fileswitch_H #define fileswitch_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* 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. 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, U S A. */ #ifndef types_H #include "oslib/types.h" #endif #ifndef os_H #include "oslib/os.h" #endif /********************************** * SWI names and SWI reason codes * **********************************/ #undef OS_BGet #define OS_BGet 0xA #undef XOS_BGet #define XOS_BGet 0x2000A #undef BGetV #define BGetV 0xA #undef OS_BPut #define OS_BPut 0xB #undef XOS_BPut #define XOS_BPut 0x2000B #undef BPutV #define BPutV 0xB #undef Service_StartUpFS #define Service_StartUpFS 0x12 #undef Service_FSRedeclare #define Service_FSRedeclare 0x40 #undef Service_CloseFile #define Service_CloseFile 0x68 /************************************ * Structure and union declarations * ************************************/ typedef union fileswitch_info_words fileswitch_info_words; /******************** * Type definitions * ********************/ typedef byte fileswitch_fs_no; typedef bits fileswitch_fs_info; typedef bits fileswitch_fs_extra_info; typedef int fileswitch_object_type; typedef bits fileswitch_attr; union fileswitch_info_words { os_date_and_time date_and_time; struct { bits exec_addr; bits load_addr; } addrs; }; /************************ * Constant definitions * ************************/ #define error_FILE_SWITCH_NO_CLAIM 0x400u /*Unable to claim FileSwitch workspace*/ #define error_BAD_FS_CONTROL_REASON 0x401u /*Bad FSControl call*/ #define error_BAD_OS_FILE_REASON 0x402u /*Bad OSFile call*/ #define error_BAD_OS_ARGS_REASON 0x403u /*Bad OSArgs call*/ #define error_BAD_OSGBPB_REASON 0x404u /*Bad OSGBPB call*/ #define error_BAD_MODE_FOR_OS_FIND 0x405u /*Bad mode for OSFind*/ #define error_NO_ROOM_FOR_TRANSIENT 0x406u /*No room to run transient*/ #define error_EXEC_ADDR_NOT_IN_CODE 0x407u /*Execution address not within code*/ #define error_EXEC_ADDR_TOO_LOW 0x408u /*Code runs too low*/ #define error_UNKNOWN_ACTION_TYPE 0x409u /*No run action for this file type*/ #define error_TOO_MANY_LEVELS 0x40Au /*Too many levels*/ #define error_NO_SELECTED_FILING_SYSTEM 0x40Bu /*No selected filing system*/ #define error_CANT_REMOVE_FS_BY_NUMBER 0x40Cu /*Can't remove filing system by number*/ #define error_UNALIGNED_FS_ENTRY 0x40Du /*Unaligned filing system entry point*/ #define error_UNSUPPORTED_FS_ENTRY 0x40Eu /*Filing system does not support this operation*/ #define error_FS_NOT_SPECIAL 0x40Fu /*Filing system does not support special fields*/ #define error_CORE_NOT_READABLE 0x410u /*No readable memory at this address*/ #define error_CORE_NOT_WRITEABLE 0x411u /*No writable memory at this address*/ #define error_BAD_BUFFER_SIZE_FOR_STREAM 0x412u /*Bad buffer size*/ #define error_NOT_OPEN_FOR_READING 0x413u /*Not open for reading*/ #define error_NOT_ENOUGH_STACK_FOR_FS_ENTRY 0x414u /*Not enough stack to call filing system*/ #define error_NOTHING_TO_COPY 0x415u /*Nothing to copy*/ #define error_NOTHING_TO_DELETE 0x416u /*Nothing to delete*/ #define error_FILE_SWITCH_CANT_BE_KILLED_WHILST_THREADED 0x417u /*FileSwitch can not be killed whilst it is threaded*/ #define error_INVALID_ERROR_BLOCK 0x418u /*Invalid error block*/ #define error_FS_FILE_TOO_BIG 0x419u /*File too big , Clashed with ROMFS FileTooBig*/ #define error_CANT_RM_FASTER_FILE_SWITCH 0x41Au /*Can't RMFaster FileSwitch*/ #define error_INCONSISTENT_HANDLE_SET 0x41Bu /*Inconsistent handle set*/ #define error_IS_AFILE 0x41Cu /*Object is a file*/ #define error_BAD_FILE_TYPE 0x41Du /*Bad file type*/ #define error_LIBRARY_SOMEWHERE_ELSE 0x41Eu /*The library is somewhere else*/ #define error_PATH_IS_SELF_CONTRADICTORY 0x41Fu /*Path is self contradictory*/ #define error_WASNT_DOLLAR_AFTER_DISC 0x420u /*Disc was specified, but absolute wasn't $*/ #define error_NOT_ENOUGH_MEMORY_FOR_WILDCARD_RESOLUTION 0x421u /*Not enough memory for wildcard resolution*/ #define error_NOT_ENOUGH_STACK_FOR_WILDCARD_RESOLUTION 0x422u /*Not enough stack for wildcard resolution*/ #define error_DIR_WANTED_FILE_FOUND 0x423u /*Directory wanted, but file found*/ #define error_NOT_FOUND 0x424u /*Not found, &0100D6*/ #define error_MULTIPART_PATH_USED 0x425u /*Path variable had multiple entries and was used for a write operation*/ #define error_RECURSIVE_PATH 0x426u /*One of the path variables used refers to itself*/ #define error_MULTI_FS_DOES_NOT_SUPPORT_GBPB11 0x427u /*The OS_GBPB 11 call is not supported by image filing systems*/ #define error_FILE_SWITCH_DATA_LOST 0x428u /*Data lost, &4AC , Consistent with ADFS*/ #define error_TOO_MANY_ERROR_LOOKUPS 0x429u /*Too many error lookups happening at once - recursion assumed*/ #define error_MESSAGE_FILE_BUSY 0x42Au /*FileSwitch message file busy*/ #define error_PARTITION_BUSY 0x42Bu /*Partition not ready*/ #define fileswitch_FS_NUMBER_NONE ((fileswitch_fs_no) 0x0u) #define fileswitch_FS_NUMBER_ROMFS ((fileswitch_fs_no) 0x3u) #define fileswitch_FS_NUMBER_NETFS ((fileswitch_fs_no) 0x5u) #define fileswitch_FS_NUMBER_ADFS ((fileswitch_fs_no) 0x8u) #define fileswitch_FS_NUMBER_NETPRINT ((fileswitch_fs_no) 0xCu) #define fileswitch_FS_NUMBER_NULL ((fileswitch_fs_no) 0xDu) #define fileswitch_FS_NUMBER_PRINTER ((fileswitch_fs_no) 0xEu) #define fileswitch_FS_NUMBER_SERIAL ((fileswitch_fs_no) 0xFu) #define fileswitch_FS_NUMBER_VDU ((fileswitch_fs_no) 0x11u) #define fileswitch_FS_NUMBER_RAWVDU ((fileswitch_fs_no) 0x12u) #define fileswitch_FS_NUMBER_KBD ((fileswitch_fs_no) 0x13u) #define fileswitch_FS_NUMBER_RAWKBD ((fileswitch_fs_no) 0x14u) #define fileswitch_FS_NUMBER_DESKFS ((fileswitch_fs_no) 0x15u) #define fileswitch_FS_NUMBER_RAMFS ((fileswitch_fs_no) 0x17u) #define fileswitch_FS_NUMBER_RISCIXFS ((fileswitch_fs_no) 0x18u) #define fileswitch_FS_NUMBER_STREAMER ((fileswitch_fs_no) 0x19u) #define fileswitch_FS_NUMBER_SCSIFS ((fileswitch_fs_no) 0x1Au) #define fileswitch_FS_NUMBER_DIGITISER ((fileswitch_fs_no) 0x1Bu) #define fileswitch_FS_NUMBER_SCANNER ((fileswitch_fs_no) 0x1Cu) #define fileswitch_FS_NUMBER_MULTIFS ((fileswitch_fs_no) 0x1Du) #define fileswitch_FS_NUMBER_NFS ((fileswitch_fs_no) 0x21u) #define fileswitch_FS_NUMBER_CDFS ((fileswitch_fs_no) 0x25u) #define fileswitch_FS_NUMBER_DOSFS ((fileswitch_fs_no) 0x2Bu) #define fileswitch_FS_NUMBER_RESOURCEFS ((fileswitch_fs_no) 0x2Eu) #define fileswitch_FS_NUMBER_PIPEFS ((fileswitch_fs_no) 0x2Fu) #define fileswitch_FS_NUMBER_DEVICEFS ((fileswitch_fs_no) 0x35u) #define fileswitch_FS_NUMBER_PARALLEL ((fileswitch_fs_no) 0x36u) #define fileswitch_FS_NUMBER_PCCARDFS ((fileswitch_fs_no) 0x59u) #define fileswitch_FS_NUMBER_SHAREFS ((fileswitch_fs_no) 0x63u) #define fileswitch_FS_NUMBER ((fileswitch_fs_info) 0xFFu) #define fileswitch_FS_OPEN_FILE_LIMIT ((fileswitch_fs_info) 0xFF00u) #define fileswitch_FS_READ_ONLY ((fileswitch_fs_info) 0x10000u) #define fileswitch_HAS_EXTRA_FLAGS ((fileswitch_fs_info) 0x20000u) #define fileswitch_NO_FILE_ENTRIES ((fileswitch_fs_info) 0x40000u) #define fileswitch_NO_SAVE_ENTRY ((fileswitch_fs_info) 0x80000u) #define fileswitch_NO_LOAD_ENTRY ((fileswitch_fs_info) 0x100000u) #define fileswitch_IMPLICIT_DIRECTORIES ((fileswitch_fs_info) 0x200000u) #define fileswitch_NEEDS_URD_AND_LIB ((fileswitch_fs_info) 0x400000u) #define fileswitch_SUPPORTS_IMAGE ((fileswitch_fs_info) 0x800000u) #define fileswitch_RESERVED ((fileswitch_fs_info) 0x1000000u) #define fileswitch_SUPPORTS_FILE_INFO ((fileswitch_fs_info) 0x2000000u) #define fileswitch_SUPPORTS_STAMP_NAMED ((fileswitch_fs_info) 0x4000000u) #define fileswitch_NEEDS_FLUSH ((fileswitch_fs_info) 0x8000000u) #define fileswitch_NEEDS_CREATE ((fileswitch_fs_info) 0x10000000u) #define fileswitch_SUPPORTS_EMPTY_NAMES ((fileswitch_fs_info) 0x20000000u) #define fileswitch_INTERACTIVE ((fileswitch_fs_info) 0x40000000u) #define fileswitch_SUPPORTS_SPECIAL ((fileswitch_fs_info) 0x80000000u) #define fileswitch_SUPPORTS_DIR_CHANGE ((fileswitch_fs_extra_info) 0x1u) #define fileswitch_NEEDS_CAT ((fileswitch_fs_extra_info) 0x2u) #define fileswitch_NEEDS_EX ((fileswitch_fs_extra_info) 0x4u) #define fileswitch_NOT_FOUND ((fileswitch_object_type) 0x0u) #define fileswitch_IS_FILE ((fileswitch_object_type) 0x1u) #define fileswitch_IS_DIR ((fileswitch_object_type) 0x2u) #define fileswitch_IS_IMAGE ((fileswitch_object_type) 0x3u) #define fileswitch_ATTR_OWNER_READ ((fileswitch_attr) 0x1u) #define fileswitch_ATTR_OWNER_WRITE ((fileswitch_attr) 0x2u) #define fileswitch_ATTR_OWNER_SPECIAL ((fileswitch_attr) 0x4u) #define fileswitch_ATTR_OWNER_LOCKED ((fileswitch_attr) 0x8u) #define fileswitch_ATTR_WORLD_READ ((fileswitch_attr) 0x10u) #define fileswitch_ATTR_WORLD_WRITE ((fileswitch_attr) 0x20u) #define fileswitch_ATTR_WORLD_SPECIAL ((fileswitch_attr) 0x40u) #define fileswitch_ATTR_WORLD_LOCKED ((fileswitch_attr) 0x80u) #define error_NOT_SUPPORTED 0xF8u /*Bad operation on ...:*/ #define error_FS_WRITE_ONLY 0xFAu /*...: is a write only filing system*/ #define error_FS_READ_ONLY 0xFCu /*...: is a read only filing system*/ #define xos_bget(file, c, psr) \ _swix (OS_BGet, _IN (1) | _OUT (0) | _OUT (_FLAGS), file, c, psr) #define xos_bput(c, file) \ _swix (OS_BPut, _IN (0) | _IN (1), c, file) #endif --- NEW FILE: font.h --- #ifndef font_H #define font_H #include <swis.h> #ifndef types_H #include "oslib/types.h" #endif #ifndef os_H #include "oslib/os.h" #endif #define font_COMMAND_NUL 0 #define font_COMMAND_MOVE_HORIZONTAL 9 #define font_COMMAND_LF 10 #define font_COMMAND_MOVE_VERTICAL 11 #define font_COMMAND_CR 13 #define font_COMMAND_GCOL 17 #define font_COMMAND_COLOURS 18 #define font_COMMAND_TRUE_COLOURS 19 #define font_COMMAND_COMMENT 21 #define font_COMMAND_UNDERLINE 25 #define font_COMMAND_FONT 26 #define font_COMMAND_MATRIX 27 #define font_COMMAND_MATRIX_WITH_OFFSET 28 #define font_PAINT_JUSTIFY (1U << 0) #define font_PAINT_RUBOUT (1U << 1) #define font_PAINT_OS_UNITS (1U << 4) #define font_PAINT_GIVEN_COORDS (1U << 5) #define font_PAINT_GIVEN_TRFM (1U << 6) #define font_PAINT_GIVEN_LENGTH (1U << 7) #define font_PAINT_GIVEN_FONT (1U << 8) #define font_PAINT_KERN (1U << 9) #define font_PAINT_RIGHT_TO_LEFT (1U << 10) #define font_NO_OUTPUT (1U << 0) #define font_ADD_HINTS (1U << 1) #define font_OUTPUT_SKELETON (1U << 2) #define font_CONVERT_BITMAP (1U << 3) #define font_ERROR_IF_BITMAP (1U << 4) typedef int font_f; typedef struct { os_coord space_offset; os_coord letter_offset; os_box rubout; } font_coords; #define xfont_cache_addr(version, cache, used) \ _swix (Font_CacheAddr, _OUT (0) | _OUT (2) | _OUT (3), \ (int *) (version), (int *) (cache), (int *) (used)) #define xfont_find_font(font_name, xsize, ysize, xres, yres, f) \ _swix (Font_FindFont, _IN (1) | _IN (2) | _IN (3) | _IN (4) | _IN (5) | \ _OUT (0) | _OUT (4) | _OUT (5), \ (char *) (font_name), (int) (xsize), (int) (ysize), \ *(int *) (xres), *(int *) (yres), \ (font_f *) (f), (int *) (xres), (int *) (yres)) #define xfont_lose_font(f) \ _swix (Font_LoseFont, _IN (0), (font_f) (f)) #define xfont_read_defn() \ _swix (Font_ReadDefn, ) #define xfont_read_info() \ _swix (Font_ReadInfo, ) #define xfont_string_width() \ _swix (Font_StringWidth, ) #define xfont_paint(f, string, paint, xpos, ypos, coords, trfm, length) \ _swix (Font_Paint, _IN (0) | _IN (1) | _IN (2) | _IN (3) | _IN (4) | \ _IN (5) | _IN (6) | _IN (7), \ (font_f) (f), (char *) (string), (int) (paint), (int) (xpos), \ (int) (ypos), (font_coords *) (coords), (os_trfm_mat *) (trfm), \ (int) (length)) #define xfont_caret() \ _swix (Font_Caret, ) #define xfont_convert_to_os() \ _swix (Font_ConverttoOS, ) #define xfont_convert_to_points() \ _swix (Font_Converttopoints, ) #define xfont_set_font() \ _swix (Font_SetFont, ) #define xfont_current_font() \ _swix (Font_CurrentFont, ) #define xfont_future_font() \ _swix (Font_FutureFont, ) #define xfont_find_caret() \ _swix (Font_FindCaret, ) #define xfont_char_bbox() \ _swix (Font_CharBBox, ) #define xfont_read_scale_factor() \ _swix (Font_ReadScaleFactor, ) #define xfont_set_scale_factor() \ _swix (Font_SetScaleFactor, ) #define xfont_list_fonts() \ _swix (Font_ListFonts, ) #define xfont_set_font_colours() \ _swix (Font_SetFontColours, ) #define xfont_set_palette() \ _swix (Font_SetPalette, ) #define xfont_read_thresholds() \ _swix (Font_ReadThresholds, ) #define xfont_set_thresholds() \ _swix (Font_SetThresholds, ) #define xfont_find_caret_j() \ _swix (Font_FindCaretJ, ) #define xfont_string_bbox() \ _swix (Font_StringBBox, ) #define xfont_read_colour_table() \ _swix (Font_ReadColourTable, ) #define xfont_make_bitmap() \ _swix (Font_MakeBitmap, ) #define xfont_uncache_file() \ _swix (Font_UnCacheFile, ) #define xfont_set_font_max() \ _swix (Font_SetFontMax, ) #define xfont_read_font_max() \ _swix (Font_ReadFontMax, ) #define xfont_read_font_prefix() \ _swix (Font_ReadFontPrefix, ) #define xfont_switch_output_to_buffer(flags, buffer, end) \ _swix (Font_SwitchOutputToBuffer, _IN (0) | _IN (1) | _OUT (1), \ (int) (flags), (int *) (buffer), (int *) (end)) #define xfont_read_font_metrics() \ _swix (Font_ReadFontMetrics, ) #define xfont_decode_menu() \ _swix (Font_DecodeMenu, ) #define xfont_scan_string() \ _swix (Font_ScanString, ) #define xfont_set_colour_table() \ _swix (Font_SetColourTable, ) #define xfont_current_rgb() \ _swix (Font_CurrentRGB, ) #define xfont_future_rgb() \ _swix (Font_FutureRGB, ) #define xfont_read_encoding_filename() \ _swix (Font_ReadEncodingFilename, ) #define xfont_find_field() \ _swix (Font_FindField, ) #define xfont_apply_fields() \ _swix (Font_ApplyFields, ) #define xfont_lookup_font() \ _swix (Font_LookupFont, ) #endif --- NEW FILE: hostfs.h --- #ifndef hostfs_H #define hostfs_H #include <swis.h> #ifndef types_H #include "types.h" #endif #undef HostFS_HostVdu #define HostFS_HostVdu 0x40100 #undef HostFS_TubeVdu #define HostFS_TubeVdu 0x40101 #undef HostFS_WriteC #define HostFS_WriteC 0x40102 #define xhostfs_host_vdu() \ _swix (HostFS_HostVdu, 0) #define xhostfs_tube_vdu() \ _swix (HostFS_TubeVdu, 0) #define xhostfs_writec(c) \ _swix (HostFS_WriteC, _IN (0), (int) (c)) #endif --- NEW FILE: macros.h --- #ifndef macros_H #define macros_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* 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. 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, U S A. */ /************************ * Constant definitions * ************************/ #ifndef SIG_LIMIT #define SIG_LIMIT 11 #endif #ifndef DEC_WIDTH #define DEC_WIDTH 10 #endif #ifndef SHORT_DEC_WIDTH #define SHORT_DEC_WIDTH 5 #endif #ifndef LONG_DEC_WIDTH #define LONG_DEC_WIDTH 10 #endif #ifndef OCT_WIDTH #define OCT_WIDTH 11 #endif #ifndef SHORT_OCT_WIDTH #define SHORT_OCT_WIDTH 6 #endif #ifndef LONG_OCT_WIDTH #define LONG_OCT_WIDTH 11 #endif #ifndef UNSIGNED_WIDTH #define UNSIGNED_WIDTH 10 #endif #ifndef SHORT_UNSIGNED_WIDTH #define SHORT_UNSIGNED_WIDTH 5 #endif #ifndef LONG_UNSIGNED_WIDTH #define LONG_UNSIGNED_WIDTH 10 #endif #ifndef HEX_WIDTH #define HEX_WIDTH 8 #endif #ifndef SHORT_HEX_WIDTH #define SHORT_HEX_WIDTH 4 #endif #ifndef LONG_HEX_WIDTH #define LONG_HEX_WIDTH 8 #endif #ifndef FLT_WIDTH #define FLT_WIDTH 7 #endif #ifndef DBL_WIDTH #define DBL_WIDTH 17 #endif #ifndef LDBL_WIDTH #define LDBL_WIDTH 17 #endif #ifndef FLT_EXP_WIDTH #define FLT_EXP_WIDTH 2 #endif #ifndef DBL_EXP_WIDTH #define DBL_EXP_WIDTH 3 #endif #ifndef LDBL_EXP_WIDTH #define LDBL_EXP_WIDTH 3 #endif /********************* * Macro definitions * *********************/ /* ------------------------------------------------------------------------ * Macro: ABS() * * Description: Absolute value of a number */ #define ABS(a) ((a) >= 0? (a): -(a)) /* ------------------------------------------------------------------------ * Macro: ALIGN() * * Description: Rounds an integer up to the next multiple of 4 */ #define ALIGN(b) ((b) + 3 & ~3) /* ------------------------------------------------------------------------ * Macro: BINEXP() * * Description: 2 to the power of an integer */ #define BINEXP(n) (1 << (n)) /* ------------------------------------------------------------------------ * Macro: BIT() * * Description: The value of a bit at an offset from a pointer (cf CLR, * SET) */ #define BIT(p, i) (((bits *) (p)) [(i) >> 5] & 1 << ((i) & 31)) /* ------------------------------------------------------------------------ * Macro: BOOL() * * Description: Converts non-0 values to 1 */ #define BOOL(c) ((c) != 0? TRUE: FALSE) /* ------------------------------------------------------------------------ * Macro: CLEAR() * * Description: Clears the contents of a string */ #define CLEAR(s) ((s) [0] = '\0') /* ------------------------------------------------------------------------ * Macro: CLR() * * Description: Clears the bit at an offset from a pointer (cf BIT, SET) * * Other notes: 5 = x: 2^^x == CHAR_BIT*sizeof (bits); 31 = * CHAR_BIT*sizeof (bits) - 1 */ #define CLR(p, i) (((bits *) (p)) [(i) >> 5] &= ~(1 << ((i) & 31))) /* ------------------------------------------------------------------------ * Macro: COUNT() * * Description: The number of elements in an array */ #define COUNT(a) (sizeof (a)/sizeof *(a)) /* ------------------------------------------------------------------------ * Macro: DBLEQ() * * Description: Tests floating point numbers for approximate equality */ #define DBLEQ(a, b, e) (fabs ((a) - (b)) <= (e)*(fabs (a) + fabs (b))) /* ------------------------------------------------------------------------ * Macro: DIGIT() * * Description: The decimal digit corresponding to a character */ #define DIGIT(c) ((c) - '0') /* ------------------------------------------------------------------------ * Macro: DIM() * * Description: Positive difference */ #define DIM(a, b) ((a) > (b)? (a) - (b): 0) /* ------------------------------------------------------------------------ * Macro: EMPTY() * * Description: Is a string empty? */ #define EMPTY(s) ((s) [0] == '\0') /* ------------------------------------------------------------------------ * Macro: ISDIGIT() * * Description: A decimal digit? */ #define ISDIGIT(c) ('0' <= (c) && (c) <= '9') /* ------------------------------------------------------------------------ * Macro: ISXDIGIT() * * Description: A hexadecimal digit? */ #define ISXDIGIT(c) (('0' <= (c) && (c) <= '9') || \ ('a' <= (c) && (c) <= 'f') || ('A' <= (c) && (c) <= 'F')) /* ------------------------------------------------------------------------ * Macro: LCHAR() * * Description: The character corresponding to a digit, preferring lower * case */ #define LCHAR(i) ("0123456789abcdef" [i]) /* ------------------------------------------------------------------------ * Macro: MAX() * * Description: The larger of two values */ #define MAX(a, b) ((a) > (b)? (a): (b)) /* ------------------------------------------------------------------------ * Macro: MAXAB() * * Description: The larger of two values and assign */ #define MAXAB(a, b) ((a) < (b)? (a) = (b): (a)) /* ------------------------------------------------------------------------ * Macro: MIN() * * Description: The smaller of two values */ #define MIN(a, b) ((a) < (b)? (a): (b)) /* ------------------------------------------------------------------------ * Macro: MINAB() * * Description: The smaller of two values and assign */ #define MINAB(a, b) ((a) > (b)? (a) = (b): (a)) /* ------------------------------------------------------------------------ * Macro: NCOPY() * * Description: Copy a string of limited length */ #define NCOPY(s1, s2, n) (sprintf (s1, "%.*s", n, s2), s1) /* ------------------------------------------------------------------------ * Macro: RATIO() * * Description: Integer division, rounding to nearest */ #define RATIO(a, b) ((2*(a) + (b))/(2*(b))) /* ------------------------------------------------------------------------ * Macro: SET() * * Description: Sets the bit at an offset from a pointer (cf BIT, CLR) */ #define SET(p, i) (((bits *) (p)) [(i) >> 5] |= 1 << ((i) & 31)) /* ------------------------------------------------------------------------ * Macro: SGN() * * Description: Signum */ #define SGN(a) ((a) > 0? 1: (a) < 0? -1: 0) /* ------------------------------------------------------------------------ * Macro: SHORT() * * Description: Assembles a short from an unaligned pointer */ #define SHORT(ptr) ((int) (((byte *) (ptr)) [0] | \ ((byte *) (ptr)) [1] << 8) << 16 >> 16) /* ------------------------------------------------------------------------ * Macro: SQR() * * Description: Square */ #define SQR(a) ((a)*(a)) /* ------------------------------------------------------------------------ * Macro: STR_() * * Description: Helper macro for STR */ #define STR_(s) #s /* ------------------------------------------------------------------------ * Macro: STR() * * Description: Stringise a macro */ #define STR(s) STR_ (s) /* ------------------------------------------------------------------------ * Macro: UCHAR() * * Description: The character corresponding to a hexadecimal digit, * preferring upper case */ #define UCHAR(i) ("0123456789ABCDEF" [i]) /* ------------------------------------------------------------------------ * Macro: WORD() * * Description: Assembles a word at an unaligned character pointer */ #define WORD(ptr) ((int) (((byte *) (ptr)) [0] | \ ((byte *) (ptr)) [1] << 8 | ((byte *) (ptr)) [2] << 16 | \ ((byte *) (ptr)) [3] << 24)) /* ------------------------------------------------------------------------ * Macro: XDIGIT() * * Description: The hexadecimal digit corresponding to a character */ #define XDIGIT(c) ((byte) (c) < 'A'? (c) - '0': \ (byte) (c) < 'a'? (c) - 'A' + 10: (c) - 'a' + 10) /* ------------------------------------------------------------------------ * Macro: WHETHER() * * Description: Converts a boolean value to a string */ #define WHETHER(c) ((c)? "TRUE": "FALSE") #endif --- NEW FILE: messagetrans.h --- #ifndef messagetrans_H #define messagetrans_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* 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. 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, U S A. */ #include <kernel.h> #include <swis.h> #ifndef types_H #include "oslib/types.h" #endif #ifndef os_H #include "oslib/os.h" #endif #define messagetrans_DIRECT_ACCESS (1 << 0) typedef struct {int cb [4];} messagetrans_control_block; #ifdef EXECUTE_ON_UNIX /* ------------------------------------------------------------------------ * Function: messagetrans_error_lookup() * * Description: Translates a message token within an error block * * Input: error - value of R0 on entry * cb - value of R1 on entry * buffer - value of R2 on entry * size - value of R3 on entry * arg0 - value of R4 on entry * arg1 - value of R5 on entry * arg2 - value of R6 on entry * arg3 - value of R7 on entry * * Other notes: Calls SWI 0x41506. */ extern os_error *xmessagetrans_error_lookup (os_error const *error, messagetrans_control_block const *cb, os_error *buffer, int size, char const *arg0, char const *arg1, char const *arg2, char const *arg3); extern void messagetrans_error_lookup (os_error const *error, messagetrans_control_block const *cb, os_error *buffer, int size, char const *arg0, char const *arg1, char const *arg2, char const *arg3); #else /* EXECUTE_ON_UNIX */ #define xmessagetrans_file_info(file_name, flags, size) \ _swix (MessageTrans_FileInfo, _IN (1) | _OUT (0) | _OUT (2), \ (char *) (file_name), (int *) (flags), (int *) (size)) #define xmessagetrans_open_file(cb, file_name, buffer) \ _swix (MessageTrans_OpenFile, _IN (0) | _IN (1) | _IN (2), \ (messagetrans_control_block *) (cb), (char *) (file_name), \ (char *) (buffer)) #define xmessagetrans_lookup(cb, token, buffer, size_in, arg0, arg1, arg2, \ arg3, result, size_out) \ _swix (MessageTrans_Lookup, _IN (0) | _IN (1) | _IN (2) | _IN (3) | \ _IN (4) | _IN (5) | _IN (6) | _IN (7) | _OUT (2) | _OUT (3), \ (messagetrans_control_block *) (cb), (char *) (token), \ (char *) (buffer), (int) (size_in), (char *) (arg0), \ (char *) (arg1), (char *) (arg2), (char *) (arg3), \ (char **) (result), (int *) (size_out)) #define xmessagetrans_make_menus(cb, menus, buffer, size_in, size_out) \ _swix (MessageTrans_MakeMenus, _IN (0) | _IN (1) | _IN (2) | _IN (3) | \ _OUT (3), \ (messagetrans_control_block *) (cb), (char *) (menus), \ (char *) (buffer), (int) (size_in), (int *) (size_out)) #define xmessagetrans_close_file(cb) \ _swix (MessageTrans_CloseFile, _IN (0), \ (messagetrans_control_block *) (cb)) #define xmessagetrans_enumerate_tokens(cb, token, buffer, size, index, \ cont, size_out, index_out) \ _swix (MessageTrans_EnumerateTokens, \ _IN (0) | _IN (1) | _IN (2) | _IN (3) | _IN (4) | \ _OUT (2) | _OUT (3) | _OUT (4), \ (messagetrans_control_block *) (cb), (char *) (token), \ (char *) (buffer), (int) (size), (int) (index), \ (osbool *) (cont), (int *) (size_out), (int *) (index_out)) #define xmessagetrans_error_lookup(error, cb, buffer, size_in, arg0, arg1, \ arg2, arg3) \ _swix (MessageTrans_ErrorLookup, _IN (0) | _IN (1) | _IN (2) | _IN (3) | \ _IN (4) | _IN (5) | _IN (6) | _IN (7), \ (_kernel_oserror *) (error), (messagetrans_control_block *) (cb), \ (char *) (buffer), (int) (size_in), (char *) (arg0), \ (char *) (arg1), (char *) (arg2), (char *) (arg3)) #define messagetrans_error_lookup(error, cb, buffer, size_in, arg0, arg1, \ arg2, arg3) \ _swi (MessageTrans_ErrorLookup, _IN (0) | _IN (1) | _IN (2) | _IN (3) | \ _IN (4) | _IN (5) | _IN (6) | _IN (7), \ (_kernel_oserror *) (error), (messagetrans_control_block *) (cb), \ (char *) (buffer), (int) (size_in), (char *) (arg0), \ (char *) (arg1), (char *) (arg2), (char *) (arg3)) #define xmessagetrans_gs_lookup(cb, token, buffer, size_in, arg0, arg1, \ arg2, arg3, result, size_out) \ _swix (MessageTrans_GSLookup, _IN (0) | _IN (1) | _IN (2) | _IN (3) | \ _IN (4) | _IN (5) | _IN (6) | _IN (7) | _OUT (2) | _OUT (3), \ (messagetrans_control_block *) (cb), (char *) (token), \ (char *) (buffer), (int) (size_in), (char *) (arg0), \ (char *) (arg1), (char *) (arg2), (char *) (arg3), \ (char **) (result), (int *) (size_out)) #define xmessagetrans_copy_error(error, copy) \ _swix (MessageTrans_CopyError, _IN (0) | _OUT (0), \ (os_error *) (error), (os_error **) (copy)) #endif /* EXECUTE_ON_UNIX */ #endif --- NEW FILE: os.h --- #ifndef os_H #define os_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* 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. 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 [...5783 lines suppressed...] _swix (OS_ConvertSpacedInteger4, \ _IN (0) | _IN (1) | _IN (2) | _OUT (1) | _OUT (2), \ (int) (value), (char *) (buffer), (int) (size), (char **) (end), \ (int *) (free)) #define xos_convert_fixed_net_station() \ _swix (OS_ConvertFixedNetStation, ) #define xos_convert_net_station() \ _swix (OS_ConvertNetStation, ) #define xos_convert_fixed_file_size() \ _swix (OS_ConvertFixedFileSize, ) #define xos_convert_file_size() \ _swix (OS_ConvertFileSize, ) #endif /* EXECUTE_ON_UNIX */ #endif --- NEW FILE: osargs.h --- #ifndef osargs_H #define osargs_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* 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. 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, U S A. */ #ifndef types_H #include "types.h" #endif #ifndef fileswitch_H #include "oslib/fileswitch.h" #endif #ifndef os_H #include "os.h" #endif /********************************** * SWI names and SWI reason codes * **********************************/ #define OSArgs_ReadPtr 0x0 #define OSArgs_ReadTemporaryFS 0x0 #define OSArgs_SetPtr 0x1 #define OSArgs_ReadExt 0x2 #define OSArgs_SetExt 0x3 #define OSArgs_ReadAllocation 0x4 #define OSArgs_ReadEOFStatus 0x5 #define OSArgs_SetAllocation 0x6 #define OSArgs_ReadPath 0x7 #define OSArgs_ImageStamped 0x8 #define OSArgs_ReadInfo 0xFE #define OSArgs_Ensure 0xFF /******************** * Type definitions * ********************/ typedef bits osargs_stream_status; /************************ * Constant definitions * ************************/ #define osargs_STREAM_INTERACTIVE ((bits) 0x8u) #define osargs_STREAM_SUPPORTS_GBPB ((bits) 0x10u) #define osargs_STREAM_DIRECTORY ((bits) 0x20u) #define osargs_STREAM_READABLE ((bits) 0x40u) #define osargs_STREAM_WRITABLE ((bits) 0x80u) #define osargs_STREAM_WRITTEN ((bits) 0x100u) #define osargs_STREAM_EOF_ERROR_ON_NEXT_READ ((bits) 0x200u) #define osargs_STREAM_UNBUFFERED ((bits) 0x400u) #define osargs_STREAM_UNALLOCATED ((bits) 0x800u) #define osargs_STREAM_CRITICAL ((bits) 0x1000u) #define osargs_STREAM_DATA_LOST ((bits) 0x2000u) #define osargs_STREAM_IMAGE_FILE_BUSY ((bits) 0x4000u) #if defined EXECUTE_ON_UNIX #ifdef __cplusplus extern "C" { #endif /* ------------------------------------------------------------------------ * Function: osargs_read_ptr() * * Description: Reads a file's sequential file pointer. Prefer * OSArgs_ReadPtrW * * Input: file - value of R1 on entry * * Output: ptr - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x0. */ extern os_error *xosargs_read_ptr (os_f file, int *ptr); extern int osargs_read_ptr (os_f file); /* ------------------------------------------------------------------------ * Function: osargs_read_ptrw() * * Description: Reads a file's sequential file pointer. Uses 32-bit file * handle * * Input: file - value of R1 on entry * * Output: ptr - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x0. */ extern os_error *xosargs_read_ptrw (os_fw file, int *ptr); extern int osargs_read_ptrw (os_fw file); /* ------------------------------------------------------------------------ * Function: osargs_read_temporary_fs() * * Description: Reads the temporary filing system number * * Output: temp_fs_no - value of R0 on exit (X version only) * * Returns: R0 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x0, R1 = 0x0. */ extern os_error *xosargs_read_temporary_fs (fileswitch_fs_no *temp_fs_no); extern fileswitch_fs_no osargs_read_temporary_fs (void); /* ------------------------------------------------------------------------ * Function: osargs_set_ptr() * * Description: Writes an open file's sequential file pointer Prefer * OSArgs_SetPtrW * * Input: file - value of R1 on entry * ptr - value of R2 on entry * * Other notes: Calls SWI 0x9 with R0 = 0x1. */ extern os_error *xosargs_set_ptr (os_f file, int ptr); extern void osargs_set_ptr (os_f file, int ptr); /* ------------------------------------------------------------------------ * Function: osargs_set_ptrw() * * Description: Writes an open file's sequential file pointer. Uses * 32-bit file handle * * Input: file - value of R1 on entry * ptr - value of R2 on entry * * Other notes: Calls SWI 0x9 with R0 = 0x1. */ extern os_error *xosargs_set_ptrw (os_fw file, int ptr); extern void osargs_set_ptrw (os_fw file, int ptr); /* ------------------------------------------------------------------------ * Function: osargs_read_ext() * * Description: Reads an open file's extent. Prefer OSArgs_ReadExtW * * Input: file - value of R1 on entry * * Output: ext - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x2. */ extern os_error *xosargs_read_ext (os_f file, int *ext); extern int osargs_read_ext (os_f file); /* ------------------------------------------------------------------------ * Function: osargs_read_extw() * * Description: Reads an open file's extent. Uses 32-bit file handle * * Input: file - value of R1 on entry * * Output: ext - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x2. */ extern os_error *xosargs_read_extw (os_fw file, int *ext); extern int osargs_read_extw (os_fw file); /* ------------------------------------------------------------------------ * Function: osargs_set_ext() * * Description: Writes an open file's extent. Prefer OSArgs_SetExtW * * Input: file - value of R1 on entry * ext - value of R2 on entry * * Other notes: Calls SWI 0x9 with R0 = 0x3. */ extern os_error *xosargs_set_ext (os_f file, int ext); extern void osargs_set_ext (os_f file, int ext); /* ------------------------------------------------------------------------ * Function: osargs_set_extw() * * Description: Writes an open file's extent. Uses 32-bit file handle. * * Input: file - value of R1 on entry * ext - value of R2 on entry * * Other notes: Calls SWI 0x9 with R0 = 0x3. */ extern os_error *xosargs_set_extw (os_fw file, int ext); extern void osargs_set_extw (os_fw file, int ext); /* ------------------------------------------------------------------------ * Function: osargs_read_allocation() * * Description: Reads an open file's allocated size. Prefer * OSArgs_ReadAllocationW * * Input: file - value of R1 on entry * * Output: allocation - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x4. */ extern os_error *xosargs_read_allocation (os_f file, int *allocation); extern int osargs_read_allocation (os_f file); /* ------------------------------------------------------------------------ * Function: osargs_read_allocationw() * * Description: Reads an open file's allocated size. Uses 32-bit file * handle. * * Input: file - value of R1 on entry * * Output: allocation - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x4. */ extern os_error *xosargs_read_allocationw (os_fw file, int *allocation); extern int osargs_read_allocationw (os_fw file); /* ------------------------------------------------------------------------ * Function: osargs_read_eof_status() * * Description: Reads an open file's end-of-file (EOF) status. Prefer * OSArgs_ReadEOFStatusW * * Input: file - value of R1 on entry * * Output: eof_status - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x5. */ extern os_error *xosargs_read_eof_status (os_f file, osbool *eof_status); extern osbool osargs_read_eof_status (os_f file); /* ------------------------------------------------------------------------ * Function: osargs_read_eof_statusw() * * Description: Reads an open file's end-of-file (EOF) status. Uses * 32-bit file handle. * * Input: file - value of R1 on entry * * Output: eof_status - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x5. */ extern os_error *xosargs_read_eof_statusw (os_fw file, osbool *eof_status); extern osbool osargs_read_eof_statusw (os_fw file); /* ------------------------------------------------------------------------ * Function: osargs_set_allocation() * * Description: Ensures an open file's size. Prefer OSArgs_SetAllocationW * * Input: file - value of R1 on entry * allocation - value of R2 on entry * * Output: allocation_out - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x6. */ extern os_error *xosargs_set_allocation (os_f file, int allocation, int *allocation_out); extern int osargs_set_allocation (os_f file, int allocation); /* ------------------------------------------------------------------------ * Function: osargs_set_allocationw() * * Description: Ensures an open file's size. Uses 32-bit file handle. * * Input: file - value of R1 on entry * allocation - value of R2 on entry * * Output: allocation_out - value of R2 on exit (X version only) * * Returns: R2 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x6. */ extern os_error *xosargs_set_allocationw (os_fw file, int allocation, int *allocation_out); extern int osargs_set_allocationw (os_fw file, int allocation); /* ------------------------------------------------------------------------ * Function: osargs_read_path() * * Description: Converts a file handle to a canonical name. Prefer * OSArgs_ReadPathW * * Input: file - value of R1 on entry * buffer - value of R2 on entry * size - value of R5 on entry * * Output: spare - value of R5 on exit (X version only) * * Returns: R5 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x7. */ extern os_error *xosargs_read_path (os_f file, char *buffer, int size, int *spare); extern int osargs_read_path (os_f file, char *buffer, int size); /* ------------------------------------------------------------------------ * Function: osargs_read_pathw() * * Description: Converts a file handle to a canonical name. Uses 32-bit * file handle. * * Input: file - value of R1 on entry * buffer - value of R2 on entry * size - value of R5 on entry * * Output: spare - value of R5 on exit (X version only) * * Returns: R5 (non-X version only) * * Other notes: Calls SWI 0x9 with R0 = 0x7. */ extern os_error *xosargs_read_pathw (os_fw file, char *buffer, int size, int *spare); extern int osargs_read_pathw (os_fw file, char *buffer, int size); /* ------------------------------------------------------------------------ * Function: osargs_image_stamped() * * Description: Used by an image filing system to inform of a change to * an image stamp. Prefer OSArgs_ImageStampedW * * Input: file - value of R1 on entry * image_stamp - value of R2 on entry * * Other notes: Calls SWI 0x9 with R0 = 0x8. */ extern os_error *xosargs_image_stamped (os_f file, int image_stamp); extern void osargs_image_stamped (os_f file, int image_stamp); /* ------------------------------------------------------------------------ * Function: osargs_image_stampedw() * * Description: Used by an image filing system to inform of a change to * an image stamp. Uses 32-bit file handle. * * Input: file - value of R1 on entry * image_stamp - value of R2 on entry * * Other notes: Calls SWI 0x9 with R0 = 0x8. */ extern os_error *xosargs_image_stampedw (os_fw file, int image_stamp); extern void osargs_image_stampedw (os_fw file, int image_stamp); /* ------------------------------------------------------------------------ * Function: osargs_read_info() * * Description: Reads information on a file handle. Prefer * OSArgs_ReadInfoW * * Input: file - value of R1 on entry * * Output: stream_status - value of R0 on exit * fs_info - value of R2 on exit * * Other notes: Calls SWI 0x9 with R0 = 0xFE. */ extern os_error *xosargs_read_info (os_f file, osargs_stream_status *stream_status, fileswitch_fs_info *fs_info); extern void osargs_read_info (os_f file, osargs_stream_status *stream_status, fileswitch_fs_info *fs_info); /* ------------------------------------------------------------------------ * Function: osargs_read_infow() * * Description: Reads information on a file handle. Uses 32-bit file * handle. * * Input: file - value of R1 on entry * * Output: stream_status - value of R0 on exit * fs_info - value of R2 on exit * * Other notes: Calls SWI 0x9 with R0 = 0xFE. */ extern os_error *xosargs_read_infow (os_fw file, osargs_stream_status *stream_status, fileswitch_fs_info *fs_info); extern void osargs_read_infow (os_fw file, osargs_stream_status *stream_status, fileswitch_fs_info *fs_info); /* ------------------------------------------------------------------------ * Function: osargs_ensure() * * Description: Ensures data has been written to a file, or to all files * on the temporary filing system. Prefer OSArgs_EnsureW * * Input: file - value of R1 on entry * * Other notes: Calls SWI 0x9 with R0 = 0xFF. */ extern os_error *xosargs_ensure (os_f file); extern void osargs_ensure (os_f file); /* ------------------------------------------------------------------------ * Function: osargs_ensurew() * * Description: Ensures data has been written to a file, or to all files * on the temporary filing system. Uses 32-bit file handle. * * Input: file - value of R1 on entry * * Other notes: Calls SWI 0x9 with R0 = 0xFF. */ extern os_error *xosargs_ensurew (os_fw file); extern void osargs_ensurew (os_fw file); #ifdef __cplusplus } #endif #else /* EXECUTE_ON_UNIX */ #define xosargs_ensure(file) _swix (OS_Args, _IN (0) | _IN (1), \ OSArgs_Ensure, (os_f) (file)) #endif /* EXECUTE_ON_UNIX */ #endif --- NEW FILE: osfile.h --- #ifndef osfile_H #define osfile_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* 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. 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, U S A. */ #include <swis.h> #ifndef types_H #include "types.h" #endif #ifndef fileswitch_H #include "oslib/fileswitch.h" #endif #define OSFile_Load 255 #define OSFile_Save 0 #define OSFile_WriteInfo 1 #define OSFile_WriteLoad 2 #define OSFile_WriteExec 3 #define OSFile_WriteAttr 4 #define OSFile_Read 5 #define OSFile_Delete 6 #define OSFile_Create 7 #define OSFile_CreateDir 8 #define OSFile_SetStamp 9 #define OSFile_SaveStamp 10 #define OSFile_CreateStamp 11 #define OSFile_LoadPath 12 #define OSFile_ReadPath 13 #define OSFile_LoadPathVar 14 #define OSFile_ReadPathVar 15 #define OSFile_LoadNoPath 16 #define OSFile_ReadNoPath 17 #define OSFile_SetType 18 #define OSFile_MakeError 19 #define OSFile_ReadWithType 20 #define OSFile_ReadWithTypePath 21 #define OSFile_ReadWithTypePathVar 22 #define OSFile_ReadWithTypeNoPath 23 #define OSFile_ReadBlockSize 24 #define osfile_NOT_FOUND 0 #define osfile_IS_FILE 1 #define osfile_IS_DIR 2 #define osfile_TYPE_DRAW 0xAFF #define osfile_TYPE_BBC_ROM 0xBBC #define osfile_TYPE_DOS_DISC 0xFC8 #define osfile_TYPE_DEVICE 0xFCC #define osfile_TYPE_CACHE 0xFCF #define osfile_TYPE_TASK_EXEC 0xFD6 #define osfile_TYPE_TASK_OBEY 0xFD7 #define osfile_TYPE_DOS 0xFE4 #define osfile_TYPE_DESKTOP 0xFEA #define osfile_TYPE_OBEY 0xFEB #define osfile_TYPE_TEMPLATE 0xFEC #define osfile_TYPE_PALETTE 0xFED #define osfile_TYPE_CONFIG 0xFF2 #define osfile_TYPE_PRINTOUT 0xFF4 #define osfile_TYPE_POSTSCRIPT 0xFF5 #define osfile_TYPE_FONT 0xFF6 #define osfile_TYPE_BBC_FONT 0xFF7 #define osfile_TYPE_ABSOLUTE 0xFF8 #define osfile_TYPE_SPRITE 0xFF9 #define osfile_TYPE_MODULE 0xFFA #define osfile_TYPE_BASIC 0xFFB #define osfile_TYPE_UTILITY 0xFFC #define osfile_TYPE_DATA 0xFFD #define osfile_TYPE_COMMAND 0xFFE #define osfile_TYPE_TEXT 0xFFF #define osfile_TYPE_DIRECTORY 0x1000 #define osfile_TYPE_APPLICATION 0x2000 #define osfile_TYPE_UNTYPED 0xFFFFFFFF #define osfile_TYPE(load_addr) ((load_addr & 0xFFF00000) == 0xFFF00000? \ (load_addr) >> 8 & 0xFFF: osfile_TYPE_UNTYPED) #ifdef EXECUTE_ON_UNIX extern os_error *xosfile_create_dir(char const *, int); extern void osfile_create_dir(char const *, int); #if 0 /* in os.h */ extern void os_generate_error(_kernel_oserror *); #endif #else /* EXECUTE_ON_UNIX */ #define xosfile_load(file_name, addr, load_addr, exec_addr, size, attr) \ _swix (OS_File, _IN (0) | _IN (1) | _IN (2) | _IN (3) | _OUT (2) | \ _OUT (3) | _OUT (4) | _OUT (5), OSFile_Load, (char *) (file_name), \ (void *) (addr), 0, (int *) (load_addr), (int *) (exec_addr), \ (int *) (size), (int *) (attr)) #define xosfile_save(file_name, load_addr, exec_addr, start, end) \ _swix (OS_File, \ _IN (0) | _IN (1) | _IN (2) | _IN (3) | _IN (4) | _IN (5), \ OSFile_Save, (char *) (file_name), (int) (load_addr), \ (int) (exec_addr), (char *) (start), (char *) (end)) #define xosfile_write_info() ... #define xosfile_write_load() ... #define xosfile_write_exec() ... #define xosfile_write_attr() ... #define xosfile_read(file_name, obj_type, load_addr, exec_addr, size, \ attr) \ _swix (OS_File, _IN (0) | _IN (1) | _OUT (0) | _OUT (2) | _OUT (3) | \ _OUT (4) | _OUT (5), OSFile_Read, (char *) (file_name), \ (int *) (obj_type), (int *) (load_addr), (int *) (exec_addr), \ (int *) (size), (int *) (attr)) #define xosfile_delete(file_name, obj_type, load_addr, exec_addr, size, \ attr) \ _swix (OS_File, _IN (0) | _IN (1) | _OUT (0) | _OUT (2) | _OUT (3) | \ _OUT (4) | _OUT (5), OSFile_Delete, (char *) (file_name), \ (int *) (obj_type), (int *) (load_addr), (int *) (exec_addr), \ (int *) (size), (int *) (attr)) #define xosfile_create() ... #define xosfile_create_dir(dir_name, no_entries) \ _swix (OS_File, _IN (0) | _IN (1) | _IN (4), \ OSFile_CreateDir, (char *) (dir_name), (int) (no_entries)) #define osfile_create_dir(dir_name, no_entries) \ _swi (OS_File, _IN (0) | _IN (1) | _IN (4), \ OSFile_CreateDir, (char *) (dir_name), (int) (no_entries)) #define xosfile_set_stamp() ... #define xosfile_save_stamped(file_name, osfile_type, start, end) \ _swix (OS_File, _IN (0) | _IN (1) | _IN (2) | _IN (4) | _IN (5), \ OSFile_SaveStamp, (char *) (file_name), (int) (osfile_type), \ (char *) (start), (char *) (end)) #define xosfile_create_stamp(file_name, file_type, size) \ _swix (OS_File, _IN (0) | _IN (1) | _IN (2) | _IN (4) | _IN (5), \ OSFile_CreateStamp, (char *) (file_name), (int) (file_type), \ 0, (int) (size)) #define xosfile_load_path() ... #define xosfile_read_path() ... #define xosfile_load_path_var() ... #define xosfile_read_path_var() ... #define xosfile_load_no_path(file_name, addr, load_addr, exec_addr, size, \ attr) \ _swix (OS_File, _IN (0) | _IN (1) | _IN (2) | _IN (3) | _OUT (2) | \ _OUT (3) | _OUT (4) | _OUT (5), OSFile_LoadNoPath, \ (char *) (file_name), (void *) (addr), 0, (int *) (load_addr), \ (int *) (exec_addr), (int *) (size), (int *) (attr)) #define xosfile_read_no_path(file_name, obj_type, load_addr, exec_addr, size, \ attr) \ _swix (OS_File, _IN (0) | _IN (1) | _OUT (0) | _OUT (2) | _OUT (3) | \ _OUT (4) | _OUT (5), OSFile_ReadNoPath, (char *) (file_name), \ (int *) (obj_type), (int *) (load_addr), (int *) (exec_addr), \ (int *) (size), (int *) (attr)) #define xosfile_set_type(file_name, file_type) \ _swix (OS_File, _IN (0) | _IN (1) | _IN (2), OSFile_SetType, \ (char *) (file_name), (int) (file_type)) #define xosfile_make_error(file_name, obj_type) \ _swix (OS_File, _IN (0) | _IN (1) | _IN (2), OSFile_MakeError, \ (char *) (file_name), (int) (obj_type)) #define xosfile_read_with_type() ... #define xosfile_read_with_type_path() ... #define xosfile_read_with_type_path_var() ... #define xosfile_read_with_type_no_path() ... #define xosfile_read_block_size() ... #endif /* EXECUTE_ON_UNIX */ #endif --- NEW FILE: osfind.h --- #ifndef osfind_H #define osfind_H /*OSLib---efficient, type-safe, transparent, extensible,\n" register-safe A P I coverage of RISC O S*/ /*Copyright © 1994 Jonathan Coxhead*/ /* 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. 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, U S A. */ #ifndef types_H #include "types.h" #endif #ifndef fileswitch_H #include "fileswitch.h" #endif #ifndef os_H #include "os.h" #endif /********************************** * SWI names and SWI reason codes * **********************************/ #define OSFind_Close 0x0 #define OSFind_Openin 0x40 #define OSFind_OpeninPath 0x41 #define OSFind_OpeninPathVar 0x42 #define OSFind_OpeninNoPath 0x43 #define OSFind_Openout 0x80 #define OSFind_OpenoutPath 0x81 #define OSFind_OpenoutPathVar 0x82 #define OSFind_OpenoutNoPath 0x83 #define OSFind_Openup 0xC0 #define OSFind_OpenupPath 0xC1 #define OSFind_OpenupPathVar 0xC2 #define OSFind_OpenupNoPath 0xC3 /******************** * Type definitions * ********************/ typedef bits osfind_flags; /************************ * Constant definitions * ************************/ #define osfind_PATH 0x1u #define osfind_PATH_VAR 0x2u #define osfind_NO_PATH 0x3u #define osfind_ERROR_IF_ABSENT ((bits) 0x8u) #define osfind_ERROR_IF_DIR ((bits) 0x4u) #if defined EXECUTE_ON_UNIX #ifdef __cplusplus extern "C" { #endif /* ----... [truncated message content] |