|
From: <cre...@us...> - 2006-05-08 17:24:26
|
Revision: 1367 Author: creecode Date: 2006-05-06 13:17:17 -0700 (Sat, 06 May 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1367&view=rev Log Message: ----------- newly documented verbs Added Paths: ----------- ODBs/trunk/docServerRoot/docServerData/formats/outline/clock/milliseconds.fvc ODBs/trunk/docServerRoot/docServerData/formats/outline/string/convertCharset.fvc ODBs/trunk/docServerRoot/docServerData/formats/outline/string/hexStringToBinary.fvc ODBs/trunk/docServerRoot/docServerData/formats/outline/string/isCharsetAvailable.fvc ODBs/trunk/docServerRoot/docServerData/formats/outline/string/mimeHeaderDecode.fvc Added: ODBs/trunk/docServerRoot/docServerData/formats/outline/clock/milliseconds.fvc =================================================================== --- ODBs/trunk/docServerRoot/docServerData/formats/outline/clock/milliseconds.fvc (rev 0) +++ ODBs/trunk/docServerRoot/docServerData/formats/outline/clock/milliseconds.fvc 2006-05-06 20:17:17 UTC (rev 1367) @@ -0,0 +1,23 @@ +FrontierVcsFile:2:optx:docServerData.formats.outline.clock.milliseconds + +Syntax + clock.milliseconds () +Params + None +Action + Determines the number of milliseconds (thousandths of a second) since the computer was started. +Returns + A number indicating how many milliseconds have passed since the computer was started. +Examples + clock.milliseconds () + 9140884 + clock.milliseconds() / 1000 // for seconds + 9167 +Errors + None +Notes + This verb is useful in performance benchmarking tests and for generating random numbers. + Modern processors are much too fast for "clock.ticks" to be as useful as it once was: too many operations (or entire scripts) can be executed in less than one tick. + Script profiling results are reported in milliseconds (used to be ticks). +See Also + clock.ticks Added: ODBs/trunk/docServerRoot/docServerData/formats/outline/string/convertCharset.fvc =================================================================== --- ODBs/trunk/docServerRoot/docServerData/formats/outline/string/convertCharset.fvc (rev 0) +++ ODBs/trunk/docServerRoot/docServerData/formats/outline/string/convertCharset.fvc 2006-05-06 20:17:17 UTC (rev 1367) @@ -0,0 +1,26 @@ +FrontierVcsFile:2:optx:docServerData.formats.outline.string.convertCharset + +Syntax + string.convertCharset (charsetIn, charsetOut, s) +Params + charsetIn is a string, the "internet name" of the character set used by the input string s + charsetOut is a string, the "internet name" of the character set to which the input string s is to be re-encoded + s is the string whose encoding is to be converted from charsetIn to charsetOut +Action + Rewrites a string from one encoding (character set) to another. +Returns + The string in the new character set. +Examples + string.convertCharset ("macintosh", "iso-8859-1", "\x96 \x8E \x94 - those are 'n e i', with accents") + "\xF1 \xE9 \xEE - those are 'n e i', but with accents" +Errors + An error will be generated if one of the specified character sets (charsetIn or charsetOut) are not available on the current system. (See "string.isCharsetAvailable") + An error will be generated if the input string contains characters which do not actually belong to the specified encoding (charsetIn). +Notes + This verb is especially useful for standardizing an internet application's input. Email and NNTP messages, for example, can be in virtually any encoding. Use this verb to convert from any character set (a.k.a. "encoding") to whatever set you need, so long as such a conversion is possible. + If a character in the input can not be mapped to a character in the output encoding, the character will generally be replaced with a ?. In some cases, the character will be replaced with multiple characters that represent the original. For example, the macintosh set has a single character for "not equals" at byte 173. Look at what happens when that string is converted to the windows set, which doesn't have that character: + string.convertCharset "macintosh", "windows-1252", char (173 )) + "!=" + Some character sets contain characters which are not represented in other sets at all, even with multiple characters. For example, the common japanese encoding shift_jis contains many japanese characters which do not exist in iso-8859-1 or macintosh, so attempting such a conversion will generally result in text with many question marks where the Japanese characters were. +See Also + string.isCharsetAvailable Added: ODBs/trunk/docServerRoot/docServerData/formats/outline/string/hexStringToBinary.fvc =================================================================== --- ODBs/trunk/docServerRoot/docServerData/formats/outline/string/hexStringToBinary.fvc (rev 0) +++ ODBs/trunk/docServerRoot/docServerData/formats/outline/string/hexStringToBinary.fvc 2006-05-06 20:17:17 UTC (rev 1367) @@ -0,0 +1,18 @@ +FrontierVcsFile:2:optx:docServerData.formats.outline.string.hexStringToBinary + +Syntax + string.hexStringToBinary (s) +Params + s, a string, is a hex string. +Action + Converts a hex string to a binary. +Returns + A binary. +Examples + scratchpad.a = string.hexStringToBinary ("0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b") // scratchpad.a will be a binary [????] + // "\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B" + string.hexStringToBinary ("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b") + // "\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B" +Notes + The hex string can optionally start with "0x". + This verb is useful in conjunction with Crypt Verbs. Property changes on: ODBs/trunk/docServerRoot/docServerData/formats/outline/string/hexStringToBinary.fvc ___________________________________________________________________ Name: svn:eol-style + native Added: ODBs/trunk/docServerRoot/docServerData/formats/outline/string/isCharsetAvailable.fvc =================================================================== --- ODBs/trunk/docServerRoot/docServerData/formats/outline/string/isCharsetAvailable.fvc (rev 0) +++ ODBs/trunk/docServerRoot/docServerData/formats/outline/string/isCharsetAvailable.fvc 2006-05-06 20:17:17 UTC (rev 1367) @@ -0,0 +1,25 @@ +FrontierVcsFile:2:optx:docServerData.formats.outline.string.isCharsetAvailable + +Syntax + string.isCharsetAvailabe (charsetName) +Params + charsetName is a string, the IANA-registered name of a character set like "iso-8859-1" or "macintosh" +Action + Determines if the specified character set is available in the operating system +Returns + A boolean: true if the character set is available, false otherwise. +Examples + string.isCharsetAvailable ("macintosh") + true + string.isCharsetAvailable ("shift_jis") + true + string.isCharsetAvailable ("windows") + false + string.isCharsetAvailable ("windows-1252") + true +Errors + None. +Notes + Many character sets have more than one name. The alternate names should work just as well as the canonical name. It just depends on the support provided by the underlying operating system. +See Also + string.convertCharset Added: ODBs/trunk/docServerRoot/docServerData/formats/outline/string/mimeHeaderDecode.fvc =================================================================== --- ODBs/trunk/docServerRoot/docServerData/formats/outline/string/mimeHeaderDecode.fvc (rev 0) +++ ODBs/trunk/docServerRoot/docServerData/formats/outline/string/mimeHeaderDecode.fvc 2006-05-06 20:17:17 UTC (rev 1367) @@ -0,0 +1,19 @@ +FrontierVcsFile:2:optx:docServerData.formats.outline.string.mimeHeaderDecode + +Syntax + mimeHeaderDecode (s, adrCharsetName) +Params + s is an internet header string (probably SMTP or HTTP) that may need to be decoded + adrCharsetName is the address of a string variable where the name of character set (as specified in the header) will be stored +Action + Determines if a string was encoded according to RFC 2047, decodes it, stores the name of the character set used by the string at adrCharsetName^, and returns the decoded string. +Returns + The RFC2047-decoded string. + Also, the name of the character set used by the string is returned at adrCharsetName^ +Examples + local (s = "=?utf-8?q?this=20is=20a=20test?="); + "this is a test" (plus, the value of charset is now "utf-8") + local (charset = ""); + s = string.mimeHeaderDecode (s, @charset) +Notes + Email headers, especially the subject line, often contain characters outside of the ASCII range. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |