Standard Subroutines and Classes

Standard Subroutines and Classes


Top  Previous  Next


QMBasic includes a set of standard subroutines and object oriented programming class modules that may be called from user programs. These all have an exclamation mark prefix to the subroutine or class name.


!ABSPATH()Form an absolute pathname from a directory and file path
!ACCOUNT.RULESDetermine list of accounts that a user may or may not enter
!ATVAR()Return value of an @-variable
!CALLHTTPClass module to send HTTP request
!CED()Subroutine interface to the data collection editor
!CHMOD()Set file permissions
!CLOG()Command logger class module
!DUMP()Show string in hexadecimal and character format.
!ERRLOG.FILTER()User supplied error log message filter. See error logging.
!ERRTEXT()Return text description of an error number
!EXC.STACK()Display the call stack at an exception.
!FINDPROG()Return information about catalogued program
!GETPU()Get print unit characteristics
!LISTU()Get raw data similar to LISTU command
!OSCOPY()Copy an operating system file or directory
!PACKAGE()Add, update or remove a registered package licence
!PATHTKN()Process special tokens in a VOC or ACCOUNTS file pathname
!PARSER()Command line parser
!PCL()PCL control code functions
!PHLOG()Return the log record name for a running phantom process
!PICK()Display a pick list of options
!PICKLIST()Display a pick list of options
!QMCLIENT()QMClient interface from QMBasic (class module)
!SCREEN()Screen driver
!SETPU()Set print unit characteristics
!SETVAR()Set the value of an @-variable
!SORT()Sort a delimited list
!USERNAME()Return user name for a given user number
!USERNO()Return a list of user numbers for a given user name
!VIEW()Display a field mark delimited dynamic array in scrollable form
!VOCREC()Read a VOC record, following remote pointers



UniVerse / Prime Information Compatibility Subroutines


Both UniVerse and Prime Information include subroutines that aid portability but in most cases are better written using other features of Basic. QM provides a tool that will add many of these compatibility subroutines to the global catalogue. To use this tool, type


at the QM command prompt. This will catalogue the subroutines with an exclamation mark prefix character. A hyphen prefix may be used instead by typing


The subroutines can be removed from the catalogue using the same commands but with the DELETING keyword added.



The subroutines installed by this tool and their QMBasic equivalents are

CALL !ADDS(result, a, b)

result = ADDS(a, b)

CALL !ANDS(result, a, b)

result = ANDS(a, b)



CALL !CATS(result, a, b)

result = CATS(a, b)

CALL !CHARS(result, a)

result = CHARS(a)

CALL !COUNTS(result, a, b)

result = COUNTS(a, b)

CALL !DIVS(result, a, b)

result = DIVS(a, b)

CALL !EQS(result, a, b)

result = EQS(a, b)


b = CATALOGUED(a) # 0

CALL !FIELDS(result, a, b, c, d)

result = FIELDS(a, b, c, d)

CALL !FMTS(result, a, b)

result = FMTS(a, b)

CALL !FOLDS(result, a, b)

result = FOLDS(a, b)

CALL !GES(result, a, b)

result = GES(a, b)

CALL !GET.USERS(a, b, c, d, e)

No simple equivalent

CALL !GTS(result, a, b)

result = GTS(a, b)


Use of HUSH statement

CALL !ICONVS(result, a, b)

result = ICONVS(a, b)

CALL !IDENT(result)

result = @who : @fm : @logname : @fm : @userno

CALL !IFS(result, a, b, c)

result = IFS(a, b)

CALL !INDEXS(result, a, b, c)

result = INDEXS(a, b, c)

CALL !LENS(result, a)

result = LENS(a)

CALL !LES(result, a, b)

result = LES(a, b)

CALL !LTS(result, a, b)

result = LTS(a, b)

CALL !MULS(result, a, b)

result = MULS(a, b)

CALL !NEGS(result, a)

result = NEGS(a)

CALL !NES(result, a, b)

result = NES(a, b)

CALL !NOTS(result, a)

result = NOTS(a)

CALL !NUMS(result, a)

result = NUMS(a)

CALL !OCONVS(result, a, b)

result = OCONVS(a, b)

CALL !ORS(result, a, b)

result = ORS(a, b)



CALL !SEQS(result, a)

result = SEQS(a)



CALL !SPACES(result, a)

result = SPACES(a)

CALL !SPLICE(result, a, b, c)

result = SPLICE(a, b, c)

CALL !STRS(result, a, b)

result = STRS(a, b)

CALL !SUBS(result, a, b)

result = SUBS(a, b)

CALL !SUBSTRINGS(result, a, b, c)

result = SUBSTRINGS(a, b, c)

CALL !SUMMATION(result, a)

result = SUMMATION(a)

CALL !TRIMSBS(result, a)

result = TRIMBS(a)

CALL !TRIMFS(result, a)

result = TRIMFS(a)

CALL !TRIMS(result, a)

result = TRIMS(a)


a = if @tty='phantom' then 65 else 1; b = system(1050)