Date Created: 2007-??-?? Last Modified: 2007-09-29 Depending on the system this is running on, any number of these may be inline as opposed to actual function or object method calls. It is up to the final assembler for the target system to decide which are the best candidates for this. All of the Any platform objects will be available under the Any pseudo-class. This means that to use a method, such as Base.Print("Hi!"), you would use Any.Base.Print("Hi!"); in your code. This is designed to prevent possible mismatches from occurring between Any platform specific code and user code. Specials: [Any NonObject] Any data type except for objects/classes may be used here Note that psuedo objects, such as Strings, Variants, etc. may be used [NonObject Data Type] Instead of a normal value or variable, you put the name of a built-in non-object types. This includes all numeric types, Strings, Variants, etc. [NDT] The same type as the [NonObject Data Type] specified [Numeric Type] Any numeric type [Static Data Type] Instead of a normal value, you put a static type here (eg, U32) [SDT] The same type as the [Static Data Type] specified [String Type] This is a String, StringMem or a StringNull [Object Type] This may be any object type: classes, structs, Strings, Variants and Variant Objects. They are passed to the routine as two separate variables which are declared as: Nothing SomeFunc(ObjectDefinition datadefinition, U8 *datapointer) The data type will contain a reference pointer to the data type's definition structure. *************************************************************************************************** * Language Constructs These special "functions" are actually built into AnyScript and are not object-based. They are always available, even if a Using statement has changed the current object. // This always switches endianness of a value, regardless of whether we're on a Big or Little // endian processor Nothing SwitchEndian([Numeric Type] &somevalue); // If we are on a little endian system, this switches the endianness of the value // Otherwise, if we are on a big endian system, this does nothing and is ignored // On a little endian system, this translates: // SwitchEndianFromBig(a); // To (in AnyASM): // SwitchEndian a; Nothing SwitchEndianFromBig([Numeric Type] &somevalue); // If we are on a big endian system, this switches the endianness of the value // Otherwise, if we are on a little endian system, this does nothing and is ignored Nothing SwitchEndianFromLittle([Numeric Type] &somevalue); // Type casts any standard data type to the new type specified // Returns: The value after the type cast // somevar The value to type cast [NDT] TypeCast([Any NonObject] somevar, [NonObject Data Type]); *************************************************************************************************** Base ------------------------------------------------------------------------------------------------- Methods // Checks if a key is waiting to be received // Returns: 0 - No key was available // 0xFFFF - The system does not have a keyboard // Anything else - A translated key code UProcInt CheckKey() // KERBLUH - I do not know if we are going to use this or not // Outputs directly to the console // Often times this is the same as a Print, but there are cases where print might go elsewhere, // such as when the program is running as a CGI. // Returns: Nothing // outputstring The string to output // flags Extra flags: // BITS // 0 - 0001 - Use "clean" line wrapping ANY_BASE_PRINT_CLEANLINEWRAP // (no wrapping mid-word) Nothing ConsolePrint([String Type] outputstring, UProcInt flags = 0x00) // Outputs the specified string to the standard output device // Returns: Nothing // outputstring The string to output // flags Extra flags: // BITS // 0 - 0001 - Use "clean" line wrapping ANY_BASE_PRINT_CLEANLINEWRAP // (no wrapping mid-word) Nothing Print([String Type] outputstring, UProcInt flags = 0x00) // Gets a key. If there is no key pressed, it waits for a keypress before returning // Note that this should never be used in a time-critical application. // Returns: 0xFFFF - The system does not have a keyboard // Anything else - A translated key code UProcInt WaitKey() *************************************************************************************************** Block ------------------------------------------------------------------------------------------------- Methods // Compares the two buffers // Returns: < 0 if buffer1 is less than buffer2, > 0 if buffer2 is greater than buffer1, 0 if they // are identical // buffer1 The first buffer // buffer2 The buffer to compare to the first buffer // numvalues The number of [SDT] values to compare ProcInt Compare([Static Data Type], U8 *buffer1, U8 *buffer2, U32Up numvalues) // Moves several bytes from one location to another // If the two buffers overlap, this function properly transfers them // Returns: Nothing // destination A pointer to the target location // source A pointer to the source location // numbytes The number of [SDT] values to transfer Nothing Move([Static Data Type], U8 *destination, U8 *source, U32Up numvalues) // Searches for the first occurrence of a value // Returns: The index of the first occurrence of the value, -1 if not found // buffer The buffer to search // value The value to look for // length The maximum length of the buffer to search S32Up Search([Static Data Type], U8 *buffer, [SDT] value, U32Up length) // Sets the specified number of values to the value specified // Returns: Nothing // destination A pointer to a buffer to set to value // value The value to set the data to // numvalues The number of [SDT] values to set in the destination array Nothing Set([Static Data Type], U8 *destination, [SDT] value, U32Up numvalues) // NOTE: Block Set on smaller data types may be graduated to larger data types by creatively // assigning the number of bytes to store at any given time. // For example, if we are setting 100 bytes, we can load a DWord with four copies of that // byte and treat it as a store for 25 dwords using that value. Similarly, 100 words would // set 200 bytes with a loaded DWord with two copies of the word. Things get tricky when // we're beyond the processor's capability, of course (such as U64 stores), but those would // simply use unique functions, ne? // The same sort of "combining" may be done with the Search and Compare block functions Add support for (Two Buffers or One Value to a Buffer): Add And AndNot SwitchEndian - Single buffer only Divide Modulus Multiply Or Subtract Xor *************************************************************************************************** File File system operations. Low level file and directory I/O, creation, modification and deletion. Windows-style directories are supported because C:\SomeDir\ is translated to /DriveC/SomeDir/ Note that the Windows-style of accessing root files on the current drive, eg. \SomeDir, does work as expected since Any keeps track of what the current drive is and which directory on each drive is currently selected. To access a file at the completely root level in Windows systems, use a forward slash (/) instead of a back slash (\). Aside from accessing the root of the current drive in Windows, \ and / are treated the same. File positions and sizes are S64Ups, permitting full 64bit file length and position control. On some systems such as the Atari ST and MS-DOS, only the low 32bits will ever be used in these values since the operating system does not support 64bit file sizes. The constant ANY_FILE_SIZE_BITS may be used to test if 32 or 64 bits are used. Note that Windows 95/98/ME also do NOT support 64bit file sizes. The following constants define the file system works on the current system: ANY_FILE_SIZEBITS ProcInt. 32 if 32bit file sizes/positions are used natively, 64 if full 64bit file sizes/positions are used natively ANY_FILE_SIZEMAXIMUM U64Up. Maximum file size, in bytes, permitted on this sytem. ANY_FILE_SECTORSIZE U32Up. The maximum sector size to expect on the current operating system. This is generally 512 or 1024. ANY_FILE_SUPPORTSLOCKING Boolean. True if the file system supports locking. If it is not supported, it will be emulated, but no real file locking will occur ANY_FILE_SUPPORTSASYNCHRONOUS Boolean. True only if the file system supports asynchronous file I/O. If it is not supported, it will be emulated, but will not truly be asynchronous The following data types are defined for the file system: FileSize S32/S64. On systems that use 32bit file sizes, this will be a signed 32bit value. On systems that use 64bit file sizes, this will be a signed 64bit value. Pointers stored in files or transferred to other systems will have to be specified as 32bit or 64bit. This is how most file I/O systems operate anyways. 32bit is by far more common. FilePointer ProcInt. Holds a file pointer which is only valid between a call to File.IO.Open and the call to File.IO.Close. Note that File.IO.CloseAll will invalidate all FilePointer values. 0 or higher for a valid file pointer, -1 for an error. ------------------------------------------------------------------------------------------------- Properties LastError This holds the value of the last error, if any, from the File.IO methods ------------------------------------------------------------------------------------------------- Events // This event is called when a File method throws an unexpected error. // functionname This will contain the full name of the method that threw the error // For example, if Exists caused the error, this would be // "Any.File.Exists" Nothing OnError(StringMem functionname) ------------------------------------------------------------------------------------------------- Methods // Tests if a specified file exists. This does not test if the user is permitted to access that // file or not, though that may be why an existing file does not appear to exist (eg, it's in a // directory the current user cannot access). Using GetPermissions will tell you full details // about a file, such as whether or not you have access to it. // KERBLUH - How do we treat "hidden", "system", "temporary", "offline", etc? // Should we add extras for "archive", "compressed", "encrypted", etc? // Should we add a flag for "check if it exists, even if permission is denied"? // For now, all "Reparse Point" files are treated as links in Windows // Returns: False - The file does not exist, permission is denied to access the file's // directory, or file does not match file type to look for // True - The file exists, based on the flags specified // filename The name of the file. This can be local, relative, or global // flags Control flags to determine what is returned: // BITS // 0 - 0001 - Exclude directories (files only) // 1 - 0002 - Exclude files (directories only) // 2 - 0004 - Exclude links (non-links/real files only) // 3 - 0008 - Exclude non-links/real files (links only) // Bit 0 and 1 cannot be used together; Bit 2 and 3 cannot be used together // Using either combination causes an automatic failure // This gives us 9 predefined values (only one at a time may be used): // 0 - Anything goes! ANY_FILE_EXISTS_ANY // 1 - Files only (links or real) ANY_FILE_EXISTS_FILE // 2 - Directories only (links or real) ANY_FILE_EXISTS_DIR // 4 - Files and directories (real) ANY_FILE_EXISTS_ANYREAL // 5 - Files only (real) ANY_FILE_EXISTS_FILEREAL // 6 - Directories only (real) ANY_FILE_EXISTS_DIRREAL // 8 - Files and directories (links) ANY_FILE_EXISTS_ANYLINK // 9 - Files only (links) ANY_FILE_EXISTS_FILELINK // A - Directories only (links) ANY_FILE_EXISTS_DIRLINK Boolean Exists(Constant [String Type] filename, UProcInt flags = 0) // Get the size of a file // Returns: Size of the file in bytes, or -1 on error // filename Name of the file FileSize GetFileSize(Constant [String Type] filename) // KERBLUH - Incomplete // filename Name of the file UProcInt GetPermissions(Constant [String Type] filename) // Touches a file (ie. creates an empty file if it doesn't exist, or updates the "last accessed" // if it does exist) // Returns: True - File touched successfully // False - Error or permission denied // filename The name of the file Boolean Touch(Constant [String Type] filename) ================================================================================================= IO The IO class of File is designed for direct file IO. In all of the functions listed below, the program will be halted until the file transfer has completed (read operations and write if always flush is on) or until an error is detected, unless the Asynchronous flag is set when opening a file. Some systems do not support Asynchronous file IO, in which case the flag is ignored. ----------------------------------------------------------------------------------------------- Properties LastError This holds the value of the last error, if any, from the File.IO methods ----------------------------------------------------------------------------------------------- Events // This event is called when a File I/O method throws an unexpected error. // functionname This will contain the full name of the method that threw the error // For example, if Open caused the error, this would be // "Any.File.IO.Open" // filepnt If a specific file was responsible for the error, this holds the // pointer to that file. Otherwise, this will be -1 Nothing OnError(StringMem functionname, FilePointer filepnt) ----------------------------------------------------------------------------------------------- Methods // Closes a previously opened file. // The only ways that closing a file may fail are if the file pointer is invalid, or if there // is a write operation pending that fails before closing the file. // If the file is Asynchronous and currently has I/O operations running, these are cancelled // immediately. If you want to be certain that Asynchronous I/O completes before calling Close, // use File.IO.Wait(filepnt) first or set the shouldwait parameter to True. If you use // shouldwait, the file will not close immediately and backend functions for the file may still // be called. As soon as the file is done with its I/O operations, it will close. Any further // I/O will throw an error, ANY_ERROR_FILECLOSED. // Returns: True - Success // False - Error (file still closed unless it was an invalid file pointer) // filepnt A pointer to a previously opened file // shouldwait Do we wait for asynchronous file I/O to complete before closing? // If True, we wait. If False, we abort the file I/O. Boolean Close(FilePointer filepnt, Boolean shouldwait = False) // Closes all currently opened files. // If any of the opened files is Asynchronous and currently has I/O operations running, these // are cancelled immediately. If you want to be certain that Asynchronous I/O completes before // calling close, use File.IO.WaitAll() first or set the shouldwait parameter to True. If you // use shouldwait, the file will not close immediately and backend functions for the files may // still be called. As soon as the files are done with their I/O operations, they will close. // Any further I/O will throw an error, ANY_ERROR_FILECLOSED. // Returns: The number of opened files that were closed // shouldwait Do we wait for asynchronous file I/O to complete before closing? // If True, we wait. If False, we abort the file I/O. ProcInt CloseAll(Boolean shouldwait = False) // Tests if the current file pointer is past the end of the file // Returns: True - Yes, we've reached the end of the file // False - No, we haven't reached the end of the file OR the file pointer ID is invalid // filepnt A pointer to a previously opened file // Aliases: EOF Boolean EndOfFile(FilePointer filepnt) // Flushes the file's buffer. The function does NOT return until after the flush has completed. // This is useful to guarantee that a file is written to at a particular time. // Note that this should never be used in a time-critical application. // Returns: True - Success (or file had no buffer, or was read only) // False - Error // filepnt A file pointer ID Boolean Flush(FilePointer filepnt) // Flushes all file buffers. The function does NOT return until after flushing has completed. // This is useful to guarantee that all files are written to at a particular time. // Note that this should never be used in a time-critical application. // Returns: Nothing Nothing FlushAll() // Gets the size of the current file // Returns: Size of the file in bytes, -1 on error // filepnt A valid file pointer FileSize GetFileSize(FilePointer filepnt) // KERBLUH - Currently incomplete // Returns: // filepnt A valid FILE pointer UProcInt GetPermissions(FilePointer filepnt) // Returns the current position of the file // Returns: Position in the file, -1 on error // filepnt A file pointer ID // Aliases: Tell FileSize GetPosition(FilePointer filepnt) // Attempts to open the specified file. // If the file was a link, the link is followed and opened unless ANY_FILE_IO_OPEN_NOFOLLOW is // used // If the file was a directory, an error is returned. // Returns: -1 - File not found, could not be opened or no flags set // >=0 - File pointer ID // filename The name of the file. This can be local, relative, or global // flags Control flags // BITS // 0 - 0001 - Permit reading ANY_FILE_IO_OPEN_READ // 1 - 0002 - Permit writing ANY_FILE_IO_OPEN_WRITE // 3 -0008 - Expected access method: // 0 - Sequential (mostly from ANY_FILE_IO_OPEN_ACCESSSEQUENTIAL // the beginning to the end) // 8 - Random (lots of different ANY_FILE_IO_OPEN_ACCESSRANDOM // locations in the file) // These are only hints for the // file buffering and/or OS to // use to optimize file I/O and // are never required. // // The following work only if writing is specified: // 4 - 0010 - Create if not already there ANY_FILE_IO_OPEN_CREATE // 5 - 0020 - Overwrite if already there ANY_FILE_IO_OPEN_OVERWRITE // This does not work with the // append option // 6 - 0040 - Open in Append Mode ANY_FILE_IO_OPEN_APPEND // Opens the file at the end. // Though the file may have the // file position moved, any // writes automatically move the // file pointer to the end of // the file before writing. // // Extra settings: // 8,9-0300 - Lock the file according to: // 0000 - No lock ANY_FILE_IO_OPEN_NOLOCK // 0100 - Lock Write Access ANY_FILE_IO_OPEN_LOCKWRITE // 0300 - Lock All Access ANY_FILE_IO_OPEN_LOCKALL // To lock a file's I/O access // after we open it. This allows // two methods of locking: Write // access locking, which // prevents other applications // from writing to the file, but // allows them to read still; // and All access locking, which // prevents any other process // from reading or writing to // the file. // 10- 0400 - Do not follow links ANY_FILE_IO_OPEN_NOFOLLOW // If the file to open is a ANY_FILE_IO_OPEN_NOLINKS // link, the call will fail. (same as NOFOLLOW) // // The following change how access to the file occurs: // 12- 1000 - Endianness of the file: // 0000 - Little Endian ANY_FILE_IO_OPEN_ENDIANLITTLE // 1000 - Big Endian ANY_FILE_IO_OPEN_ENDIANBIG // This causes all number, // array, struct and object // read/write operations to // use the specified endianness // 13- 2000 - Use Asynchronous file I/O ANY_FILE_IO_OPEN_ASYNCHRONOUS // 14- 4000 - Always Flush. This tells the ANY_FILE_IO_OPEN_ALWAYSFLUSH // file I/O routines to always // immediately flush writes to // the file. This greatly slows // down file I/O, but guarantees // writes are done as soon as // possible on a file. // It is preferrable to use // File.IO.Flush when necessary // instead // This is ignored if the file // is asynchronous or read only // // If flags is omitted, create if it doesn't exist and read/write for a // sequential access little endian file (ANY_FILE_IO_OPEN_CREATE | // ANY_FILE_IO_OPEN_READ | ANY_FILE_IO_OPEN_WRITE | // ANY_FILE_IO_OPEN_ACCESSSEQUENTIAL | ANY_FILE_IO_OPEN_ENDIANLITTLE) is used // // Not all file systems support file locking or asynchronous file I/O. // This functionality will be emulated on the systems that do not support // them so that two versions of the code dealing with files do not need // to be written. FilePointer Open(Constant [String Type] filename, UProcInt flags = 0x13) // Reads in an array of values // All numeric data is read in based on the Endianness of the file // Returns: False (0) - An error occurred trying to read from the file // True (non-zero) - The read was successful // filepnt A pointer to a previously opened file // somearray The array to read into // numvalues The number of array values to read Boolean ReadArray(FilePointer filepnt, [Numeric Data Type], [NDT] *somearray, U32Up numvalues) // Reads a line of text from the file // Returns: False (0) - An error occurred trying to read from the file // True (non-zero) - The read was successful // filepnt A pointer to a previously opened file // string The string to read in from the file Boolean ReadLine(FilePointer filepnt, String string) // Reads in the specified object // All numeric data is read in based on the Endianness of the file // The smallest data size of each numeric value is used. For example, a U16Up will only read in // 2 bytes, even on a system where a U16Up would be 64bit // Returns: False (0) - An error occurred trying to read from the file // True (non-zero) - The read was successful // filepnt A pointer to a previously opened file // someobject The object to read in from the file Boolean ReadObject(FilePointer filepnt, [Object Type] someobject) // Reads a single static data type value // All numeric data is read in based on the Endianness of the file // Returns: False (0) - An error occurred trying to read from the file // True (non-zero) - The read was successful // filepnt A pointer to a previously opened file // somevalue The value to read in from the file Boolean ReadValue(FilePointer filepnt, [Numeric Type] &somevalue) // Adjusts the position of the file // Returns: True - The seek operation was successful // False - Error // file A valid FILE pointer // adjust The amount to change the position by // origin Where to adjust from: // 0 - Relative to the beginning ANY_FILE_IO_SEEK_FROMSTART // 1 - Relative to the current position ANY_FILE_IO_SEEK_RELATIVE // 2 - Relative to the end ANY_FILE_IO_SEEK_FROMEND // Use negatives to move back into the // file. Use positives to jump to a // currently non-existent point in the // file. // A value of 0 causes it to point to // the first new byte after the end of // the file. // Aliases: Seek Boolean SetPosition(FilePointer filepnt, FileSize adjust, ProcInt origin = 0) // For Asynchronous file I/O, this causes the program to wait until all I/O operations have // completed before returning. // For non-Asynchronous file I/O, it does nothing. // Note that this should never be used in a time-critical application. // Returns: True - Success (or file had no operations going, or was read only) // False - Error // filepnt A file pointer ID Boolean Wait(FilePointer filepnt) // For Asynchronous file I/O, this causes the program to wait until all I/O operations have // completed on all Asynchronous files before returning. // Note that this should never be used in a time-critical application. // Returns: Nothing Nothing WaitAll() // Outputs a string of text to the file, followed by a new line // Returns: False (0) - An error occurred trying to output to the file // True (non-zero) - The write was successful // filepnt A pointer to a previously opened file // string The string to output to the file Boolean WriteLine(FilePointer filepnt, Constant [String Type] string) *************************************************************************************************** Math ------------------------------------------------------------------------------------------------- Methods // This confusing list is from C/C++: Visual C++ AnyScript (ideas, not set in stone of course) abs Abs acos ArcCos asin ArcSin atan ArcTan atan2 ArcTan2 <-- need more info on what this really is atof Strings.FromString(string, F32);/Strings.FromString(string, F64); ceil Ceiling _chgsign Simply using - on the value works: F32 x; x = -x; _copysign CopySign <-- not certain if we need to support this cos Cos cosh CosH div Not supported _ecvt Not supported (see Strings.FormatNumber) exp Exp fabs Abs _fcvt Not supported (see Strings.FormatNumber) _finite IsFinite floor Floor fmod Simply using % on the value works: F32 x, y, z; z = x % y; frexp GetExpMantissa ??? _gcvt Strings.FormatNumber(value, numdigits); ldexp ShiftExponent ??? log Log log10 Log10 _logb ??? __min Min __max Max modf SplitFloat ??? _nextafter ??? pow Power _scalb ??? (What's the difference between this and ldexp???) sin Sin sinh SinH sqrt SquareRoot strtod Strings.FromString(string, F64); tan Tan tanh TanH *************************************************************************************************** Memory ------------------------------------------------------------------------------------------------- Events // This event is thrown when a request to allocate memory fails. // If this event is not handled, the program will give a message. // Afterwards, since memory failures generally cause a program to stop functioning properly, the // program will abort. It is recommended to use static strings and objects in this event due to // the fact that extra memory may not be available for dynamic data types. Nothing OnMemoryFailure(U32Up bytestoallocate) ------------------------------------------------------------------------------------------------- Methods // Allocates the specified amount of memory // NOTE: If you attempt to allocate an inappropriate number of bytes to an array, an error may // occur! // Returns: A pointer to the newly allocated buffer // bytestoallocate The number of bytes to allocate U8 *Allocate(U32Up bytestoallocate) // Reallocates the buffer's memory allocation. The buffer may be moved to a new location. // If the pointer is NULL, then it allocates the buffer (acts like MemoryAllocate) // UNLIKE C/C++, MemoryReAllocate MODIFIES THE POINTER PASSED TO IT! // NOTE: If you attempt to allocate an inappropriate number of bytes to an array, an error may // occur! // Returns: A pointer to the reallocated buffer U8 *ReAllocate(U8 *&buffer, U32Up bytestoallocate) // Deallocates the buffer's memory allocation. // UNLIKE C/C++, MemoryDeAllocate MODIFIES THE POINTER PASSED TO IT! // Returns: Nothing Nothing DeAllocate(U8 *&buffer) *************************************************************************************************** Strings ------------------------------------------------------------------------------------------------- Methods // Appends the value to the string // Returns: Nothing // somestring String to set // value The value to append to the string // Inline: This method has an inline version where the first parameter is omitted and the string // is passed as a class pointer, which looks like: // MyString.Append(somevalue); // This is also identical: // MyString += somevalue; Nothing Append(String somestring, Constant [Any NonObject] value) // Counts the number of occurrences of searchstring in somestring // Returns: The number of occurrences, 0 for none of course // somestring The string to search in // searchstring The string to search for // startchar Starting character // >0 - Start on this character in the string (1 for the 2nd char, 2 for the // 3rd, etc) // 0 - Start from the beginning // <0 - Start on the abs() of this value from the end of the string // numchar Number of characters to count in: // >0- Read up to this many characters // 0 - Read up to the end of the string // <0- Read the length of the string plus this value // Default value: 0 // flags Flags: // BITS // 0 - 0001 - Do a case-insensitive search STRINGS_COUNTSTRING_NOCASE // 1 - 0002 - Do an overlapping search STRINGS_COUNTSTRING_OVERLAP // Aliases: CountStringI(somestring, searchstring, startchar, numchar) -> CountString(string, // searchstring, startchar, numchar, 0x01); // Inline: Just omit the first parameter U32Up CountString(Constant [String Type] somestring, Constant [String Type] searchstring, S32Up startchar = 0, S32Up numchar = 0, UProcInt flags = 0) // Searches for the first occurrence of searchstring in somestring based on the parameters passed // in // Returns: The position in the somestring where searchstring was found // -1 if searchstring is not found // somestring The string to search in // searchstring The string to search for // startchar Starting character in the string to search in // >0 - Start on this character in the string (1 for the 2nd char, 2 for the // 3rd, etc) // 0 - Start from the beginning // <0 - Start on the abs() of this value from the end of the string // Default value: 0 // flags Flags: // BITS // 0 - 0001 - Do a case-insensitive search STRINGS_FINDSTRING_NOCASE // 1 - 0002 - Do a reverse search STRINGS_FINDSTRING_REVERSE // Default value: 0x0000 // Aliases: FindStringI(somestring, searchstring, startchar) -> FindString(somestring, // searchstring, startchar, 0x01) // FindStringR(somestring, searchstring, startchar) -> FindString(somestring, // searchstring, startchar, 0x02) // FindStringRI(somestring, searchstring, startchar) -> FindString(somestring, // searchstring, startchar, 0x03) // FindStringIR(somestring, searchstring, startchar) -> FindString(somestring, // searchstring, startchar, 0x03) // Inline: Just omit the first parameter S32Up FindString(Constant [String Type] somestring, Constant [String Type] searchstring, S32Up startchar = 0, UProcInt flags = 0) // Converts a number to a string using various settings // Returns: String value of the number // value Numerical value to convert to a string // numdigitspastdecimal The number of digits to show past the decimal, if applicable // Default value: 0 // extraflags Extra flags to control how the number is formatted: // BITS // 0 - 0001 - Use parenthesis instead of a STRINGS_FORMATNUMBER_PAREN // minus sign on negative // eg, -1.23 becomes (1.23) // Default value: 0x0000 String FormatNumber(Constant [Numeric Type] value, UProcInt numdigitspastdecimal = 0, UProcInt extraflags = 0) // Converts the string to the specified data type // If the string is not valid for the data type specified, it will return 0 for integers, 0.0 for // floating point and false for boolean. // Returns: The data type specified // somestring String to convert // Aliases: Get // Inline: This method has an inline version where the first parameter is omitted and the string // is passed as a class pointer, which looks like: // MyString.FromString(U32); // Try to convert the string to a U32 [SDT] FromString(Constant [String Type] somestring, [Static Data Type]) // Replaces occurrences of searchstring with replacestring in somestring in the specified portion of somestring // Returns: The modified string // somestring The string to read from // replacestring The string to replace the specified region with // startchar Starting character // >0 - Start on this character in the string (1 for the 2nd char, 2 for the 3rd, etc) // 0 - Start from the beginning // <0 - Start on the abs() of this value from the end of the string // numchar Number of characters to read: // >0 - Read up to this many from the end of the string // 0 - Read to the end of the string // <0 - Read the length of the string minus the abs() of this value // Aliases: SubStringReplace // Inline: This method has an inline version where the first parameter is omitted and the string // is passed as a class pointer, which looks like: // MyString.MidReplace("/", 4, 1); // Replaces the fifth character with a / String MidReplace(Constant [String Type] somestring, Constant [String Type] replacestring, S32Up startchar, S32Up numchar = 0); // Replaces all occurrences of searchstring with replacestring in string // Returns: The modified string // somestring The string to search in // searchstring The string to search for // replacestring The string to replace the searched string with // startchar Starting character // >0 - Start on this character in the string (1 for the 2nd char, 2 for the 3rd, etc) // 0 - Start from the beginning // <0 - Start on the abs() of this value from the end of the string // numchar Number of characters to read: // >0 - Read up to this many from the end of the string // 0 - Read to the end of the string // <0 - Read the length of the string minus the abs() of this value // maxreplace Maximum number of replacements to do, 0 for infinite // flags Flags: // BITS // 0 - 0001 - Do a case-insensitive search STRINGS_REPLACE_NOCASE // Aliases: ReplaceI(somestring, searchstring, replacestring, startchar, numchar, maxreplace) -> // Replace(somestring, searchstring, replacestring, startchar, numchar, maxreplace, // 0x01) // Inline: This method has an inline version where the first parameter is omitted and the string // is passed as a class pointer, which looks like: // MyString.Replace("/", "\\"); // Replaces all / with \ in MyString String Replace(Constant [String Type] somestring, Constant [String Type] searchstring, Constant [String Type] replacestring, S32Up startchar = 0, S32Up numchar = 0, U32Up maxreplace = 0, UProcInt flags = 0) // Sets the string to a string representation of the value // Returns: The string parameter that was passed in // somestring String to set // value The value to convert to a string and set the string to // Inline: This method has an inline version where the first parameter is omitted and the string // is passed as a class pointer, which looks like: // MyString.Set(somevalue); String Set(String somestring, [Any NonObject] value) // Returns a portion of a string // Returns: The specified portion of the string // somestring String to grab a portion of // startchar Starting character: // 0 - Start from the beginning // >0 - Start on this character in the string // (1 for the 2nd character, 2 for the 3rd character, etc) // <0 - Start on the abs() of this value from the end of the string // (-1 for the last character, -2 for the 2nd to last character, etc.) // numchar Number of characters to grab: // 0 - Read up to the end of the string // >0- Read up to this many characters // <0- Read the length of the string plus this value // Default value: 0 // Aliases: Mid // Left(somestring, numchar) -> SubString(somestring, 0, numchar) // Right(somestring, numchar) -> SubString(somestring, -numchar) // Inline: This method has an inline version where the first parameter is omitted and the string // is passed as a class pointer, which looks like: // MyString.SubString(startchar, numchar); // MyString.Mid(startchar, numchar); // MyString.Left(numchar); // MyString.Right(numchar); String SubString(Constant [String Type] somestring, S32Up startchar, S32Up numchar = 0) // This swaps the pointers of two strings. // This is not normally useful for user operations, but it's incredibly useful when using // temporary strings! We can do our operations on temporary local strings directly then swap the // temp and the real string when we're done without having to do a memory move. // Returns: Nothing // string1 String 1 to swap // string2 String 2 to swap // Inline: This method has an inline version where the first parameter is omitted and the string // is passed as a class pointer, which looks like: // MyString.Swap(AnotherString); Nothing Swap(String string1, String string2) // Lower cases all letters in the string // Returns: An all lower case version of the string // somestring The string to convert // Inline: This method has an inline version where the first parameter is omitted and the string // is passed as a class pointer, which looks like: // MyString.ToLower(); String ToLower(Constant [String Type] somestring) // Creates a string representation of the value // Returns: The string of the value // value The value to convert to a string and set the string to // radix Only applies to numerical data types, this is the radix or numeric base // to use on the number when converting to a string String ToString(Constant [Any NonObject] value, U32Up radix = 10) // Upper cases all letters in the string // Returns: An all upper case version of the string // somestring The string to convert // Inline: This method has an inline version where the first parameter is omitted and the string // is passed as a class pointer, which looks like: // MyString.ToUpper(); String ToUpper(Constant [String Type] somestring) // Removes whitespace at both the beginning and ending of a string // Returns: The modified string // somestring The string to read from // Inline: This method has an inline version where the first parameter is omitted and the string // is passed as a class pointer, which looks like: // MyString.Trim(); String Trim(Constant [String Type] somestring) // Removes whitespace from the beginning of a string // Returns: The modified string // somestring The string to read from // Inline: This method has an inline version where the first parameter is omitted and the string // is passed as a class pointer, which looks like: // MyString.TrimLeft(); String TrimLeft(Constant [String Type] somestring) // Removes whitespace from the end of a string // Returns: The modified string // somestring The string to read from // Inline: This method has an inline version where the first parameter is omitted and the string // is passed as a class pointer, which looks like: // MyString.TrimRight(); String TrimRight(Constant [String Type] somestring) *************************************************************************************************** System Low level system manipulation. These functions are designed to communicate with the operating system when it's absolutely necessary. ------------------------------------------------------------------------------------------------- Properties // Holds the approximate number of milliseconds to wait for other processes during each loop. // This value only applies if the program is purely event based UProcInt BeNiceDelay ------------------------------------------------------------------------------------------------- Methods // This function should be called several times a second when the process is able to share some // time with other processes. The single UProcInt parameter is a number of milliseconds this // process can wait before it wants control again. This is not an exact value in some operating // systems, so you will want to be a little conservative. In general, this is called once per // main loop. If your program is purely event based, then this is done automatically and instead // you should change the delay per loop by using the global variable System.BeNiceDelay. // Returns: Nothing // mswait Number of milliseconds to wait. Use 0 for as little wait as possible Nothing BeNice(UProcInt mswait) // KERBLUH - Will we use this? // Used to run through the update loop of the program, for a non-event driven program. Nothing Update()