MysoreScript
Classes | Enumerations | Functions | Variables
anonymous_namespace{runtime.cc} Namespace Reference

Classes

struct  File
 The structure representing MysoreScript File objects. More...
 

Enumerations

enum  StaticSelectors {
  length = 1, charAt, dump, print,
  invoke, atPut, at, add,
  sub, mul, div, compare,
  open, close, readline, write,
  LAST_STATIC_SELECTOR
}
 Selectors for methods that are defined as part of the runtime. More...
 

Functions

Obj invalidMethod (Obj obj, Selector sel)
 Invalid method function. More...
 
FileFileOpen (File *f, Selector sel, String *file)
 The open method on File objects. More...
 
Obj FileClose (File *f, Selector sel)
 The close method on File objects. More...
 
StringFileReadLine (File *f, Selector sel)
 The readline method on File objects. More...
 
Obj FileWrite (File *f, Selector sel, String *data)
 The write method on File objects. More...
 
Obj StringLength (String *str, Selector sel)
 The .length() method for String objects. More...
 
Obj StringCharAt (String *str, Selector sel, Obj idx)
 The .charAt(idx) method for String objects. More...
 
Obj ArrayLength (Array *arr, Selector sel)
 The .length() method for Array objects. More...
 
Obj ArrayAt (Array *arr, Selector sel, Obj idx)
 The .at(idx) method for Array objects. More...
 
Obj ArrayAtPut (Array *arr, Selector sel, Obj idx, Obj obj)
 The .atPut(idx, obj) method for Array objects. More...
 
Obj NumberDump (Obj str, Selector sel)
 The .dump() method for Number objects. More...
 
Obj NumberPrint (Obj str, Selector sel)
 The .print() method for Number objects. More...
 
Obj StringDump (String *str, Selector sel)
 The .dump() method for String objects. More...
 
Obj StringPrint (String *str, Selector sel)
 The .dump() method for String objects. More...
 
Obj StringAdd (String *str, Selector sel, String *other)
 The + method on a string, allocates a new string with the specified length. More...
 
Obj StringCmp (String *str, Selector sel, String *other)
 Compare two strings, returning an integer representing the ordering. More...
 

Variables

std::vector< std::string > selNames
 Global vector of selector names. More...
 
const char * StaticSelectorNames []
 The names of the selectors in the StaticSelectors enumeration. More...
 
struct Method FileMethods []
 Methods for the file class. More...
 
struct Method StringMethods []
 Method table for the String class. More...
 
struct Method NumberMethods []
 Method table for the Number class. More...
 
struct Method ArrayMethods []
 Method table for the Array class. More...
 
const char * StringIvars [] = { "length" }
 The names of the instance variables in the String class. More...
 
const char * ArrayIvars [] = { "length", "bufferSize", "buffer" }
 The names of the instance variables in the Array class. More...
 
const char * FileIvars [] = { "fd" }
 The names of the instance variables in the File class. More...
 

Enumeration Type Documentation

§ StaticSelectors

enum anonymous_namespace{runtime.cc}::StaticSelectors

Selectors for methods that are defined as part of the runtime.

Enumerator
length 
charAt 
dump 
print 
invoke 
atPut 
at 
add 
sub 
mul 
div 
compare 
open 
close 
readline 
write 
LAST_STATIC_SELECTOR 

Definition at line 312 of file runtime.cc.

Function Documentation

§ ArrayAt()

Obj anonymous_namespace{runtime.cc}::ArrayAt ( Array arr,
Selector  sel,
Obj  idx 
)

The .at(idx) method for Array objects.

Definition at line 174 of file runtime.cc.

Here is the call graph for this function:

§ ArrayAtPut()

Obj anonymous_namespace{runtime.cc}::ArrayAtPut ( Array arr,
Selector  sel,
Obj  idx,
Obj  obj 
)

The .atPut(idx, obj) method for Array objects.

Definition at line 192 of file runtime.cc.

Here is the call graph for this function:

§ ArrayLength()

Obj anonymous_namespace{runtime.cc}::ArrayLength ( Array arr,
Selector  sel 
)

The .length() method for Array objects.

Definition at line 163 of file runtime.cc.

Here is the call graph for this function:

§ FileClose()

Obj anonymous_namespace{runtime.cc}::FileClose ( File f,
Selector  sel 
)

The close method on File objects.

Note that files are not automatically closed: we could use the finaliser support in the Boehm GC to do this.

Definition at line 74 of file runtime.cc.

§ FileOpen()

File* anonymous_namespace{runtime.cc}::FileOpen ( File f,
Selector  sel,
String file 
)

The open method on File objects.

Files can only be opened in one mode by MysoreScript (read/write, create if doesn't exist).

Definition at line 55 of file runtime.cc.

Here is the call graph for this function:

§ FileReadLine()

String* anonymous_namespace{runtime.cc}::FileReadLine ( File f,
Selector  sel 
)

The readline method on File objects.

Constructs a String containing the line.

Definition at line 88 of file runtime.cc.

Here is the call graph for this function:

§ FileWrite()

Obj anonymous_namespace{runtime.cc}::FileWrite ( File f,
Selector  sel,
String data 
)

The write method on File objects.

Definition at line 117 of file runtime.cc.

Here is the call graph for this function:

§ invalidMethod()

Obj anonymous_namespace{runtime.cc}::invalidMethod ( Obj  obj,
Selector  sel 
)

Invalid method function.

Returned when method lookup fails. This logs a message indicating the error.

Definition at line 25 of file runtime.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

§ NumberDump()

Obj anonymous_namespace{runtime.cc}::NumberDump ( Obj  str,
Selector  sel 
)

The .dump() method for Number objects.

Definition at line 229 of file runtime.cc.

Here is the call graph for this function:

§ NumberPrint()

Obj anonymous_namespace{runtime.cc}::NumberPrint ( Obj  str,
Selector  sel 
)

The .print() method for Number objects.

Definition at line 237 of file runtime.cc.

Here is the call graph for this function:

§ StringAdd()

Obj anonymous_namespace{runtime.cc}::StringAdd ( String str,
Selector  sel,
String other 
)

The + method on a string, allocates a new string with the specified length.

Definition at line 262 of file runtime.cc.

Here is the call graph for this function:

§ StringCharAt()

Obj anonymous_namespace{runtime.cc}::StringCharAt ( String str,
Selector  sel,
Obj  idx 
)

The .charAt(idx) method for String objects.

Definition at line 141 of file runtime.cc.

Here is the call graph for this function:

§ StringCmp()

Obj anonymous_namespace{runtime.cc}::StringCmp ( String str,
Selector  sel,
String other 
)

Compare two strings, returning an integer representing the ordering.

Definition at line 284 of file runtime.cc.

Here is the call graph for this function:

§ StringDump()

Obj anonymous_namespace{runtime.cc}::StringDump ( String str,
Selector  sel 
)

The .dump() method for String objects.

Definition at line 246 of file runtime.cc.

Here is the call graph for this function:

§ StringLength()

Obj anonymous_namespace{runtime.cc}::StringLength ( String str,
Selector  sel 
)

The .length() method for String objects.

Definition at line 133 of file runtime.cc.

§ StringPrint()

Obj anonymous_namespace{runtime.cc}::StringPrint ( String str,
Selector  sel 
)

The .dump() method for String objects.

Definition at line 254 of file runtime.cc.

Here is the call graph for this function:

Variable Documentation

§ ArrayIvars

const char* anonymous_namespace{runtime.cc}::ArrayIvars[] = { "length", "bufferSize", "buffer" }

The names of the instance variables in the Array class.

Definition at line 479 of file runtime.cc.

§ ArrayMethods

struct Method anonymous_namespace{runtime.cc}::ArrayMethods[]
Initial value:
=
{
{
0,
reinterpret_cast<CompiledMethod>(ArrayLength),
nullptr
},
{
at,
1,
reinterpret_cast<CompiledMethod>(ArrayAt),
nullptr
},
{
2,
reinterpret_cast<CompiledMethod>(ArrayAtPut),
nullptr
}
}
Object *(* CompiledMethod)(Object *, Selector,...)
A compiled method is a function that takes an object (the receiver) and the selector as implicit argu...
Definition: runtime.hh:75
Obj ArrayLength(Array *arr, Selector sel)
The .length() method for Array objects.
Definition: runtime.cc:163
Obj ArrayAtPut(Array *arr, Selector sel, Obj idx, Obj obj)
The .atPut(idx, obj) method for Array objects.
Definition: runtime.cc:192
Obj ArrayAt(Array *arr, Selector sel, Obj idx)
The .at(idx) method for Array objects.
Definition: runtime.cc:174

Method table for the Array class.

Definition at line 451 of file runtime.cc.

§ FileIvars

const char* anonymous_namespace{runtime.cc}::FileIvars[] = { "fd" }

The names of the instance variables in the File class.

Definition at line 483 of file runtime.cc.

§ FileMethods

struct Method anonymous_namespace{runtime.cc}::FileMethods[]
Initial value:
=
{
{
0,
reinterpret_cast<CompiledMethod>(FileOpen),
nullptr
},
{
0,
reinterpret_cast<CompiledMethod>(FileClose),
nullptr
},
{
0,
reinterpret_cast<CompiledMethod>(FileReadLine),
nullptr
},
{
0,
reinterpret_cast<CompiledMethod>(FileWrite),
nullptr
}
}
Object *(* CompiledMethod)(Object *, Selector,...)
A compiled method is a function that takes an object (the receiver) and the selector as implicit argu...
Definition: runtime.hh:75
Obj FileClose(File *f, Selector sel)
The close method on File objects.
Definition: runtime.cc:74
String * FileReadLine(File *f, Selector sel)
The readline method on File objects.
Definition: runtime.cc:88
Obj FileWrite(File *f, Selector sel, String *data)
The write method on File objects.
Definition: runtime.cc:117
File * FileOpen(File *f, Selector sel, String *file)
The open method on File objects.
Definition: runtime.cc:55

Methods for the file class.

Definition at line 361 of file runtime.cc.

§ NumberMethods

struct Method anonymous_namespace{runtime.cc}::NumberMethods[]
Initial value:
=
{
{
0,
reinterpret_cast<CompiledMethod>(NumberDump),
nullptr
},
{
0,
reinterpret_cast<CompiledMethod>(NumberPrint),
nullptr
}
}
Object *(* CompiledMethod)(Object *, Selector,...)
A compiled method is a function that takes an object (the receiver) and the selector as implicit argu...
Definition: runtime.hh:75
Obj NumberDump(Obj str, Selector sel)
The .dump() method for Number objects.
Definition: runtime.cc:229
Obj NumberPrint(Obj str, Selector sel)
The .print() method for Number objects.
Definition: runtime.cc:237

Method table for the Number class.

Definition at line 433 of file runtime.cc.

§ selNames

std::vector<std::string> anonymous_namespace{runtime.cc}::selNames

Global vector of selector names.

This is used to map from a selector to a string value.

Definition at line 19 of file runtime.cc.

§ StaticSelectorNames

const char* anonymous_namespace{runtime.cc}::StaticSelectorNames[]
Initial value:
=
{
"length",
"charAt",
"dump",
"print",
"invoke",
"atPut",
"at",
"add",
"sub",
"mul",
"div",
"compare",
"open",
"close",
"readline",
"write"
}

The names of the selectors in the StaticSelectors enumeration.

Definition at line 336 of file runtime.cc.

§ StringIvars

const char* anonymous_namespace{runtime.cc}::StringIvars[] = { "length" }

The names of the instance variables in the String class.

Definition at line 475 of file runtime.cc.

§ StringMethods

struct Method anonymous_namespace{runtime.cc}::StringMethods[]

Method table for the String class.

Definition at line 391 of file runtime.cc.