From 460ea396ec8f31bb895a4b2b38b688d50b215424 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Sat, 28 Sep 2019 14:50:35 -0700 Subject: [PATCH] Parse mi files (#935) * Add more maki files found online * Add parser for .mi files and confirm it can derive the objects we have today --- .../extra/nde_specs_v1.txt | 189 ++ .../Unknown (Winamp 5.03)/lib/config.mi | 22 + .../Unknown (Winamp 5.03)/lib/std.mi | 2472 +++++++++++++++++ .../Unknown (Winamp 5.03)/readme.md | 7 + modern/src/maki-interpreter/tools/parse-mi.js | 66 + .../maki-interpreter/tools/parse-mi.test.js | 66 + 6 files changed, 2822 insertions(+) create mode 100644 modern/resources/maki_compiler/Unknown (Winamp 5.03)/extra/nde_specs_v1.txt create mode 100644 modern/resources/maki_compiler/Unknown (Winamp 5.03)/lib/config.mi create mode 100644 modern/resources/maki_compiler/Unknown (Winamp 5.03)/lib/std.mi create mode 100644 modern/resources/maki_compiler/Unknown (Winamp 5.03)/readme.md create mode 100644 modern/src/maki-interpreter/tools/parse-mi.js create mode 100644 modern/src/maki-interpreter/tools/parse-mi.test.js diff --git a/modern/resources/maki_compiler/Unknown (Winamp 5.03)/extra/nde_specs_v1.txt b/modern/resources/maki_compiler/Unknown (Winamp 5.03)/extra/nde_specs_v1.txt new file mode 100644 index 00000000..c0f9255f --- /dev/null +++ b/modern/resources/maki_compiler/Unknown (Winamp 5.03)/extra/nde_specs_v1.txt @@ -0,0 +1,189 @@ + Nullsoft Database Engine Format Specifications v1.0 + --------------------------------------------------- + + + + + + + +1. Tables +--------- + +Tables are saved using two files, one containing the data, and one containing the indexes : + +Data file : .DAT +Index file : .IDX + + +2. Index File Structure +----------------------- + +Note that string types are not zero terminated, they are either of fixed size (indicated in the following tables) +or their size is determined by another field. + + +================================================================================================== +Offset Data Type Size Field +================================================================================================== +0 STRING 8 "NDEINDEX" +8 INT 4 Number of records +12 INDEX 4*NumberOfRecords Primary Index (insertion order) + +Optional : + +4*NumberOfRecords+12 INDEX 4*NumberOfRecords First Secondary Index +2*(4*NumberOfRecords)+12 INDEX 4*NumberOfRecords Second Secondary Index +... +================================================================================================== + + +The INDEX type is a simple array of INT (4 bytes) where each entry represents the offset of the record in the datafile. +Thus, INDEX[0] gives you the offset for the first record of that index. + + +3. Data File Structure +---------------------- + +The data file is a simple data pool from which structured data is pulled. The file begins with a 8 bytes long +string signature that reads "NDETABLE", there rest is the data. + +Records are fetched directly from the data pool using the offset stored in each appropriate index, using the +beginning of the file as offset 0. + +4. Records Structure +-------------------- + +A record is a linked list made of 'field' elements, and so, when you retrieve a record, you actually retrieve the +first field of a linked list, and then add each new field to the record structure (or class) as you read more of them, +following the chain. + +Record 0 is a list of the columns that make our table. +Record 1 is a list of the indexes that are found in the index file. +Record 2 is the first record of the table, it is a list of fields of various types (ie, int, string, etc) + + +5. Fields Structures +-------------------- + +The following structures indicate offsets relative to the beginning of the (sub)structures. + +Field : + +================================================================================================== +Offset Data Type Size Field +================================================================================================== +0 UCHAR 1 Column ID +1 UCHAR 1 Field Type +2 INT 4 Size of field data +6 INT 4 Next field position in table data pool +10 INT 4 Previous field position in table data pool +14 FIELDDATA SizeOfFieldData Field data +================================================================================================== + +Field Types : + +FIELD_UNDEFINED = 255 +FIELD_COLUMN = 0 +FIELD_INDEX = 1 +FIELD_REDIRECTOR = 2 +FIELD_STRING = 3 +FIELD_INTEGER = 4 +FIELD_BOOLEAN = 5 +FIELD_BINARY = 6 +FIELD_GUID = 7 +FIELD_FLOAT = 9 +FIELD_DATETIME = 10 +FIELD_LENGTH = 11 + +Field Data Types : + + * Column Field : + + ================================================================================================== + Offset Data Type Size Field + ================================================================================================== + 0 UCHAR 1 Column Field Type (ie, FIELD_INTEGER) + 1 UCHAR 1 Index unique values (0/1) + 2 UCHAR 1 Size of column name string + 3 STRING SizeOfColumnName Public name of the column + ================================================================================================== + + * Index Field : + + ================================================================================================== + Offset Data Type Size Field + ================================================================================================== + 0 INT 4 Offset of this index in the index file + 4 INT 4 Type of the field on which this index sorts (FIELD_UNDEFINED for the primary index) + 8 UCHAR 1 Size of index name string + 9 STRING SizeOfIndexName Public name of the index + ================================================================================================== + + + * Redirector Field : + + ================================================================================================== + Offset Data Type Size Field + ================================================================================================== + 0 INT 4 Redirection offset in the data pool + ================================================================================================== + + If you read a redirector field, you should move to the appropriate offset and read a new field there. + + * String Field : + + ================================================================================================== + Offset Data Type Size Field + ================================================================================================== + 0 USHORT 2 Size of string + 2 STRING SizeOfString String + ================================================================================================== + + * Integer Field, DateTime Field, Length Field : + + ================================================================================================== + Offset Data Type Size Field + ================================================================================================== + 0 INT 4 Integer value + ================================================================================================== + + Length fields are exactly the same as integer fields, but instead of holding some unknown quantity, they have been + marked as lengths by the application. + + For DateTime fields, the value is to be interpreted as a standard C time_t value. + + * Boolean Field : + + ================================================================================================== + Offset Data Type Size Field + ================================================================================================== + 0 UCHAR 1 Boolean value + ================================================================================================== + + * Binary Field : + + ================================================================================================== + Offset Data Type Size Field + ================================================================================================== + 0 USHORT 2 Size of binary data + 2 BINARY SizeOfBinaryData Binary data + ================================================================================================== + + * GUID Field : + + ================================================================================================== + Offset Data Type Size Field + ================================================================================================== + 0 GUID 16 Guid data + ================================================================================================== + + * Float Field : + + ================================================================================================== + Offset Data Type Size Field + ================================================================================================== + 0 FLOAT 4 Float value + ================================================================================================== + + diff --git a/modern/resources/maki_compiler/Unknown (Winamp 5.03)/lib/config.mi b/modern/resources/maki_compiler/Unknown (Winamp 5.03)/lib/config.mi new file mode 100644 index 00000000..d3b885d6 --- /dev/null +++ b/modern/resources/maki_compiler/Unknown (Winamp 5.03)/lib/config.mi @@ -0,0 +1,22 @@ +#ifndef __CONFIG_MI +#define __CONFIG_MI + +extern class @{593DBA22 - D077 - 4976 - B952 - F4713655400B} @Object _predecl Config; +extern class @{D4030282 - 3AAB - 4d87 - 878D - 12326FADFCD5} @Object ConfigItem; +extern class @{24DEC283 - B76E - 4a36 - 8CCC - 9E24C46B6C73} @Object ConfigAttribute; + +extern ConfigItem Config.getItem(String item_name); +extern ConfigItem Config.getItemByGuid(String item_guid); +extern ConfigItem Config.newItem(String item_name, String item_guid); + +extern ConfigAttribute ConfigItem.getAttribute(String attr_name); +extern ConfigAttribute ConfigItem.newAttribute(String attr_name, String default_val); +extern String ConfigItem.getGuid(String attr_name); + +extern ConfigAttribute.setData(String value); +extern String ConfigAttribute.getData(); +extern ConfigAttribute.onDataChanged(); +extern ConfigItem ConfigAttribute.getParentItem(); +extern String ConfigAttribute.getAttributeName(); + +#endif \ No newline at end of file diff --git a/modern/resources/maki_compiler/Unknown (Winamp 5.03)/lib/std.mi b/modern/resources/maki_compiler/Unknown (Winamp 5.03)/lib/std.mi new file mode 100644 index 00000000..9289f78c --- /dev/null +++ b/modern/resources/maki_compiler/Unknown (Winamp 5.03)/lib/std.mi @@ -0,0 +1,2472 @@ +//---------------------------------------------------------------------------------------------------------------- +// std.mi +// +// standard definitions for internal objects +//---------------------------------------------------------------------------------------------------------------- + +#ifndef __STD_MI +#define __STD_MI + +#ifndef true +#define true 1 +#endif +#ifndef false +#define false 0 +#endif + +#define MC_TARGET "Winamp 5.03 (skin version 1.2)" +#define VCPU_VERSION 2 + +// GUIDS +extern class @{51654971 - 0D87 - 4a51 - 91E3 - A6B53235F3E7} @ @{00000000 - 0000 - 0000 - 0000 - 000000000000} @Object; +extern class @{D6F50F64 - 93FA - 49b7 - 93F1 - BA66EFAE3E98} @Object _predecl System; +extern class @{E90DC47B - 840D - 4ae7 - B02C - 040BD275F7FC} @Object Container; +extern class @{00C074A0 - FEA2 - 49a0 - BE8D - FABBDB161640} @Object Wac; +extern class @{B2023AB5 - 434D - 4ba1 - BEAE - 59637503F3C6} @Object &List; +extern class @{38603665 - 461B - 42a7 - AA75 - D83F6667BF73} @Object ⤅ +extern class @{F4787AF4 - B2BB - 4ef7 - 9CFB - E74BA9BEA88D} @Object &PopupMenu; +extern class @{3A370C02 - 3CBF - 439f - 84F1 - 86885BCF1E36} @Object &Region; +extern class @{5D0C5BB6 - 7DE1 - 4b1f - A70F - 8D1659941941} @Object &Timer; +extern class @{A5376FA1 - 4E94 - 411a - 83F6 - 05EC5EEA5F0A} @Object &FeedWatcher; +extern class @{4EE3E199 - C636 - 4bec - 97CD - 78BC9C8628B0} @Object &GuiObject; +extern class @{45BE95E5 - 2072 - 4191 - 935C - BB5FF9F117FD} @GuiObject &Group; +extern class @{60906D4E-537E-482e-B004 - CC9461885672} @Group &Layout; +extern class @{403ABCC0 - 6F22 - 4bd6 - 8BA4 - 10C829932547} @GuiObject &Component; +extern class @{97AA3E4D - F4D0 - 4fa8 - 817B - 0AF22A454983} @GuiObject &ComponentBucket; +extern class @{64E4BBFA - 81F4 - 49d9 - B0C0 - A85B2EC3BCFD} @GuiObject &Edit; +extern class @{62B65E3F - 375E-408d - 8DEA - 76814AB91B77} @GuiObject &Slider; +extern class @{CE4F97BE - 77B0 - 4e19 - 9956 - D49833C96C27} @GuiObject &Vis; +extern class @{A8C2200D - 51EB - 4b2a - BA7F - 5D4BC65D4C71} @GuiObject &Browser; +extern class @{8D1EBA38 - 489E-483e-B960 - 8D1F43C5C405} @GuiObject &EqVis; +extern class @{0F08C940 - AF39 - 4b23 - 80F3 - B8C48F7EBB59} @GuiObject &Status; +extern class @{EFAA8672 - 310E-41fa - B7DC - 85A9525BCB4B} @GuiObject &Text; +extern class @{7DFD3244 - 3751 - 4e7c - BF40 - 82AE5F3ADC33} @GuiObject &Title; +extern class @{5AB9FA15 - 9A7D - 4557 - ABC8 - 6557A6C67CA9} @GuiObject &Layer; +extern class @{698EDDCD - 8F1E-4fec - 9B12 - F944F909FF45} @GuiObject &Button; +extern class @{6B64CD27 - 5A26 - 4c4b - 8C59 - E6A70CF6493A} @Layer &AnimatedLayer; +extern class @{B4DCCFFF - 81FE-4bcc - 961B - 720FD5BE0FFF} @Button &ToggleButton; +extern class @{01E28CE1 - B059 - 11d5 - 979F - E4DE6F51760A} @GuiObject &GroupList; +extern class @{80F0F8BD - 1BA5 - 42a6 - A093 - 3236A00C8D4A} @Group &CfgGroup; +extern class @{CDCB785D - 81F2 - 4253 - 8F05 - 61B872283CFA} @GuiObject &QueryList; +extern class @{9B2E341B - 6C98 - 40fa - 8B85 - 0C1B6EE89405} @GuiObject &MouseRedir; +extern class @{36D59B71 - 03FD - 4af8 - 9795 - 0502B7DB267A} @GuiObject &DropDownList; +extern class @{7FD5F210 - ACC4 - 48df - A6A0 - 5451576CDC76} @GuiObject &LayoutStatus; +extern class @{B5BAA535 - 05B3 - 4dcb - ADC1 - E618D28F6896} @GuiObject &TabSheet; +extern class @{6129FEC1 - DAB7 - 4d51 - 9165 - 01CA0C1B70DB} @GuiObject &GuiList; +extern class @{D59514F7 - ED36 - 45e8 - 980F - 3F4EA0522CD9} @GuiObject &GuiTree; +extern class @{9B3B4B82 - 667A - 420e-8FFC - 794115809C02} @Object &TreeItem; +extern class @{1D8631C8 - 80D0 - 4792 - 9F98 - BD5D36B49136} @GuiObject &MenuButton; +extern class @{C7ED3199 - 5319 - 4798 - 9863 - 60B15A298CAA} @GuiObject &CheckBox; +extern class @{2D2D1376 - BE0A - 4CB9 - BC0C - 57E6E4C999F5} @GuiObject &Form; + +#define WindowHolder Component + +// class tree member functions & events + +//***************************************************************************** +// Object CLASS +//***************************************************************************** +/** + Object Class. + + @short This is the base class from which all other classes inherit. + @author Nullsoft Inc. + @ver 1.0 +*/ + +/** + getClassName() + + Returns the class name for the object. + + @ret The class name. +*/ +extern String Object.getClassName(); + +/** + getId() + +*/ +extern String Object.getId(); + +/** + onNotify() + + @ret + @param command + @param param + @param a + @param b +*/ +extern Int Object.onNotify(String command, String param, int a, int b); + +//***************************************************************************** +// System CLASS +//***************************************************************************** +/** + System Class. + + @short The system class are basic system functions accessible to all. + @author Nullsoft Inc. + @ver 1.0 +*/ + +/** + onScriptLoaded() + + Hookable. Event happens when script has just finished being loaded. + No params. +*/ +extern System.onScriptLoaded(); + +/** + onScriptUnloading() + + Hookable. Event happens when script is going to be unloaded. + No params. +*/ +extern System.onScriptUnloading(); + +/** + onQuit() + + Hookable. Event happens when the user quits the application. + No params. +*/ +extern System.onQuit(); + +/** + onSetXuiParam(String param, String value) + + Hookable. Event happens when the script is in a group implementing + an xuiobject and a parameter has not been recognized by the group or + the embedded object. + + No params. +*/ +extern System.onSetXuiParam(String param, String value); + +/** + onKeyDown() + + Hookable. Event happens when the user presses a key on the keyboard. + + @param key The key that was pressed. +*/ +extern System.onKeyDown(String key); + +/** + onAccelerator() + + Hookable. Event happens when the user presses an accelerator key. + + @param action The action to perform (from locales) + @param section The locales section for the accelerator. + @param key The key, ie: "tab", "ctrl+a". +*/ +extern System.onAccelerator(String action, String section, String key); + +/** + onCreateLayout() + + Hookable. Event happens when a layout is created. + + @param _layout The layout that was just created. +*/ +extern System.onCreateLayout(Layout _layout); + +/** + onShowLayout() + + Hookable. Event happens when a layout is about to be shown. + This even only happens if the layout was previously hidden. + + @param _layout The layout that's about to be shown. +*/ +extern System.onShowLayout(Layout _layout); + +/** + onHideLayout() + + Hookable. + + @param _layout The layout that's about to be hidden. +*/ +extern System.onHideLayout(Layout _layout); + +/** + onStop() + + Hookable. Event happens when Winamp3 stops playing a file. + No params. +*/ +extern System.onStop(); + +/** + onPlay() + + Hookable. Event happens when Winamp3 starts playing a file. + No params. +*/ +extern System.onPlay(); + +/** + onPause() + + Hookable. Event happens when Winamp3 pauses playback. + No params. +*/ +extern System.onPause(); + +/** + onResume() + + Hookable. Event happens when Winamp3 resumes playback. + Event only happens when the song was previously set in a paused state. + No params. +*/ +extern System.onResume(); + +/** + onTitleChange() + + Hookable. Event happens when the song title changes. +*/ +extern System.onTitleChange(String newtitle); + +extern System.onTitle2Change(String newtitle2); +extern System.onInfoChange(String info); +extern System.onStatusMsg(String msg); + +/** + onEqBandChanged() + + Hookable. Event happens when an equalizer band changes values. + The bands are numbered from 0 to 9 (0 being 60Hz and 9 being 16kHz) + and their values range from -127 to +127. + + @param band The frequency band that has changed. + @param newvalue The new value of the frequency band. +*/ +extern System.onEqBandChanged(int band, int newvalue); + +/** + onEqPreampChanged() + + Hookable. Event happens when the equalizer pre-amp has changed + values. Range of the value is from -127 to +127. + + @param newvalue The new pre-amp value. +*/ +extern System.onEqPreampChanged(int newvalue); + +/** + onEqChanged() + + Hookable. Event happens when the EQ is switched on or off. + 0 means the EQ was turned off. 1 means it was turned on. + You might want to use true and false to verify this, it's a bit + more elegant. :) + + @param newstatus The new status of the EQ. +*/ +extern System.onEqChanged(int newstatus); + +/** + onVolumeChanged() + + Hookable. Event happens when the volume was changed. + The range of the volume is from 0 to 255. + + @param newvol The new volume value. +*/ +extern System.onVolumeChanged(int newvol); + +/** + onSeek() + + Hookable. Event happens when the user seeks + to a position in the track. + + @param newpos The seekers new position. +*/ +extern System.onSeek(int newpos); + +/** + getContainer() + + @ret The requested container. + @param container_id The containers identifier string. +*/ +extern Container System.getContainer(String container_id); + +/** + newDynamicContainer() + + @ret The new container. + @param container_id The identifier for the container you want to create. +*/ +extern Container System.newDynamicContainer(String container_id); + +/** + newGroup() + + @ret The new group. + @param group_id The identifier for the group you want to create. +*/ +extern Group System.newGroup(String group_id); + +extern Layout System.newGroupAsLayout(String group_id); + +/** + getNumContainers() + + Get the number of containers currently created. + + @ret The number of containers. +*/ +extern Int System.getNumContainers(); + +/** + enumContainer() + + Returns the name of the container associated with it's number. + Use getNumContainers() to fetch the number of containers present. + The containers are numbered from 0 to the value returned by getNumContainers(). + + @ret The name of the specified container. + @param num The container's number for which you want to know the name. +*/ +extern Container System.enumContainer(Int num); + +/** + getWac() + + Gets the reference to the wac identified by the guid sent. + + @ret The requested WAC. + @param wac_guid The WAC's GUID. +*/ +extern Wac System.getWac(String wac_guid); + +/** + messageBox() + + Creates a message box. + The flag paramater lets you set the style of the message box. + Just use the OR bitwise operator to set the style you want. + Here's a list of the flags you can use: + + MSGBOX_OK Adds an OK button. (1) + MSGBOX_CANCEL Adds a CANCEL button. (2) + MSGBOX_YES Adds a YES button. (4) + MSGBOX_NO Adds a NO button. (8) + MSGBOX_ALL Adds ALL buttons. (16) + MSGBOX_NEXT Adds a NEXT button. (32) + MSGBOX_PREVIOUS Adds a PREVIOUS button. (64) + + Note that the notanymore_id parameter stores the users answer in the + configuration file with the entry name specified by it's value. + + @ret The value of the button that was pressed (example: if OK is pressed, 1 is returned). + @param message The message you want to display. + @param msgtitle The title of the message box. + @param flag The message box style you want. + @param notanymore_id Configuration item name in which to store the users answer. +*/ +extern Int System.messageBox(String message, String msgtitle, Int flag, String notanymore_id); + +/** + getPlayItemString() + + @ret The name of what is playing. +*/ +extern String System.getPlayItemString(); + +/** + getPlayItemLength() + + Get the length of the track currently playing, in milliseconds. + + @ret Length of the track, in seconds. +*/ +extern Int System.getPlayItemLength(); + +/** + getPlayItemMetaDataString() + + Get metadata for the track currently playing. The metadata field names that + are available are the following: + + **ADD LIST** + + @ret The requested metadata. + @param metadataname The name of the metadata field you want to read. +*/ +extern String System.getPlayItemMetaDataString(String metadataname); +extern String System.getPlayItemDisplayTitle(); + +/** + getExtFamily() + + Gets registered family for given extension (i.e. mp3 -> "Audio") + + @ret The registered family for given extension. + @param ext The extension in question. +*/ +extern String System.getExtFamily(String ext); + +/** + playFile() + + Play the requested file. Path and filename are required + with proper extension (example: playFile("c:\music\mp3\file.mp3"); ). + It also works with URL's (example: playFile("http://myshoutcast.com:8000"); ). + + @param playitem The path and filename to play. +*/ +extern System.playFile(String playitem); + +/** + getLeftVuMeter() + + Get the value of the left vu meter. + Range is from 0 to 255. Linear. + + @ret The value of the left vu meter. +*/ +extern Int System.getLeftVuMeter(); + +/** + getRightVuMeter() + + Get the value of the right vu meter. + Range is from 0 to 255. Linear. + + @ret The value of the left vu meter. +*/ +extern Int System.getRightVuMeter(); + +/** + getVolume() + + Get the current volume. Range is from 0 to 255. + + @ret The current volume. +*/ +extern Int System.getVolume(); + +/** + setVolume() + + Set the volume to the desired value. + Range is from 0 to 255. + + @param vol The desired volume value. +*/ +extern System.setVolume(Int vol); + +/** + play() + + Trigger the play event. +*/ +extern System.play(); + +/** + stop() + + Trigger the stop event. +*/ +extern System.stop(); + +/** + pause() + + Trigger the pause event. +*/ +extern System.pause(); + +/** + next() + + Trigger the next event. +*/ +extern System.next(); + +/** + previous() + + Trigger the previous event. +*/ +extern System.previous(); + +/** + eject() + + Trigger the eject event. +*/ +extern System.eject(); + +/** + seekTo() + + Seek to the desired position in the track. Range is from + 0 to SONG LENGTH (in milliseconds). +*/ +extern System.seekTo(Int pos); + +/** + getPosition() + + Get the current position in the track currently playing, + in milliseconds. + + @ret The current position in the track. +*/ +extern Int System.getPosition(); + +/** + setEqBand() + + Sets the requested equalizer band to the specified value. + The bands are numbered from 0 (60Hz) to 9 (16kHz) and + each range from -127 to +127. + + @param band The EQ band to set. + @param value The desired value for the specified band. +*/ +extern System.setEqBand(int band, Int value); + +/** + setEqPreamp() + + Set the equalizer pre-amp to the desired value. + Range is from -127 to +127 (0 means no preamp). + + @param value The desired value for the pre-amp. +*/ +extern System.setEqPreamp(Int value); + +/** + Set the equalizer to the desired state. On or off. + 0 is off, 1 is on. + + @param onoff The desired state for the eq. +*/ +extern System.setEq(Int onoff); + +/** + getEqBand() + + Get the value of an equalizer band. The bands + are numbered from 0 (60Hz) to 9 (16kHz). The return + value range is from -127 to +127. + + @ret The value of the band. + @param band The eq band number you want to get. +*/ +extern Int System.getEqBand(int band); + +/** + getEqPreamp() + + Get the equalizer preamp value. The value range is + from -127 to +127 (0 means no preamp). + + @ret The preamp's current value. +*/ +extern int System.getEqPreamp(); + +/** + getEq() + + Get the equalizer state. 0 for off, 1 for on. + Remember to compare return value to true and false. + + @ret The EQ's state. +*/ +extern int System.getEq(); + +/** + getMousePosX() + + This returns the X position of the mouse in the screen, + using the screen coordinate system. + + @ret The mouse's current X pos. +*/ +extern int System.getMousePosX(); + +/** + getMousePosY() + + This returns the Y position of the mouse in the screen, + using the screen coordinate system. + + @ret The mouse's current Y pos. +*/ +extern int System.getMousePosY(); + +/** + integerToString() + + Get the string representation of an integer. + + @ret The string equivalent of the integer. + @param value The integer to change into a string. +*/ +extern String System.integerToString(Int value); + +/** + StringToInteger() + + Get the integer representation of a string. + + @ret The integer equivalent of the string. + @param str The string to change into an integer. +*/ +extern Int System.StringToInteger(String str); + +/** + floatToString() + + Get the string representation of a floating point number. + + @ret The string representation of the float number. + @param value The float to convert. + @param ndigits Number of digits after the decimal point you want. +*/ +extern String System.floatToString(float value, int ndigits); + +/** + stringToFloat() + + Get the floating point representation of a string. + + @ret The float representation of the string. + @param str The string to convert. +*/ +extern Float System.stringToFloat(String str); + +/** + integerToLongTime() + + Convert a time in seconds to a HH:MM:SS value. + + @ret The string representation of the time (HH:MM:SS). + @param value Timestamp to use. +*/ +extern String System.integerToLongTime(Int value); + +/** + integerToTime() + + Convert a time in seconds to a MM:SS value. + + @ret The string representation of the time (MM:SS). + @param value Timestamp to use. +*/ +extern String System.integerToTime(Int value); + +extern String System.dateToTime(Int datetime); // prints the time from a date with the same format as integerToTime +extern String System.dateToLongTime(Int datetime); // prints the time from a date with the same format as integerToLongTime +extern String System.formatDate(Int datetime); // formats the date according to the locales - short date format +extern String System.formatLongDate(Int datetime); // formats the date according to the locales - long date format +extern Int System.getDateYear(Int datetime); // returns the datetime's year since 1900 +extern Int System.getDateMonth(Int datetime); // returns the datetime's month (0-11) +extern Int System.getDateDay(Int datetime); // returns the datetime's day of the month (1-31) +extern Int System.getDateDow(Int datetime); // returns the datetime's day of the week (0-6) +extern Int System.getDateDoy(Int datetime); // returns the datetime's day of the year (0-365) +extern Int System.getDateHour(Int datetime); // returns the datetime's hour (0-23) +extern Int System.getDateMin(Int datetime); // returns the datetime's minutes (0-59) +extern Int System.getDateSec(Int datetime); // returns the datetime's seconds (0-59) +extern Int System.getDateDst(Int datetime); // returns the datetime's daylight savings flag +extern Int System.getDate(); // returns the datetime, use with the above functions + +/** + strmid() + + Get a substring from a string. + + @ret The substring. + @param str The string. + @param start The start position. + @param len The length of the string to extract, from start position. +*/ +extern String System.strmid(String str, Int start, Int len); + +/** + strleft() + + Get a substring from a string, starting from the left. + + @ret The substring. + @param str The string. + @param nchars The length of the string to extract, from the left. +*/ +extern String System.Strleft(string str, int nchars); + +/** + strright() + + Get a substring from a string, starting from the right. Since + the start point is the right of the string (or the end). It will + extract the string starting from the END going towards the BEGINNING. + + @ret The substring. + @param str The string. + @param nchars The length of the string to extract, from the right. +*/ +extern string System.strright(string str, int nchars); + +/** + strsearch() + + Search a string for any occurance of substring. If the substring was + found in the string, it will return the position of the substring in + the string searched. If the substring is not found, the return value + is -1. + + @ret Position at which the substring was found. + @param str The string to search in. + @param substr The substring to find. +*/ +extern int System.strsearch(string str, string substr); + +/** + strlen() + + Returns the length of the string. + + @ret The length of the string. + @param str The string. +*/ +extern int System.strlen(string str); + +/** + strupper() + + Convert a string to all uppercase. + + @ret The uppercase string. + @param str The string to uppercase. +*/ +extern string System.strupper(string str); + +/** + strlower() + + Convert a string to all lowercase. + + @ret The lowercase string. + @param str The string to lowercase. +*/ +extern string System.strlower(string str); + +/** + urlEncode() + + URL Encode a string. Characters that are NOT encoded + are: All letters, All digits, underscore (_), dash (-) and + period (.). + + @ret The URL encoded string. + @param url The string to URL encode. +*/ +extern string System.urlEncode(string url); + +/** + removePath() + + Remove the path from a full filename. (example: + c:\music\mp3\test.mp3 -> test.mp3) + Also works on URLs. + + @ret The filename with the path removed. + @param str The fullpath of a file. +*/ +extern string System.removePath(string str); + +/** + getPath() + + Gets the path from a full filename. (example: + c:\music\mp3\test.mp3 -> c:\music\mp3) + Also works on URLs. + + @ret The path with the filename removed. + @param str The fullpath of a file. +*/ +extern string System.getPath(string str); + +/** + getExtension() + + Gets the extension from a filename. (example: + c:\music\mp3\test.mp3 -> mp3) + Also works on URLs. + + @ret The extension of the filename. + @param str The fullpath of a file. +*/ +extern string System.getExtension(string str); + +/** + getToken() + + Retreive a token from a list of tokens seperated by separator. + The index starts at 0, not 1, so be careful. + Here's a short example: + getToken("1,2,3,4,5", ",", 3); + Would return, 3. If the token you ask for doesn't exist, an + empty string is returned. + + @ret The token requested. + @param str The tokenenized string. + @param separator The separator to use. + @param tokennum The token to retreive. +*/ +extern string System.getToken(string str, string separator, int tokennum); + +/** + sin() + + Takes an angle in radians and returns the ratio of two sides of a right triangle. + The ratio is the length of the side opposite the angle divided by the length + of the hypotenuse. The result range is from -1 to 1. + + Converting from degrees to radians can be done by multiplying degrees by PI/180. + + @ret The sine value of the angle. + @param value The angle for which you want to know the sine value. +*/ +extern double System.sin(double value); + +/** + cos() + + Takes an angle in radians and returns the ratio of the two sides of a right triangle. + The ratio is the length of the side adjacent to the angle divided by the length of the + hypotenuse. The result is range is from -1 to 1. + + @ret The cosine value of the angle. + @param value The angle for which you want to know the cosine value. +*/ +extern double System.cos(double value); + +/** + tan() + + Takes an angle in radians and returns the ratio between two sides of a right triangle. + The ratio is sin(x) divided by cos(x). + + @ret The tangent value of the angle. + @param value The angle for which you want to know the tangent value. +*/ +extern double System.tan(double value); + +/** + asin() + + Takes a sine value ranging from -1 to 1 and returns the angle in radians. + The return value ranges from -PI/2 to +PI/2. + + @ret The angle in radians. + @param value The sine value for which you want to know the angle. +*/ +extern double System.asin(double value); + +/** + acos() + + Takes a cosine value ranging from -1 to 1 and returns the angle in radians. + The return value ranges from -PI/2 to +PI/2. + + @ret The angle in radians. + @param value The cosine value for which you want to know the angle. +*/ +extern double System.acos(double value); + +/** + atan() + + Takes an angle in radians and returns the ration between two sides of a right triangle. + The ratio is cos(x) divided by sin(x). + + @ret The arc tangent value of the angle. +*/ +extern double System.atan(double value); + +/** + atan2() + + @ret The arctangent of y/x. +*/ +extern double System.atan2(double y, double x); + +/** + pow() + + Elevate a number to the N'th power. + + @ret The number + @param value The number you want to elevate to the N power. + @param pvalue The power to which you want to elevate the number. +*/ +extern double System.pow(double value, double pvalue); + +/** + sqr() + + Get the square of a number. + + @ret The number, squared. + @param value The number for which you want the square value. +*/ +extern double System.sqr(double value); + +/** + sqrt() + + Get the square root of a number. + + @ret The square root of the number. + @param value The number for which you want the square root value. +*/ +extern double System.sqrt(double value); + +/** + random() + + Get a randomely generated number. The random number will not + be bigger than the max value indicated. Smallest value is 0. + + @ret The random number. + @param max The maximum value of the random number to return. +*/ +extern int System.random(int max); + +/** + setPrivateString() + + Create a private config entry for your script, of String type. + + @param section The section for the entry. + @param item The item name for the entry. + @param value The value of the entry. +*/ +extern System.setPrivateString(string section, string item, string value); + +/** + setPrivateInt() + + Create a private config entry for your script, of Int type. + + @param section The section for the entry. + @param item The item name for the entry. + @param value The value of the entry. +*/ +extern System.setPrivateInt(string section, string item, int value); + +/** + getPrivateString() + + Read a private config entry of String type. Returns + the specified default value if the section and item isn't + found. + + @ret The value of the config entry. + @param section The section from which to read the entry. + @param item The name of the item to read. + @param defvalue The default value to return if no item is found. +*/ +extern String System.getPrivateString(String section, String item, String defvalue); + +/** + getPrivateInt() + + Read a private config entry of Integer type. Returns + the specified default value if the section and item isn't + found. + + @ret The value of the config entry. + @param section The section from which to read the entry. + @param item The name of the item to read. + @param defvalue The defautl value to return if no item is found. +*/ +extern Int System.getPrivateInt(String section, String item, Int defvalue); + +/** + setPublicString() + + Create a public config entry for your script, of String type. + + @param item The item name for the entry. + @param value The value of the entry. +*/ +extern System.setPublicString(String item, String value); + +/** + setPublicInt() + + Create a public config entry for your script, of Int type. + + @param item The item name of the entry. + @param value The value of the entry. +*/ +extern System.setPublicInt(String item, Int value); + +/** + getPublicString() + + Read a public config entry of String type. Returns + the specified default value if the item isn't found. + + @ret The value of the config entry. + @param item The item name to read. + @param defvalue The default value to return if no item is found. +*/ +extern String System.getPublicString(String item, String defvalue); + +/** + getPublicInt() + + Read a public config entry of Integer type. Returns + the specified default value if the item isn't found. + + @ret The value of the config entry. + @param item The item name to read. + @param defvalue The default value to return if no item is found. +*/ +extern Int System.getPublicInt(String item, Int defvalue); + +/** + getParam() + + Get the parameters with which the script is called. + This is the 'param="..."' attribute in the