|
ITK Programmer's Guide |
||||||||||
Table of contents |
Intro | General
| TCP Low Level |
TCP High Level |
UDP | DNS
| PPP
|
ITK_Text2HTML |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
HTMLText := ITK_Text2HTML (text;options)
|
||||||||||||||||||||
Description: |
Converts "4D text" to HTML. By default, all HTML special characters like "<",
">", "&" are converted unless options is set
to 1. |
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$myText := "<B>é</B>" $HTML := ITK_Text2HTML($myText) ` returns "<B>é</B>" $HTML := ITK_Text2HTML($myText; 1) ` returns "<B>é</B>" |
ITK_HTML2Text |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
text := ITK_HTML2Text (HTMLText;options)
|
||||||||||||||||||||
Description: |
Converts HTML text to Mac text. By default, all HTML special characters like "<",
">", "&" are converted unless options is set
to 1. |
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$myHTMLText := "<B>é</B>" $myText := ITK_HTML2Text($myText) ` returns "<B>é</B>" $myText := ITK_HTML2Text($myText; 1) ` returns "<B>é</B>" $myText := ITK_HTML2Text($myText; 2) ` returns "é" (tags removed) |
ITK_Text2ISO |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
ISOText := ITK_Text2ISO (text;options)
|
||||||||||||||||||||
Description: |
Convert "4D text" to ISO-8859 text. ISO-8859 defines standard extended ASCII tables for
different languages and alphabets (Latin, Cyrillic,
etc.). |
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$iso := ITK_Text2ISO("é") ` convert to ISO-8859-1 (Latin-1) |
ITK_ISO2Text |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
text := ITK_ISO2Text (ISOtext;options)
|
||||||||||||||||||||
Description: |
Convert ISO-8859 text to "4D text" . ISO-8859 defines standard extended ASCII tables for
different languages and alphabets (Latin, Cyrillic,
etc.). |
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$iso := ITK_ISO2Text(ITK_Text2ISO("é")) ` should return "é" ! |
ITK_Text2URL |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
URLText := ITK_Text2URL (text;options)
|
||||||||||||||||||||
Description: |
Convert text to URL encoded text.
|
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
` standard URL translation $url := ITK_Text2URL("Test 4D+ITK.html") ` returns "Test+4D%2BITK.html" ` form URL translation $url := ITK_Text2URL("Test 4D+ITK.html";1) ` returns "Test%204D+ITK.html" |
ITK_URL2Text |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
text := ITK_URL2Text (URLtext;options)
|
||||||||||||||||||||
Description: |
Convert URL encoded text (standard or form translation)
to "4D text".
|
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
` form URL translation $url := ITK_URL2Text("Test+4D%2BITK.html") ` returns "Test 4D+ITK.html" ` standard URL translation $url := ITK_URL2Text ("Test+4D%2BITK.html";1) ` returns "Test+4D+ITK.html" |
ITK_Text2B64 |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
base64text := ITK_Text2B64 (text;options)
|
||||||||||||||||||||
Description: |
Convert text to Base64. The Base64 conversion is a 8bit to 6bit conversion (3 chars are encoded into 4 chars). The resulting text will be 33% larger than the original.
|
||||||||||||||||||||
Note: |
For proper Base64 encoding, please refer to RFC1521. To comply with MIME, the output stream (encoded bytes) must be represented in lines of no more than 76 characters each. Padding at the end of the data is performed using the '=' character (use option value 1).
|
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$b64 := ITK_Text2B64("mypassword") |
ITK_B642Text |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
text := ITK_B642Text (base64text;options)
|
||||||||||||||||||||
Description: |
Decodes Base64 text. The Base64 conversion is a 8bit to 6bit conversion (4 chars decoded into 3 chars). The resulting text will be 25% smaller than the original.
|
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$pass := ITK_B642Text($B64pass) |
ITK_Text2Quoted |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
qpText := ITK_Text2Quoted (text;options)
|
||||||||||||||||||||
Description: |
Encodes some text into "quoted-printable" text. Quoted-printable is a 7bit format that converts 8bit
characters into an 6bit encoded representation (ex:
"é" -> "=EA"). Quoted-printable also deals will lines wrap and text lines to limit their length (wrapped lines are terminated by a space and an equal sign).
|
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$qpISOText := ITK_Text2Quoted($myText) ` apply ISO conversion $qpPlainText := ITK_Text2Quoted($myText;1) ` no ISO conversion $qpPlainText := ITK_Text2Quoted($myText;1+2) ` no ISO conversion + soft line break support |
ITK_Quoted2Text |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
text := ITK_Quoted2Text (qpText;options)
|
||||||||||||||||||||
Description: |
Decodes quoted-printable encoded text. Quoted-printable is a 7bit format that converts 8bit
characters into an 6bit encoded representation (ex:
"é" -> "=EA"). Quoted-printable also deals will lines wrap and text lines to limit their length (wrapped lines are terminated by a space and an equal sign). This routines restores wrapped lines into their original state.
|
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$macText := ITK_Quoted2Text($myQPtext) ` apply ISO decoding $isoText := ITK_Quoted2Text($myQPtext;1) ` no ISO decoding |
ITK_Text2uu |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
uuText := ITK_Text2uu (text;options)
|
||||||||||||||||||||
Description: |
Encodes text to uuencode format. The uuencode conversion is a 8bit to 6bit conversion (3 chars are encoded into 4 chars). The resulting text will be 33% larger than the original.
|
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$uu := ITK_Text2uu("text portion") |
ITK_uu2Text |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
decodedText := ITK_uu2Text (uuText;options)
|
||||||||||||||||||||
Description: |
Decodes "uu" encoded text. The uuencode conversion is a 8bit to 6bit conversion (3 chars are encoded into 4 chars). The decoded text will be 25% smaller than the encoded version.
|
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$t := ITK_uu2Text($uuText) |
ITK_Pict2GIF |
|||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
Syntax: |
gifPicture := ITK_Pict2GIF (picture; flag; gifWidth; gifHeight; transpHoriz; transpVert)
|
||||||||||||||||||||||||||||||||||||||||
Description: |
Compresses a picture in GIF format. The resulting picture can also be resize.
|
||||||||||||||||||||||||||||||||||||||||
Warning: |
You can store these GIF encoded pictures in 4D records, but do not try to display or do any manipulation on them, 4D doesn't know how to display and manipulate GIF encoded pictures. This can cause 4D to crash .
|
||||||||||||||||||||||||||||||||||||||||
Params: |
|
||||||||||||||||||||||||||||||||||||||||
Example: |
$myGIF := ITK_Pict2GIF(myPicture;2;0;0;100;50) ` transparent pixel is (100,50) |
ITK_Mac2Bin |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
error := ITK_Mac2Bin (macPath;binPath)
|
||||||||||||||||||||
Description: |
Encodes a file into MacBinary format. MacBinary format allows to store both the data fork and the resource fork of a file with all finder information in a data fork only file. This is useful under MacOS. MacBinary is a 8bit file format.
|
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$err := ITK_Mac2Bin("MyHD:MyFolder:Myfile";"MyHD:MyFolder:MyFile.bin") ` MacOS $err := ITK_Mac2Bin("C:\MyHD\MyFolder\Myfile";"C:\MyHD\MyFolder\MyFile.bin") ` Windows |
ITK_Bin2Mac |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
error := ITK_Bin2Mac (binPath;macPath)
|
||||||||||||||||||||
Description: |
Decodes a MacBinary file into an original Mac file.
|
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$err := ITK_Bin2Mac("MyHD:MyFolder:Myfile.bin";"MyHD:MyFolder:MyFile") ` MacOS $err := ITK_Bin2Mac ("C:\MyHD\MyFolder\Myfile.bin";"C:\MyHD\MyFolder\MyFile") ` Windows |
ITK_Mac2Hqx |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
error := ITK_Mac2Hqx (macPath;binhexPath)
|
||||||||||||||||||||
Description: |
Encodes a file into BinHex 4.0 format. BinHex 4.0 format allows to store both the data fork and the resource fork of a file with most finders information in a 6bit data fork only file. This is useful under MacOS. BinHex 4.0 is a 6bit file format which can be used to send attachments in email.
|
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$err := ITK_Mac2Hqx("MyHD:MyFolder:Myfile";"MyHD:MyFolder:MyFile.hqx") ` MacOS $err := ITK_Mac2Hqx ("C:\MyHD\MyFolder\Myfile";"C:\MyHD\MyFolder\MyFile.hqx") ` Windows |
ITK_Hqx2Mac |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
error := ITK_Hqx2Mac (binhexPath;macPath)
|
||||||||||||||||||||
Description: |
Decodes a BinHex 4.0 file into an original Mac file.
|
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$err := ITK_Hqx2Mac("MyHD:MyFolder:Myfile.hqx";"MyHD:MyFolder:MyFile") ` MacOS $err := ITK_Hqx2Mac ("C:\MyHD\MyFolder\Myfile.hqx";"C:\MyHD\MyFolder\MyFile") ` Windows |
ITK_Mac2uu |
||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||
Syntax: |
error := ITK_Mac2uu (macPath; uuPath; fileName)
|
|||||||||||||||||||||||||
Description: |
Encodes a file into uuencode format. uuencode is a standard Unix 6bit encoding file
format. |
|||||||||||||||||||||||||
Params: |
|
|||||||||||||||||||||||||
Example: |
` MacOS $err := ITK_Mac2uu("MyHD:MyFolder:Myfile";"MyHD:MyFolder:MyFile.uu"; "MyFile.dat") ` Windows $err := ITK_Mac2uu("C:\MyHD\MyFolder\Myfile";"C:\MyHD\MyFolder\MyFile.uu"; "MyFile") |
ITK_uu2Mac |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
error := ITK_uu2Mac (uuPath;macPath)
|
||||||||||||||||||||
Description: |
Decodes a "uuencoded" file into an original Mac file.
|
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$err := ITK_uu2Mac("MyHD:MyFolder:Myfile.uu";"MyHD:MyFolder:MyFile") ` MacOS $err := ITK_uu2Mac("C:\MyHD\MyFolder\Myfile.uu";"C:\MyHD\MyFolder\MyFile") ` Windows |
ITK_Mac2gzip |
||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||
Syntax: |
error := ITK_Mac2gzip (macPath; gzipPath; level)
|
|||||||||||||||||||||||||
Description: |
Compresses a file into gzip format (normally ending with ".gz"). gzip is a standard compressed file format defined in RFC#1952 which uses the deflate compression algorithm (based on LZ77 and Huffman coding, see RFC#1951) and contains a CRC to detect data corruption (see RFC#1950). gzip compression can also be used in HTTP to send compressed data (see RFC#1945 sections 3.5, 10.3 and D.2.3 for explanation on the use of gzip in HTTP/1.0 and RFC#2616 sections 3.5, 14.3 and 14.11 for explanation on the use of gzip in HTTP/1.1).
|
|||||||||||||||||||||||||
Note: |
Under MacOS, only the datafork of the original file will be compressed. If you want to compress a full MacOS file (including data and resource fork as well as signatures and other file informations), you should convert your original file into a MacBinary file (using ITK_Mac2Bin ) before compressing it using ITK_Mac2gzip (see example below).
|
|||||||||||||||||||||||||
Params: |
|
|||||||||||||||||||||||||
Example: |
` MacOS - data fork only $err := ITK_Mac2gzip("MyHD:MyFolder:Myfile";"MyHD:MyFolder:MyFile.gz") ` default compression ` MacOS - full Mac File $err := ITK_Mac2Bin ("MyHD:MyFolder:Myfile";"MyHD:MyFolder:Myfile.temp") ` convert to MacBinary $err := ITK_Mac2gzip("MyHD:MyFolder:Myfile.temp";"MyHD:MyFolder:MyFile.gz") ` Windows $err := ITK_Mac2gzip("C:\MyHD\MyFolder\Myfile";"C:\MyHD\MyFolder\MyFile.gz") |
ITK_gzip2Mac |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
error := ITK_gzip2Mac (uuPath;macPath)
|
||||||||||||||||||||
Description: |
Decompresses a gzip compressed file (normally ending with ".gz"). gzip is a standard compressed file format defined in RFC#1952 which uses the deflate compression algorithm (based on LZ77 and Huffman coding, see RFC#1951) and contains a CRC to detect data corruption (see RFC#1950). gzip compression can also be used in HTTP to send compressed data (see RFC#1945 sections 3.5, 10.3 and D.2.3 for explanation on the use of gzip in HTTP/1.0 and RFC#2616 sections 3.5, 14.3 and 14.11 for explanation on the use of gzip in HTTP/1.1).
|
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
$err := ITK_gzip2Mac("MyHD:MyFolder:Myfile.gz";"MyHD:MyFolder:MyFile") ` MacOS - data fork only ` MacOS - full Mac file $err := ITK_gzip2Mac("MyHD:MyFolder:Myfile.gz";"MyHD:MyFolder:MyFile.temp") $err := ITK_Bin2Mac("MyHD:MyFolder:MyFile.temp";"MyHD:MyFolder:MyFile") $err := ITK_gzip2Mac("C:\MyHD\MyFolder\Myfile.gz";"C:\MyHD\MyFolder\MyFile") ` Windows |
ITK_RFC2Secs |
||||||||||||||||
|
|
|||||||||||||||
Syntax: |
gmtValue := ITK_RFC2Secs (rfcString)
|
|||||||||||||||
Description: |
Converts an RFC#822 or RFC#1123 formatted date and time string (example: Fri, 28-Jul-1995 22:50:10 +0100) into a GMT date/time value.
|
|||||||||||||||
Note: |
ITK_RFC2Secs and ITK_Date2Secs are always returning a GMT based value, so you can compare them directly. Y2K Compliance : note that if the rfcString passed is formatted according to RFC#822 (which uses only 2 digits for the year), this routine will not be Y2K compliant. Be sure to pass RFC#1123 formatted string which are using 4 digits for the year. |
|||||||||||||||
Params: |
|
|||||||||||||||
Example: |
To convert an RFC date/time string into the corresponding
GMT RFC date/time string use To compare two RFC date/time strings, converts them into
GMT date/time values, ex: |
ITK_Secs2RFC |
|||||||||||||||||||||
|
|
||||||||||||||||||||
Syntax: |
rfcString := ITK_Secs2RFC (gmtValue;timeZoneFlag)
|
||||||||||||||||||||
Description: |
Converts a GMT date/time value into an RFC#822 or RFC#1123 formatted date and time string (example: Fri, 28-Jul-1995 22:50:10 +0100). You can specify if the resulting RFC string must be in GMT time zone or local time zone (according to your computer time zone settings).
|
||||||||||||||||||||
Note: |
ITK_RFC2Secs and ITK_Date2Secs are always returning a GMT based value, so you can compare them directly. Y2K Compliance : This routine is Y2K compliant. |
||||||||||||||||||||
Params: |
|
||||||||||||||||||||
Example: |
To convert an RFC date/time string into the corresponding
GMT RFC date/time string use To get the current date and time in GMT time zone: |
ITK_Date2Secs |
||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||
Syntax: |
gmtValue := ITK_Date2Secs (date;time;timeZoneFlag)
|
|||||||||||||||||||||||||
Description: |
Converts a date and time (4D formats) into an GMT date/time value. You can specify if the given date and time are in local time zone or GMT.
|
|||||||||||||||||||||||||
Warning: |
If you pass a local date and time (like Current Date and Current Time), be sure to specify local time zone in the timeZoneFlag, otherwise, the resulting gmtValue will not be correct according to your local time zone and GMT time zone. See examples below. Y2K Compliance : This routine is Y2K compliant. |
|||||||||||||||||||||||||
Params: |
|
|||||||||||||||||||||||||
Example: |
$secs := ITK_Date2Secs
(Current date; Current time; 1) ` local time (in local time
zone)
|
ITK_Secs2Date |
||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||
Syntax: |
ITK_Secs2Date (gmtValue;date;time;timeZoneFlag)
|
|||||||||||||||||||||||||
Description: |
Converts GMT date/time value into a date and time (4D formats). You can specify if the resulting date and time must be returned in local time zone or GMT. Y2K Compliance : This routine is Y2K compliant. |
|||||||||||||||||||||||||
Params: |
|
|||||||||||||||||||||||||
Example: |
` Get date/Time in 4 hours $dt := ITK_Date2Secs(Current Date; Current
Time;1) |
|||||||||||||||||||||||||
Note: |
The returned time is typed as a LONGINT. To get the corresponding value in a TIME variable, simply use the following code: C_LONGINT($timeAsLong) |