casrc configuration file¶
The casrc file is the “run commands” file for CaS (see
CaS command-line reference). It defines two elements:
Settings, as sets of key/value pairs named “properties”.
Macros, as sequences of “property diffs” composed of the following:
The name of the property to update.
Whether to set or unset the property.
If the property is to set, the value to set to the property.
For example, a macro can be defined with first=value,second,no-third,
where the produced property diffs will be the following:
The
firstproperty should be set tovalue.The
secondproperty should be set to the empty string.The
thirdproperty should be unset.
Well-known locations¶
The casrc file is present in the following locations:
On DOS, it is located in the same directory as the CaS executable.
On POSIX-compatible systems, it is either located in
~/.casrc, or if not found, in the system directory, for example/etc/system.casrc.
File format¶
The casrc file defines macros and settings only using property diffs. It is line-oriented, using LF (U+000A) as line separators.
Line format¶
The format of a line is the following:
; A comment cannot be placed at the end of a macro or setting definition.
line = *space [macro-definition / setting-definition / comment] LF
; A comment starts with "#" or ";".
comment = %x23 / %x3B *(%x01-09 / %x0B-7E) ; Any non-LF character.
; Macro and setting values have the same format, and take all of the line
; until the LF.
macro-definition = "macro" 1*space name (1*space / *space "=" / *space ":") value
setting-definition = name (1*space / *space "=" / *space ":") value
; Macro and setting name cannot contain space.
; Macro names can technically contain commas, but adding such characters
; will make them unusable, since a component value cannot contain
; a comma.
name = 1*(%x01-08 / %x0E-1F / %x21-7E)
; Values are comma-separated components, which in turn are
; either macro names or property diffs.
value = *(*WSP [component *WSP] ",") *WSP [component *WSP]
; For line parsing or format verifying purposes, a component can be
; any sequence that doesn't include a comma and its surrounding
; spaces or horizontal tabulations.
; A component is allowed to be empty, which makes it define the empty
; property to an empty value.
component = *(%x01-09 / %x0B-2C / %x2E-7E) (%x01-08 / %x0B-1F / %x21-2C / %x2E-7E)
; Space is defined as a character for which isspace() is true for the
; C locale, i.e. space, form-feed ('\f'), newline ('\n'), carriage
; return ('\r'), horizontal tab ('\t') and vertical tab ('\v').
space = %x09-0D / %x20
Macro and setting names are case insensitive, and components reference previously set macros.
Component format¶
In casrc files, a component is one of:
A macro expansion, if the full component is the name of a macro.
Otherwise, a property diff.
A property diff has the following format:
; Note that whitespace at the beginning and end of the component have
; already been trimmed from line parsing.
property-diff = name [*WSP ("=" / ":") * WSP value]
; Exclude U+000A (LF), U+003A (":"), U+003D ("="), and forbid
; U+0009 (\t) and U+0020 (SP) to be the last character.
; Empty name is valid.
name = [*(%x01-09 / %x0B-3C / %x3E-7E) (%x01-08 / %x0B-1F / %x21-3C / %x3E-7E)]
; The value however can contain any character except U+000A (LF), and is
; also allowed to be empty.
value = *(%x01-09 / %x0B-7E)
If the name of the property in the diff starts with no-, then the prefix
is removed and the property diff instructs to “unset” the property.
Otherwise, the property diff instructs to “set” the property to the value.
If no value is present, it is considered to be the empty string.
Example property diffs are the following:
msg = hello worldSet the
msgproperty tohello world.empty,empty=Set the
emptyproperty to the empty string.no-superheroes,no-superheroes= ignoredUnset the
superheroesproperty.
File examples¶
An example casrc file is the following:
macro my-macro msg=hello world,wow
macro my-second-macro oh-yeah, my-macro
; this is a full line comment
my-key the-value
my-second-key my-macro
my-third.key some=things,my-second-macro
my-third.key no-some
The casrc file above defines the following settings:
my-key:the-value=;my-second-key:msg=hello world,wow=.my-third.key:oh-yeah=,msg=hello world,wow=(sincesome=thingsis cancelled out byno-someat the end).
Available settings and properties¶
This section inventories known keys.
model – Calculator model¶
Properties are tested on their presence rather than on their value, in the following order:
fx7700,cfx7700,7700,fx7,cfx7,7CASIO fx-7700G (1991 - 1993).
fx9700,cfx9700,9700,fx9,cfx9,9CASIO FX-9700GH (1995 - 1997).
fx9750,cfx9750,9750CASIO FX-9750G (1997 - 1999).
fx9800,cfx9800,9800,fx8,cfx8,8CASIO CFX-9800G (1995 - 1996).
fx9850,cfx9850,9850,fx5,cfx5,5CASIO CFX-9850G (1996 - 1998).
fx9950,cfx9950,9950CASIO CFX-9950G (1996 - 1998).
any,*Generic model.
in, out – Input or output configuration¶
ctfIf set, the input or output will be a local file with Calculator Text Format (CTF).
dosIf set, the input or output will be DOS text (only recommended with
-l).casIf set, the input or output will be a CASIOLINK program (
.cas).fxpIf set, the input or output will be an FXP program (
.fxp).bmpIf set, the input or output will be an a Bitmap (.bmp) image.
gifIf set, the input or output will be a GIF image.
comIf set, the input or output will be a serial port.
tokfileToken file path, relative to the casrc.
in.ctf, out.ctf – CTF-specific input or output configuration¶
These settings are merged with the in or out configuration if the
selected input or output format is Calculator Text Format (CTF).
glossaryIf set, write the glossary to the output file.
niceUse the “nice” token (
TOKEN_OUT | TOKEN_NICE) instead of the “str” token (TOKEN_OUT | TOKEN_STR).Todo
Add detail regarding this!
in.cas, out.cas – CASIOLINK-specific input or output configuration¶
These settings are merged with the in or out configuration if the
selected input or output format is CASIOLINK (CAS).
7700,9700,9800If any is set, read or write with compatibility with CASIOLINK files produced for the CASIO fx-7700G.
9750,9850,9950If any is set, read or write with compatibility with CASIOLINK files produced for the CASIO fx-9750G.
raw,uncookedIf any is set, read or write with compatibility with raw CASIOLINK files.
statusIf set, emit a message when a block is read or written.
orderOrder in which to write a fx-9700G
DCframe.Todo
Add details regarding this!
in.fxp, out.fxp – FXP-specific input or output configuration¶
These settings are merged with the in or out configuration if the
selected input or output format is FXP.
No specific properties are available for this format.
in.bmp, out.bmp – Bitmap-specific input or output configuration¶
These settings are merged with the in or out configuration if the
selected input or output format is Bitmap.
inv,inverseIf set, whether to read or write BMP in inverse.
in.gif, out.gif – GIF-specific input or output configuration¶
These settings are merged with the in or out configuration if the
selected input or output format is GIF.
inv,inverseIf set, whether to write the GIF in inverse.
in.com, out.com – Serial-specific input or output configuration¶
These settings are merged with the in or out configuration if the
selected input or output format is a serial port.
7700,9700,9800If set, use the fx-7700G header and payload format.
9750,9850,9950If set, use the fx-9750G header and payload format.
afxIf set, use the AlgebraFX / Graph 100 header and payload format.
Warning
This is an extended option, that does not exist in the original CaS source.
cp,cp300,cp330,cp330+If set, use the Classpad 300 / 330 (+) protocol.
Warning
This is an extended option, that does not exist in the original CaS source.
9860If set, use Protocol 7.00.
Warning
This is an extended option, that does not exist in the original CaS source.
rawIf set, use the raw header and payload format.
parityParity to set to the serial connection:
evenore: even parity.oddoro: odd parity.noneorn: no parity.
If none of the above are matched, the parity is set to even.
baudBaud rate to set to the serial connection, from 1200 to 115200 bauds.
Warning
Baud rates from 19200 and above are not available in the original CaS source.
By default, the baud rate depends on the selected model.
stopStop bits, which can be set to either
1or2.Warning
This is an extended option, that does not exist in the original CaS source.
dtrIf set, enable the DTR line on the serial connection. By default, the DTR line is disabled.
rtsIf set, enable the RTS line on the serial connection. By default, the RTS line is disabled.
If this is set to the special value
handshake, e.g. usingrts=handshake, rather than enabling the RTS line, CaS will enable RTS/CTS handshaking.Warning
handshakeis an extended option, that does not exist in the original CaS source.pauseIf set, require an interactive confirmation before initializing the communication with the calculator.
inlineIf set, initialize the communication with 0x15 (“inline”) or 0x16 (“ready”).
Todo
Link to the right section for this!
overwriteIf set, in case of conflict, automatically overwrite.
in.bin, out.bin – Binary-specific input or output configuration¶
These settings are merged with the in or out configuration if the
selected input or output format is raw binary.
No specific properties are available for this format.
list – List configuration¶
These settings are used for listing an obtained dump, or listing any entry within this dump.
dumpUse the dump format for listing contents.
list.<type> – Type-specific list configuration¶
The settings from both list and the list.<type>, where <type>
is the type of the entry that is being listed, are merged before listing
an entry.
spc,spaceUse the space format for numbers, i.e. add a space before.
numNumber format in the output.
Available values are the following:
oct,octalUse the octal format for numbers, and add a space before.
dec,decimalUse the decimal format for numbers, and add a space before.
hex,hexadecimalUse the hexadecimal format for numbers, and add a space before.
oct,octalIf set, equivalent to setting
num=oct.dec,decimalIf set, equivalent to setting
num=dec.hex,hexadecimalIf set, equivalent to setting
num=hex.niceWhether to use nice display.
Todo
Write an example here!
pw,passwordWhether to display the password for the program, or not.
shownextIf set, this shows the next segment of data.
Todo
What does that mean?