h6. [[OS SWI Calls]] h6(. » [[OS_UpCall]] h6((. » OS_UpCall 3 h2. OS_UpCall 3 h5. (SWI &33) The action performed depends on the reason code value in R9. h4(#reason). Reason Codes |<^. 0|<^. &00|<^. "Saving memory to file":#code0| |<^. 1|<^. &01|<^. "Writing catalogue information":#code1| |<^. 2|<^. &02|<^. "Writing load address only":#code2| |<^. 3|<^. &03|<^. "Writing execution address only":#code3| |<^. 4|<^. &04|<^. "Writing attributes only":#code4| |<^. 6|<^. &06|<^. "Deleting file":#code6| |<^. 7|<^. &07|<^. "Creating empty file":#code7 | |<^. 8|<^. &08|<^. "Creating directory":#code8| |<^. 257|<^. &101|<^. "Creating and opening for update":#code257| |<^. 258|<^. &102|<^. "Opening for update":#code258| |<^. 259|<^. &103|<^. "Closing file":#code259| |<^. 512|<^. &200|<^. "Ensure file size":#code512| |<^. 520|<^. &208|<^. "Renaming file":#code520| |<^. 521|<^. &209|<^. "Setting attributes":#code521| h4(#code0). Saving memory to file |_<^{width:4em}. Entry | | |<^. R0 |<^. 3| |<^. R1 |<^. Pointer to filename| |<^. R2 |<^. "Load address":linkload| |<^. R3 |<^. "Execution address":linkexecution| |<^. R4 |<^. Pointer to start of buffer| |<^. R5 |<^. Pointer to end of buffer| |<^. R6 |<^. Pointer to "special field":linkspecial (or 0)| |<^. R8 |<^. [[Filing System Information Word|Filing system information word]]| |<^. R9 |<^. 0 (reason code)| |_<^{width:4em}. Exit | | |<^. R0 |<^. Preserved| |\2<^. All registers preserved| h4(#code1). Writing Catalogue information |_<^{width:4em}. Entry | | |<^. R0 |<^. 3| |<^. R1 |<^. Pointer to filename| |<^. R2 |<^. "Load address":linkload| |<^. R3 |<^. "Execution address":linkexecution| |<^. R5 |<^. "Attributes":linkattributes| |<^. R6 |<^. Pointer to "special field":linkspecial (or 0)| |<^. R8 |<^. [[Filing System Information Word|Filing system information word]]| |<^. R9 |<^. 1 (reason code)| |_<^{width:4em}. Exit | | |\2<^. All registers preserved| h4(#code2). Writing Load Address only |_<^{width:4em}. Entry | | |<^. R0 |<^. 3| |<^. R1 |<^. Pointer to filename| |<^. R2 |<^. "Load address":linkload| |<^. R6 |<^. Pointer to "special field":linkspecial (or 0)| |<^. R8 |<^. [[Filing System Information Word|Filing system information word]]| |<^. R9 |<^. 2 (reason code)| |_<^{width:4em}. Exit | | |\2<^. All registers preserved| h4(#code3). Writing Execution Address only |_<^{width:4em}. Entry | | |<^. R0 |<^. 3| |<^. R1 |<^. Pointer to filename| |<^. R3 |<^. "Execution address":linkexecution| |<^. R6 |<^. Pointer to "special field":linkspecial (or 0)| |<^. R8 |<^. [[Filing System Information Word|Filing system information word]]| |<^. R9 |<^. 3 (reason code)| |_<^{width:4em}. Exit | | |\2<^. All registers preserved| h4(#code4). Writing Attributes only |_<^{width:4em}. Entry | | |<^. R0 |<^. 3| |<^. R1 |<^. Pointer to object name| |<^. R5 |<^. "Attributes":linkattributes| |<^. R6 |<^. Pointer to "special field":linkspecial (or 0)| |<^. R8 |<^. [[Filing System Information Word|Filing system information word]]| |<^. R9 |<^. 4 (reason code)| |_<^{width:4em}. Exit | | |\2<^. All registers preserved| h4(#code6). Deleting File |_<^{width:4em}. Entry | | |<^. R0 |<^. 3| |<^. R1 |<^. Pointer to object name| |<^. R6 |<^. Pointer to "special field":linkspecial (or 0)| |<^. R8 |<^. [[Filing System Information Word|Filing system information word]]| |<^. R9 |<^. 6 (reason code)| |_<^{width:4em}. Exit | | |\2<^. All registers preserved| h4(#code7). Creating empty file |_<^{width:4em}. Entry | | |<^. R0 |<^. 3| |<^. R1 |<^. Pointer to filename| |<^. R2 |<^. "Load address":linkload| |<^. R3 |<^. "Execution address":linkexecution| |<^. R4 |<^. Start address| |<^. R5 |<^. End address| |<^. R6 |<^. Pointer to "special field":linkspecial (or 0)| |<^. R8 |<^. [[Filing System Information Word|Filing system information word]]| |<^. R9 |<^. 7 (reason code)| |_<^{width:4em}. Exit | | |\2<^. All registers preserved| h4(#code8). Creating Directory |_<^{width:4em}. Entry | | |<^. R0 |<^. 3| |<^. R1 |<^. Pointer to directory name| |<^. R2 |<^. "Load address":linkload (to be used as timestamp)| |<^. R3 |<^. "Execution address":linkexecution (to be used as timestamp)| |<^. R4 |<^. Number of entries (0 for default)| |<^. R6 |<^. Pointer to "special field":linkspecial (or 0)| |<^. R8 |<^. [[Filing System Information Word|Filing system information word]]| |<^. R9 |<^. 8 (reason code)| |_<^{width:4em}. Exit | | |\2<^. All registers preserved| h4(#code257). Creating and Opening for Update |_<^{width:4em}. Entry | | |<^. R0 |<^. 3| |<^. R1 |<^. Pointer to filename| |<^. R2 |<^. External handle that file will be given (if successfully opened)| |<^. R6 |<^. Pointer to "special field":linkspecial (or 0)| |<^. R8 |<^. [[Filing System Information Word|Filing system information word]]| |<^. R9 |<^. 257 (reason code)| |_<^{width:4em}. Exit | | |\2<^. All registers preserved| h4(#code258). Opening for Update |_<^{width:4em}. Entry | | |<^. R0 |<^. 3| |<^. R1 |<^. Pointer to filename| |<^. R2 |<^. External handle that file will be given (if successfully opened)| |<^. R6 |<^. Pointer to "special field":linkspecial (or 0)| |<^. R8 |<^. [[Filing System Information Word|Filing system information word]]| |<^. R9 |<^. 258 (reason code)| |_<^{width:4em}. Exit | | |\2<^. All registers preserved| h4(#code259). Closing file |_<^{width:4em}. Entry | | |<^. R0 |<^. 3| |<^. R1 |<^. External file handle| |<^. R8 |<^. [[Filing System Information Word|Filing system information word]]| |<^. R9 |<^. 259 (reason code)| |_<^{width:4em}. Exit | | |\2<^. All registers preserved| h4(#code512). Ensure file size |_<^{width:4em}. Entry | | |<^. R0 |<^. 3| |<^. R1 |<^. External file handle| |<^. R2 |<^. Size to ensure| |<^. R8 |<^. [[Filing System Information Word|Filing system information word]]| |<^. R9 |<^. 512 (reason code)| |_<^{width:4em}. Exit | | |\2<^. All registers preserved| h4(#code520). Ensure file size |_<^{width:4em}. Entry | | |<^. R0 |<^. 3| |<^. R1 |<^. Pointer to current object name| |<^. R2 |<^. Pointer to desired object name| |<^. R6 |<^. Pointer to current "special field":linkspecial| |<^. R7 |<^. Pointer to desire "special field":linkspecial| |<^. R8 |<^. [[Filing System Information Word|Filing system information word]]| |<^. R9 |<^. 520 (reason code)| |_<^{width:4em}. Exit | | |\2<^. All registers preserved| h4(#code521). Setting Attributes |_<^{width:4em}. Entry | | |<^. R0 |<^. 3| |<^. R1 |<^. Pointer to current object name| |<^. R2 |<^. Pointer to attribute string (control character terminated)| |<^. R8 |<^. [[Filing System Information Word|Filing system information word]]| |<^. R9 |<^. 521 (reason code)| |_<^{width:4em}. Exit | | |\2<^. All registers preserved| h4. Use The purpose of this call is to warn applications that a file is being modified. h4. Notes It is made when a program calls one of several SWI provided by FileSwitch module: * Reason codes 0-8 are caused by calls to [[OS_File]] * Reason codes 257-9 are caused by calls to [[OS_Find]] * Reason codes 520 & 521 are caused by calls to [[OS_FSControl]] The following general points apply: * All strings are 0-terminated except where specified * All object names will already have been expanded by FileSwitch, checked for basic validity, and had filing system prefixes stripped * Object names will also be canonicalised, except under RISC OS 2. This UpCall is made before the operation, which may subsequently fail. For example, you may receive a rename UpCall for a locked file, which will subsequently fail to rename (because it's locked). If a file name is invalid for a given operation (eg you try to create a file with a wildcarded leafname) FileSwitch will generate an error, and no UpCall will be generated. The call is used by the desktop filer to maintain its directory displays. It's provided for information only; if you wish to use this UpCall, you must not intercept it, nor must you alter the contents of any of these registers used to pass parameters. h4. See also * [[OS_File]] * [[OS_Find]] * [[OS_FSControl]] * [[OS_UpCall]] [linkattributes]FileSwitch%20Key%20Features#file_attributes [linkload]FileSwitch%20Key%20Features#load_execution [linkexecution]FileSwitch%20Key%20Features#load_execution [linkspecial]FileSwitch%20Accessing%20File%2Systems#special_fields