OpenTTD Source: src/script/squirrel.cpp File Reference

OpenTTD Source 15.0-beta1

Data Structures | Functions | Variables
squirrel.cpp File Reference

the implementation of the Squirrel class. More...

`#include "../stdafx.h"`
`#include "../debug.h"`
`#include "squirrel_std.hpp"`
`#include "../fileio_func.h"`
`#include "../string_func.h"`
`#include "script_fatalerror.hpp"`
`#include "../settings_type.h"`
`#include <sqstdaux.h>`
`#include <../squirrel/sqpcheader.h>`
`#include <../squirrel/sqvm.h>`
`#include "../core/alloc_func.hpp"`
`#include "../safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | ScriptAllocator
| In the memory allocator for Squirrel we want to directly use malloc/realloc, so when the OS does not have enough memory the game does not go into unrecoverable error mode and kill the whole game, but rather let the AI die though then we need to circumvent MallocT/ReallocT. More...
class | SQFile

## Functions
void * | sq_vm_malloc (SQUnsignedInteger size)
void * | sq_vm_realloc (void *p, SQUnsignedInteger oldsize, SQUnsignedInteger size)
void | sq_vm_free (void *p, SQUnsignedInteger size)
static char32_t | _io_file_lexfeed_ASCII (SQUserPointer file)
static char32_t | _io_file_lexfeed_UTF8 (SQUserPointer file)
static char32_t | _io_file_lexfeed_UCS2_no_swap (SQUserPointer file)
static char32_t | _io_file_lexfeed_UCS2_swap (SQUserPointer file)
static SQInteger | _io_file_read (SQUserPointer file, SQUserPointer buf, SQInteger size)

## Variables
ScriptAllocator * | _squirrel_allocator = nullptr
| In the memory allocator for Squirrel we want to directly use malloc/realloc, so when the OS does not have enough memory the game does not go into unrecoverable error mode and kill the whole game, but rather let the AI die though then we need to circumvent MallocT/ReallocT.

## Detailed Description

the implementation of the Squirrel class.

It handles all Squirrel-stuff and gives a nice API back to work with.

Definition in file squirrel.cpp.

## Function Documentation

## ◆ _io_file_lexfeed_ASCII()

static char32_t _io_file_lexfeed_ASCII | ( | SQUserPointer | file | ) |
| static

Definition at line 571 of file squirrel.cpp.

## ◆ _io_file_lexfeed_UCS2_no_swap()

static char32_t _io_file_lexfeed_UCS2_no_swap | ( | SQUserPointer | file | ) |
| static

Definition at line 597 of file squirrel.cpp.

## ◆ _io_file_lexfeed_UCS2_swap()

static char32_t _io_file_lexfeed_UCS2_swap | ( | SQUserPointer | file | ) |
| static

Definition at line 604 of file squirrel.cpp.

## ◆ _io_file_lexfeed_UTF8()

static char32_t _io_file_lexfeed_UTF8 | ( | SQUserPointer | file | ) |
| static

Definition at line 578 of file squirrel.cpp.

## ◆ _io_file_read()

static SQInteger _io_file_read | ( | SQUserPointer | file,
|  | SQUserPointer | buf,
|  | SQInteger | size
| ) |  |
| static

Definition at line 614 of file squirrel.cpp.

## ◆ sq_vm_free()

void sq_vm_free | ( | void * | p,
|  | SQUnsignedInteger | size
| ) |  |

Definition at line 194 of file squirrel.cpp.

## ◆ sq_vm_malloc()

void * sq_vm_malloc | ( | SQUnsignedInteger | size | ) |

Definition at line 192 of file squirrel.cpp.

## ◆ sq_vm_realloc()

void * sq_vm_realloc | ( | void * | p,
|  | SQUnsignedInteger | oldsize,
|  | SQUnsignedInteger | size
| ) |  |

Definition at line 193 of file squirrel.cpp.

## Variable Documentation

## ◆ _squirrel_allocator

ScriptAllocator* _squirrel_allocator = nullptr

In the memory allocator for Squirrel we want to directly use malloc/realloc, so when the OS does not have enough memory the game does not go into unrecoverable error mode and kill the whole game, but rather let the AI die though then we need to circumvent MallocT/ReallocT.

For the rest of this code, the safeguards should be in place though!

Definition at line 188 of file squirrel.cpp.