Vigay.com24
Nov
Search Vigay.com
 
 

Mapping between MIME types and RISC OS filetypes

MIME (Multipurpose Internet Mail Extensions) defines a standard way of adding file attachments to email messages. In particular it defines "content-subtype" fields that allow for applications, WWW servers, etc. to identify particular types of data (eg, Postscript, HTML, JPEGs, etc).

Environment variables used

Inet$MimeMappings File of mappings between RISC OS file types, MIME content types and 'dot' extensions to file names.

MimeMap module

The MimeMap module provides a central service for mapping between RISC OS file types, MIME content types and 'dot' extensions to file names.

When the module is loaded it reads the file Inet$MimeMappings and stores the parsed file internally. When ever the user tries to perform a mapping operation the translation is performed from the interally held data.

At the moment the module can handle 4 different file typing schemes: RISC OS file type by number, RISC OS file type by name, MIME content type string and file extension string. Any type can be converted to any other type.

The module is usually driven through a single SWI, MimeMap_Translate.

MimeMap_Translate (SWI 0x50B00)

Converts between RISC OS file types, MIME content types and 'dot' extensions to file names. On entry
R0 = Input format
R1 = Input data or buffer
R2 = Output format
R3 = Output data buffer (if needed), 128 bytes
On exit
R3 = Result or output buffer
All other registers preserved on exit
Use There is also a command line interface to the module. The *MimeMap command can either be given on its own to list all the known types or it can be followed by &xxx to map a RISC OS file type in hexadecimal, .ext to map a file name extension, major/minor to map a MIME content type or a simple string to look up for a RISC OS file type. The *ReadMimeMap command re-reads the MimeMappings file off disc. The 4 formats supported are:
#define MMM_TYPE_RISCOS         0 /* Filetype as int */
#define MMM_TYPE_RISCOS_STRING 1 /* Filetype as char* */
#define MMM_TYPE_MIME 2 /* Content type as char* */
#define MMM_TYPE_DOT_EXTN 3 /* Extention as char* */

Note that you should use MimeMap 0.10 or later, since earlier versions of the module had an incorrect SWI chunk.

Please email Ant Support if you have corrections, or questions relating to this document.

Add a comment to this article

I am sorry to report that no further comments are to be left for articles here. We thank you for past comments. This feature has been disabled.

Email Email this page to a friend

Last edit: 10th Apr 2016 at 1:55pm
(593 days ago)

Bookmark with:What are these?
delicious Deliciousdigg Diggreddit redditfacebook Facebookstumbleupon StumbleUpon

RSS Feed

Viewed 1330 times since 12th May 2006,
~ 0 views per day

^
 
Valid HTML 4.01!
Valid CSS!
Best viewed with a cup of tea Crafted by RISC OS