Write Routines

The following routines to write Frame MIF are defined in mif.pl:

These routines are purely for convienence. One can output MIF markup directly, but these routines help hide the underlying syntax of MIF.

       
Note:
Remember that ALL Perl variables mentioned are defined within the scope of package mif unless statements state/imply otherwise.

Routine Descriptions

MIFwrite_open

&'MIFwrite_open(FILEHANDLE, $token, $indent);

MIFwrite_open outputs the MIF to FILEHANDLE that opens $token with a character indent of $indent. Example:

&'MIFwrite_open(STDOUT, `Pgf', 5); 
would output:

     <Pgf
       

MIFwrite_close

&'MIFwrite_close(FILEHANDLE, $indent);

MIFwrite_close outputs the MIF to FILEHANDLE that closes an open token with a character indent of $indent. Example:

&'MIFwrite_close(STDOUT, 5); 
would output:

     >
       

MIFwrite_statment

&'MIFwrite_statement(FILEHANDLE, $token, $data, $indent);

MIFwrite_statement writes the MIF statement with token $token and data $data. $indent specifies the character indent of the statement. Example:

&'MIFwrite_statement(STDOUT, 'Char', 'HardSpace', 4); 
would output:

    <Char HardSpace>


       

MIFwrite_str_statment

&'MIFwrite_str_statement(FILEHANDLE, $token, $data, $indent);

MIFwrite_str_statement writes the MIF string statement with token $token and string data $data. $indent specifies the character indent of the statement. Example:

&'MIFwrite_str_statement(STDOUT, 'Paraline', 'Hello World!', 4); 
would output:

    <Paraline `Hello World!'>


       MIFwrite_str_statement adds the MIF string delimiters for you, so there is no 
       need to add them yourself to $data. MIFwrite_str_statement assumes that 
       $data is a valid MIF string. See MIFescape_string about converting a string to a 
       valid MIF string.

       

MIFescape_string

&'MIFescape_string(*str);

MIFescape_string escapes certain characters in *str to convert *str to a valid MIF string. The following characters are converted:

Since a pointer to the string variable is passed in, modifications of the string are preserved after the routine returns. If you want to preserve the original string, you must make a copy of it before passing it to MIFescape_string.

As you can see, MIFescape_string is not really a write routine. The routine itself does not warrent its own page, and it is normally used in conjunction with MIFwrite_str_statment.

       

Go back to mif.pl.


Earl Hood, ehood@convex.com
mif.pl 1.0.0