|
From: <set...@us...> - 2006-04-25 00:29:24
|
Revision: 1333 Author: sethdill Date: 2006-04-24 17:29:17 -0700 (Mon, 24 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1333&view=rev Log Message: ----------- Added glue scripts string.isCharsetAvailable and string.convertCharset to wrap up the new verbs in the kernel. Both verbs contain full documentation in comments at the head of the script. (Using the format Macrobyte has been using for 6 years.) Added Paths: ----------- ODBs/trunk/frontierRoot/system/verbs/builtins/string/convertCharset.fvc ODBs/trunk/frontierRoot/system/verbs/builtins/string/isCharsetAvailable.fvc Added: ODBs/trunk/frontierRoot/system/verbs/builtins/string/convertCharset.fvc =================================================================== --- ODBs/trunk/frontierRoot/system/verbs/builtins/string/convertCharset.fvc (rev 0) +++ ODBs/trunk/frontierRoot/system/verbs/builtins/string/convertCharset.fvc 2006-04-25 00:29:17 UTC (rev 1333) @@ -0,0 +1,21 @@ +FrontierVcsFile:2:scpt:system.verbs.builtins.string.convertCharset + +«2006/04/14 by Seth Dillingham. + «Description: + «Convert a string from one character set to another. + «Note that you can find a list of the character sets available on your system, at system.charSets + «The name of each entry is the IANA-registered name + «The value of each entry is the character set's display name + «Parameters: + «charsetIn [string]: IANA-name (like "utf-8") of the character set of the input string + «charsetOut [string]: IANA-name of the character set of the output. This is the character set you want the string to use. + «s [string]: the string to be converted + «Return: + «[string]: the string, in the new character set + «Errors: + «At present, providing a string which is NOT actually encoded with the charset specified by charsetIn will either generate incorrect output, result in a script error, or may even halt execution of the script IMMEDIATELY without generating an error. (This is a known issue that will be dealt with in an upcoming revision.) + «Revisions: + « +«~~~~~~~~~~~~~~~~~~~~~~~~ +on convertCharset( charsetIn, charsetOut, s ) { + kernel( string.convertCharset )} \ No newline at end of file Added: ODBs/trunk/frontierRoot/system/verbs/builtins/string/isCharsetAvailable.fvc =================================================================== --- ODBs/trunk/frontierRoot/system/verbs/builtins/string/isCharsetAvailable.fvc (rev 0) +++ ODBs/trunk/frontierRoot/system/verbs/builtins/string/isCharsetAvailable.fvc 2006-04-25 00:29:17 UTC (rev 1333) @@ -0,0 +1,20 @@ +FrontierVcsFile:2:scpt:system.verbs.builtins.string.isCharsetAvailable + +«2006/04/24 by Seth Dillingham. + «Description: + «Asks the OS if the specified character set is recognized on this system. + «Useful as an error-prevention measure: before calling string.convertCharset, use isCharsetAvailable to be sure that both character sets are available. + «NOT case sensitive + «Parameters: + «charset [string]: the IANA-registered name of the character set, like "utf-8" or "macintosh" or "iso-8859-1" + «Return: + «[boolean]: true if the character ste is recognized, false if it is not + «Errors: + « + «Revisions: + « +«~~~~~~~~~~~~~~~~~~~~~~~~ +on isCharsetAvailable( charset ) { + kernel( string.isCharsetAvailable )} +«bundle // test + «dialog.alert( isCharsetAvailable( "utf-8" ) ) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |