User Tools

Site Tools


mpl_functions

This is an old revision of the document!


General Functions and Procedures

Function ABS (Num: LongInt) : LongInt

This function takes a signed integer and returns the absolute value. Example:

Var Int : LongInt = -1234

WriteLn('The absolute value of '+Int2str(Int) +' is '+Abs(Int)+'.')

Function ALLOWARROW (Boolean)

Used to turn on arrow key processing in the READKEY function. It is also used outside of MPL so use with caution.

Example:

AllowArrow := True
ReadKey

Function BITCHECK (B : Byte; I : Integer) : Boolean

This function accepts a bit position and checks it against an integer, returning true or false if the bit is on. So for example in the Records, the third bit in UserFlags is UserDeleted:

GetThisUser
If BitCheck(3, UserFlags) Then 
  WriteLn('User is marked deleted');

Procedure BITSET (B : Byte; I : Integer)

This procedure accepts a bit position and an integer and sets the bit ON/OFF based on a boolean:

GetThisUser
BitSet(3, UserFlags, True);  // user is marked as deleted

Procedure BITTOGGLE (B : Byte; I : Integer)

This procedure accepts a bit position and an integer and toggles the bit.

GetThisUser
BitToggle(3, UserFlags);  // undeletes if they are deleted or deletes if
                          // they are not deleted.

Procedure CLRSCR

This function will clear the screen. Example:

CLRSCR
Writeln ('The screen was just cleared.')

The above function will clear the screen and write the text “The screen was just cleared.” to the screen.

Function DATE2DOS (Str : String) : LongInt

This function takes a MM/DD/YY format date and converts it to DOS packed datetime format.

Var DStr : String = '01/01/14'
Var PDt  : LongInt

PDt := Date2Dos(DStr)

Function DATE2JULIAN (Str : String) : LongInt

This function takes a MM/DD/YY format date and converts it to a Julian date format.

Function DATEG2J (Str : String) : LongInt

This function takes a gregorian date format (MMDDYY) and converts it to a Julian format

Function DATEJ2G (LI : LongInt) : String

This function takes a julian date format and converts it to a gregorian format (MMDDYY).

mpl_functions.1468274273.txt.gz · Last modified: 2016/07/11 16:57 by gryphon

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki