MPL Documentation

System Unit/Core Language

Every programming language has reserved keywords, these make the base grammar/language.

Directive Description
 allocmem  calls getmem, and initialized the memory to all byte zero
 append  open a text file, to append text to the file
 applicationname  contains the full path and filename to the current script
 arrayavg  returns the average of an array of longint
 arrayconcat  merges array1 and array2, either TLongintArray or TStringArray
 arrayindexof  returns the index of parameter1 in parameter2 TLonginArray or TStringArray
 arrayjoin  returns a comma delimited string of TLongintArray or TStringArray
 arraymax  returns the highest value of TLongintArray
 arraymin  returns the lowest value of TLongintArray
 arraypop  removes the last element from the array and returns the element
 arraypush  appends the element to the end of TLongintArray or TStringArray
 arrayshift  removed the first element from the array and returns the element
 arraysum  sums the elements of the array
 assert  provides an opportunity to intercept an unexpected condition and halt
 assigned  checks to see if a reference is not nil
 assignfile  assigns a value to binary file handle for a filename in preparation for reading or writing
 assigntext  assigns a value to text file handle for a filename in preparation for reading or writing
 between  checks if param1 is greater or equal param2 and less than or equal to param3
 blockread  used to read data (bytes or records) from a binary file
 blockwrite  used to write data (bytes or records) to a binary file
 boolasstr  returns your string for true and false for the boolean parameter
 booltostr  returns the string 'True' or 'False' for the boolean parameter
 charcount  returns the count for the number of instances a character is in a string
 chr  typecast an ordinal 8bit byte to its ASCII character counter part
 cleanstr  returns a string filtered from high bit and control characters, with replacement letters
 closefile  closes a binary file, flushing the handle and assigns it to nil
 closetext  closes a text file, flushing the handle and assigns it to nil
 copy  returns 1 or more characters from a string, passing start position and up-to length
 currtostr  returns a string for the currency value parameter, without the currency sign
 datetimetounix  used to convert the borland tdatetime parameter to unix int64 timestamp
 dec  decrements the parameter by one or more if a second parameter is passed for how many
 delete  deletes characters from a string, starting at param2 and up-to length param3
 deletefile  physically delete/unlink the filename parameter from the file system
 endoffile  returns true is the file handle has reached the end of the binary file
 endoftext  returns true is the file handle has reached the end of the text file
 erasefile  physically delete/unlink the filename associated to the binary file handle from the file system
 erasetext  physically delete/unlink the filename associated to the text file handle from the file system
 floattocommastr  returns a string for the float value parameter, with comma denoting the thousands, etc.
 filepos  returns the current byte position of the binary file handle
 filesize  returns the total byte size of the filename associated with the binary file handle
 fillbyte  speed fill param1 with the same byte up-to the length
 fillchar  speed fill param1 with the same character up-to the length
 fillmem  same as fillbyte except parameter 1 is a pointer to any type
 floattostr  returns a string for the float value parameter without comma or prefix
 flushfiles  flushes any buffers from standard file descriptors such as standard input and output
 flushtext  text file handles use memory buffers, this forces the memory to write to disk on a text file
 freemem  unallocate the memory associate with param1, which use getmem to allocate it originally
 getcurrentdir  returns the current folder you application is set to read and write files
 getcurrentpath  returns the current folder you application is set to read and write files (alias to getcurrentdir)
 getmem  if available allocate the requested amount of memory and return a pointer to it
 getprocedureaddress  when working with dynamically linked files, this gets the memory address for a method
 getprocessid  this returns the current process id for your application
 getthreadid  this returns the current thread id for the main thread of your application
 glock  this attempts a global lock (semaphore) used across all threads in coderunner
 gunlock  this releases a previous call to glock in coderunner
 halt  this terminates your application and the host (do not use in coderunner applications)
 hextoint  returns the integer value for the hexadecimal parameter
 hextostr  returns a string for the hexadecimal parameter
 hi  returns the hi nibble (4 bits) of a byte
 high  returns the max or top of a dynamic parameter like arrays
 inc  increment param1 by one or more if param2 is passed
 insert  inserts string Source in string S, at position Index, shifting all characters after Index to the right
 inttobin  returns a binary (string of 0's and 1's) representing the integer parameter
 inttocommastr  returns a string with commas at the thousands (etc), for the integer parameter
 inttohex  returns the hexadecimal string (0 to F) representing the integer parameter
 inttooct  returns the octal string (0 to 7) representing the integer parameter
 inttostr  returns a string representing the integer parameter
 ioresult  return result code of last file IO operation, 0 means success, resets upon call
 lastoserror  return the last Operating System error code, does not reset upon call
 left  returns a string of param1 of up-to param2 length
 length  returns the integer value of the number of bytes/chars/elements of param1
 lengthasstring  expands or shrinks the number of elements/bytes/chars of param1
 lo  returns the lo nibble (4 bits) of the byte parameter
 loadlibrary  loads a dynamically linked file into memory to access its methods at run-time
 low  returns the low end or starting number of a dynamic variable like an array
 lowercase  returns a string with param1 string all lowercase
 max  returns the higher value of the two integer parameters
 mid  returns 1 or more characters from a string, passing start position and up-to length (alias to copy)
 min  returns the lower value of the two integer parameters
 minandmax  returns the lowest value and highest value of a dynamic array
 minnotzero  returns the lowest value greater than zero of the two integer parameters
 move  move data from one location in memory to another, up-to length
 null  null variant
 odd  return true if a value is an odd number
 ord  return ordinal value of an ordinal type
 paramcount  return number of command-line parameters passed to the program
 paramstr  return value of a command-line argument
 parseint  like JavaScript parseint, returning the numeric part of a string from left to right until non-numeric
 pos  search for substring in a string
 posstringarray  like JavaScript IndexOf, returns element number that matches a string in a TStringArray
 pred  return previous element for an ordinal type
 raiseexception  
 readln  read from console into variable until enter is pressed
 readlntext  read from a text file into variable and goto next line
 reallocmem  re-allocate memory on the heap
 renamefile  rename an open file of file type
 renametext  rename an open file of text type
 reset  open file for reading/writing
 rewrite  create file for reading/writing
 right  mimic basic's right$, returning characters from the end of the string
 seekfile  set file position
 seekeof  set file position to end of file
 setcurrentdir  change the current drive and path
 setcurrentpath  change the current path
 setlength  set length of a string or dynamic array
 sizeof  return size of a variable or type
 str  convert a numerical or enumeration value to a string
 stringreplace  
 strtobool  
 strtobooldef  
 strtocommastr  
 strtocurr  
 strtocurrdef  
 strtofloat  
 strtofloatdef  
 strtohex  
 strtoint  
 strtoint64  
 strtoint64def  
 strtointdef  
 strtouint64  
 strtouint64def  
 succ  return next element of ordinal type
 swap  swap high and low bytes/words of a variable
 swapendian  swap endianness of the argument
 timestamp  returns the current date and time as ttimestamp (unix) type
 truncate  truncate the file at position
 uniquestring  make sure reference count of string is 1, uses a copy if necessary
 unixtodatetime  convert a ttimestamp variable type to tdatetime type
 unloadlibrary  
 upcase  convert a single character to uppercase
 uppercase  convert a string to all uppercase
 val  calculate numerical/enumerated value of a string
 write  write variable(s) to the console
 writeln  write variable(s) to the console and append newline
 writetext  write variable to a text file
 writelntext  write variable to a text file and append newline
 yield  waits a specified number of milliseconds, relaxing to other threads and processes.