Also, used as a prefix in RISC OS to indicate an application program.

As in NeXTStep and Mac OS X, application programs in RISC OS exist in the file system as directories ('folders', if you must) rather than simple binary files (as in Windows or classic Mac OS). These directories contain not only the application image and it's components, but ancillary files connected with the application such as window templates, localisation information, documentation, sometimes OS extension modules.

This make applications easy for the user to organise since they can be moved to any location in the filesystem as a single self-consistent unit.

The '!' prefix in Risc OS differentiates an application directory from any other directory, and affects how the OS treats it. Instead of showing the user a standard light blue directory icon in directory displays, the filer (RISC OS's equivalent of Finder, Explorer etc) will show an Application icon (traditionally, the Archimedes 'A' logo). Instead of displaying the directory's content when the user tries to open it, it starts the application. This is more or less equivalent to Mac OS X's '.app' directory name extension. Of course, this behaviour can be bypassed by opening the application; by holding down the Shift key when opening the directory, the user can display the contents. The Mac OS X equivalent being to select 'Show Package Contents' from the context menu (Ctrl-click) for the application; thanks Brontosaurus, Lila, wamckee and SharQ...)

The use of the '!' character as a name prefix is similar to UNIX's use of the '.' character as a prefix to indicate hidden files. Though the choice of that character might seem fairly arbitraty, there is in fact a fairly sound reason, which seems obvious once you know it: The ASCII code for '!', 33, is the second printable character code (the first being a plain space ' '). Since a space isn't a valid character in a RISC OS filename, applications will always appear as the first items in a directory window or listing, if it's sorted (as is usual) by ASCII collation order (or simply 'alphabetical order').

The '!' also generally denotes files within an application which have a special purpose.

!Run

When the user tries to invoke the application directory (using the filer or with one of the many variants of 'exec' that RISC OS provides), the file which actually gets invoked is the !Run file within the application directory.

Normally in RISC OS, this is an Obey file (shell script, if you will) which will set up any shared environment variables, set initial memory allocation for the program, and start executing the actual program image.

!Boot

In RISC OS, the mapping of file types to applications which understand them is done dynamically, and a degree of control is given to the user. When an application is first 'seen' by the filer, that is it's parent directory is opened, the !Boot file of any applications in the parent directory are executed. This conventionally declares any file types the application may be able to handle, and loads any icons associated with the files or application.

Since this can cause any arbitrary code to be executed merely by opening a directory viewer, it was quite readily exploiatable, and indeed quite frequently exploited, by viruses and other rogue pieces of software. To help get round this, and the filer was quickly given the ability to bypass the !Boot file if a user was suspicious about it; by holding down the Ctrl key when opening a directory, the user could be sure that no !Sprites were loaded or !Boot filess processed.

!RunImage

Not actually special to the OS itself, but by convention this is the actual program executable, started by the !Run file of the application.

!Sprites

A Spritefile which holds icons for the application (to show in filer and the icon bar) and any documents it may handle. The !Sprites file is only loaded if there's no !Boot file either: hence any !Boot file has to load the !Sprites file itself.

!Sprites22

Very similar to the !Sprites file, but containing icons whose pixels are a different aspect ratio from those in the !Sprites file.

The icons in !Sprite are expected to be 16-colour icons, with dimensions 34 pixel wide by 17 pixels high. This gives a square icon on displays with pixel aspect ratio of 0.5: for historical reasons, early RISC OS sytems were designed for a display resolution of 640x256, giving tall rectangular pixels. !Sprites22 was retrofitted to accomodate standard 'square' pixel displays.

!Help

Documentation, usually a text file but sometimes an executable of some sort, which RISC OS will show to the user as a menu option for that application.


Also, in later versions of BBC Basic, ! could also be used as an infix operator, which adds two arguments to form an address which then became an lvalue.

DEF FNcons(car%, cdr%)
cons%=FNalloc(8) : REM asuming we have some allocator function...
cons%!0 = car%
cons%!4 = cdr%
:= cons%