This is a port of the mruby/c tutorial Chapter 03 to the mbed environment.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

load.c File Reference

load.c File Reference

mruby bytecode loader. More...

Go to the source code of this file.

Functions

static int load_header (struct VM *vm, const uint8_t **pos)
 Parse header section.
static int load_irep (struct VM *vm, const uint8_t **pos)
 Parse IREP section.
static int load_lvar (struct VM *vm, const uint8_t **pos)
 Parse LVAR section.
int load_mrb (struct VM *vm)
 Setup mrb program.
int loca_mrb_array (struct VM *vm, const uint8_t *ptr)

Detailed Description

mruby bytecode loader.

  Copyright (C) 2015 Kyushu Institute of Technology.
  Copyright (C) 2015 Shimane IT Open-Innovation Center.
  This file is distributed under BSD 3-Clause License.
  

Definition in file load.c.


Function Documentation

static int load_header ( struct VM *  vm,
const uint8_t **  pos 
) [static]

Parse header section.

Parameters:
vmA pointer of VM.
posA pointer of pointer of RITE header.
Returns:
int zero if no error.
  Structure
   "RITE"	identifier
   "0003"	version
   0000		CRC
   0000_0000	total size
   "MATZ"	compiler name
   "0000"	compiler version
  

Definition at line 43 of file load.c.

static int load_irep ( struct VM *  vm,
const uint8_t **  pos 
) [static]

Parse IREP section.

Parameters:
vmA pointer of VM.
posA pointer of pointer of IREP section.
Returns:
int zero if no error.
  Structure
   "IREP"	section identifier
   0000_0000	section size
   "0000"	rite version
   (loop n of child irep bellow)
   0000_0000	record size
   0000		n of local variable
   0000		n of register
   0000		n of child irep
   0000_0000	n of byte code  (ISEQ BLOCK)
   ...		byte codes
   0000_0000	n of pool	(POOL BLOCK)
   (loop n of pool)
     00		type
     0000	length
     ...	pool data
   0000_0000	n of symbol	(SYMS BLOCK)
   (loop n of symbol)
     0000	length
     ...	symbol data
  

Definition at line 105 of file load.c.

static int load_lvar ( struct VM *  vm,
const uint8_t **  pos 
) [static]

Parse LVAR section.

Parameters:
vmA pointer of VM.
posA pointer of pointer of LVAR section.
Returns:
int zero if no error.

Definition at line 227 of file load.c.

int load_mrb ( struct VM *  vm )

Setup mrb program.

Parameters:
vmA pointer of VM.
Returns:
int zero if no error.

Definition at line 245 of file load.c.

int loca_mrb_array ( struct VM *  vm,
const uint8_t *  ptr 
)
Parameters:
vmA pointer of VM.
ptrA pointer of RITE (.mrb) code.

Definition at line 277 of file load.c.