All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
chunk.cc File Reference
#include <iostream>
#include <cassert>
#include "chunk.h"

Go to the source code of this file.

Functions

unsigned simpleInstruction (const char *name, unsigned index)
 
unsigned jumpInstruction (const char *name, int sign, unsigned index, uint8_t jumpa, uint8_t jumpb)
 
unsigned constantInstruction (const char *name, unsigned index, uint8_t constant, const uscript::Value &value)
 
unsigned byteInstruction (const char *name, unsigned index, uint8_t slot)
 

Function Documentation

unsigned byteInstruction ( const char *  name,
unsigned  index,
uint8_t  slot 
)

Definition at line 42 of file chunk.cc.

42  {
43  std::cout << name << " " << (unsigned)slot << std::endl;
44  return index + 2;
45 }
then echo fcl name
BEGIN_PROLOG could also be cout
unsigned constantInstruction ( const char *  name,
unsigned  index,
uint8_t  constant,
const uscript::Value value 
)

Definition at line 35 of file chunk.cc.

35  {
36  std::cout << name << " " << (unsigned)constant << " ";
37  value.Print();
38  std::cout << std::endl;
39  return index + 2;
40 }
void Print() const
Definition: value.cc:5
then echo fcl name
BEGIN_PROLOG could also be cout
unsigned jumpInstruction ( const char *  name,
int  sign,
unsigned  index,
uint8_t  jumpa,
uint8_t  jumpb 
)

Definition at line 27 of file chunk.cc.

27  {
28  uint16_t jump = ((uint16_t)jumpa) << 8;
29  jump |= jumpb;
30 
31  std::cout << name << " " << index << " " << (index + 3 + sign * jump) << std::endl;
32  return index + 3;
33 }
int sign(double val)
Definition: UtilFunc.cxx:104
then echo fcl name
BEGIN_PROLOG could also be cout
unsigned simpleInstruction ( const char *  name,
unsigned  index 
)

Definition at line 22 of file chunk.cc.

22  {
23  std::cout << name << std::endl;
24  return index + 1;
25 }
then echo fcl name
BEGIN_PROLOG could also be cout