Skip to content

rimisclib

This library collects commands of several kinds that have no library of their own:

  • system requesters: EZRequest, EZRequestArgs, with EZOutput and EZSeparator;
  • splitting a string into words or fields: InitArgParse, NextArg$, NextArgChar$;
  • the program’s own path: ProgPath$, ProgDir$, ProgName$, and FromBlitz, which tells whether it runs from Blitz Basic 2;
  • the default fonts of the font preferences: OpenFontPrefs, DefaultFontHeight, DefaultFontName, CloseFontPrefs;
  • strings and keys: Flip$, BInstr, LtoS, ASCRaw, RawASC;
  • the hardware and the system: TimerReset, ClickWait, PortSigBit, WorkbenchHere.

The library opens dos.library and intuition.library when the program starts. EZRequest, EZRequestArgs, EZSeparator, the program path, OpenFontPrefs, CloseFontPrefs and WorkbenchHere work only in Amiga mode; the other commands also work in Blitz mode.

Splitting a line into its words; a word in quotes may contain spaces:

a$="OPEN FILE "+Chr$(34)+"Work:My File"+Chr$(34)+" SHARED"
InitArgParse &a$
Repeat
  b$=NextArg$
  If b$<>"" Then NPrint b$
Until b$=""

The fixed bugs of the library are listed in Fixes in rimisclib.

Based on the RI Misc Lib guide by Reflective Images.

Library number 47.

Commands

ASCRaw

The character of the key with the raw key code rawkey, as a one-character string.

Function, result $. Help text: (rawkey)
Arguments: .w

A code above 113, such as the code of a key being released, a negative code and a key without a character give the character 0.

BInstr

The position, counted from 1, of the last place where Findstring$ occurs in String$, or 0 if it does not occur or is empty.

Function, result .l. Help text: (String$,Findstring$)
Arguments: $, $

ClickWait

Waits until the left mouse button is pressed and released again. It reads the hardware directly, so it also works in Blitz mode.

Statement. No help text.
No arguments.

CloseFontPrefs

Frees the memory of the font preferences that OpenFontPrefs read. The program does this by itself when it ends. Amiga mode only.

Statement. No help text.
No arguments.

DefaultFontHeight

The height of a default font of the font preferences read with OpenFontPrefs - fonttype 0 for the icon font, 1 for the system font, 2 for the screen font - or 0 if it is not set.

Function, result .w. Help text: fonttype (0=Icon,1=System,2=Screen)
Arguments: .w

DefaultFontName

The name of a default font of the font preferences read with OpenFontPrefs, with fonttype as for DefaultFontHeight, or "" if it is not set.

Function, result $. Help text: fonttype (0=Icon,1=System,2=Screen)
Arguments: .w

EZOutput

Makes the requesters of EZRequest and EZRequestArgs open on the screen of window win#; without a parameter they open on the default public screen again.

Statement. Help text: [win#]
2 forms:

  • .l
  • no arguments

EZRequest

Shows a system requester with the title title$, the text body$ and the gadgets gadget$, and returns the gadget chosen - 1 for the first, 2 for the second and so on, 0 for the last. Amiga mode only.

Statement or function, result .l. Help text: [title$,]body$[,gadget$] | title$,body$,gadget$[,var..]
4 forms:

  • $, $, $
  • $, $
  • $
  • $, $, $, { any }...

A | in body$ starts a new line, a | in gadget$ separates two gadgets. Without title$ the requester has the default title, without gadget$ a single gadget “Ok”. The requester opens on the screen of the window chosen with EZOutput, otherwise on the default public screen.

In the form with further arguments, body$ and gadget$ can hold placeholders that the arguments fill in, in order: %s for a string, %ld for a long, quick or float, and %d for a word or byte. Quick and float values are passed as their whole part, -3.5 as -3. The arguments may take at most 16 longs: a string, long, quick or float counts one, a word or byte half of one. With runtime error checking, more are the error “Too Many EZRequest Arguments”; without it they overwrite memory.

h.l=12 : m.l=23
NPrint EZRequest("Request","It is %s|The time is %ld:%ld","So|What","Sunday",h,m)

On Kickstart 1.x the requester is the older system requester: it shows no title and has one or two gadgets, with the same results. With more than two gadgets no requester appears and the result is 0; with runtime error checking that is the error “More than two EZRequest gadgets need Kickstart 2.0”.

EZRequestArgs

Shows a system requester whose text is the values of the arguments, each on a line of its own, with the gadget “Ok”; handy for looking at variables while debugging. Amiga mode only.

Statement or function, result .l. Help text: args..
Arguments: { any }...

EZSeparator sets another separator between the values. Quick and float values show their whole part, -3.5 as -3. The arguments may take at most 16 longs, as in EZRequest.

EZSeparator

Sets the character that EZRequestArgs puts between the values, the first character of char; the default | starts a new line. Amiga mode only.

Statement. Help text: char
Arguments: $

Flip$

The string String$ reversed; a string of 0 or 1 characters is returned unchanged.

Function, result $. Help text: (String$)
Arguments: $

FromBlitz

-1 if the program was started from Blitz Basic 2, 0 if it runs as a program of its own.

Function, result .l. No help text.
No arguments.

InitArgParse

Starts splitting a text into words with NextArg$ or into fields with NextArgChar$. The parameter is the address of the text, which ends in a zero byte, for example &a$.

Statement. Help text: parameter$
Arguments: .l

The text is copied, so the string may change afterwards. Only its first 255 characters are copied; the rest is cut off.

LtoS

The four bytes of longword as a four-character string, the highest byte first, like Mkl$.

Function, result $. Help text: (longword) -- convert LONG to STRING
Arguments: .l

Every byte below 32 or from 128 on becomes character 128, as the library’s guide says.

NextArg$

The next word of the text given to InitArgParse, or "" at the end. Words are separated by spaces; a word in double quotes may contain spaces, and two double quotes within it stand for one.

Function, result $. Help text: - get next parameter
No arguments.

"a""b" c gives the words a"b and c.

NextArgChar$

The text given to InitArgParse from the current position up to the next character with the code char, for example Asc(","), or up to the end; the position goes on behind that character.

Function, result $. Help text: char - get next parameter up until char
Arguments: .w

Before InitArgParse, and after the end of the text, it returns “”.

OpenFontPrefs

Reads the font preferences of the system, the file ENV:SYS/Font.Prefs, for DefaultFontHeight and DefaultFontName. As a function it returns -1, or 0 if the file is missing or holds no font preferences. Amiga mode only.

Statement or function, result .w. Help text: [filename$]
No arguments.

It also returns 0 if there is not enough memory for the file. A second call frees the preferences of the first.

PortSigBit

The signal bit, 0 to 31, of the message port at address msgport.

Function, result .b. Help text: msgport
Arguments: .l

ProgDir$

The directory of the running program, as in ProgPath$. Amiga mode only.

Function, result $. No help text.
No arguments.

ProgName$

The name of the running program, as in ProgPath$. Amiga mode only.

Function, result $. No help text.
No arguments.

ProgPath$

The full path of the running program, its directory and its name. Amiga mode only.

Function, result $. No help text.
No arguments.

When the program has no directory of its own, as when it is resident, the current directory is used, and when it has no name, the name of its task.

On Kickstart 1.x the directory is always the current directory, and the name is taken from the command the Shell started the program with, or is the name of its task without a Shell. A program started from another directory, with a path in front of its name, thus gets the current directory, not its own.

RawASC

The raw key code of the key that types the first character of char.

Function, result .w. Help text: (char)
Arguments: $

Characters typed with Shift, such as upper case letters, ! or <, have no code of their own: a character that no key types, and “”, give -1.

TimerReset

Sets the time-of-day counter of the first CIA chip to 0, the counter that counts the frames of the display.

Statement. No help text.
No arguments.

WorkbenchHere

Returns -1 if the Workbench screen is open, and 0 if not, by looking for a screen whose title contains “Workbench”. Amiga mode only.

Function, result .l. No help text.
No arguments.