names.AmigaBasic: Extract or replace variable and label names from Amiga Basic...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/basic.r

Description

In the binary Amiga Basic files, names for labels and variables in the code are stored at the end of the file. In the encoded there is only a pointer to the index of the name in that list. Use this function to list, select or replace names included in the code

Usage

1
2
3
4
5
## S3 method for class 'AmigaBasic'
names(x)

## S3 replacement method for class 'AmigaBasic'
names(x) <- value

Arguments

x

An AmigaBasic-class object for which to obtain or change variable and/or label names

value

A (vector of) character string of desired replacement variable/label names.

Details

Make sure that variable and label names are valid for the basic script (see check.names.AmigaBasic).

Value

A vector of character strings with label and variable names in the basic script. In case of the replacement method a AmigaBasic-class with replaced names is returned.

Author(s)

Pepijn de Vries

See Also

Other AmigaBasic.operations: AmigaBasic.reserved(), AmigaBasicBMAP, AmigaBasic, [.AmigaBasic(), as.AmigaBasicBMAP(), as.AmigaBasic(), as.character(), check.names.AmigaBasic(), rawToAmigaBasicBMAP(), rawToAmigaBasic(), read.AmigaBasicBMAP(), read.AmigaBasic(), write.AmigaBasic()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Let's create some Basic code with labels and variables:
bas <- as.AmigaBasic(c(
  "REM - This will loop forever...",
  "my.label:",
  "  my.variable% = 0",
  "  WHILE my.variable% < 10",
  "    my.variable% = my.variable% + 1",
  "  WEND",
  "  GOTO my.label"
))

## list the names in the script above:
names(bas)

## change the first name:
names(bas)[1] <- "better.label"

AmigaFFH documentation built on Sept. 5, 2021, 5:22 p.m.