Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / include / lang / ByteCodeArray.h
blob9cd1b3fbc4f494384c8693df31cca3df700be080
1 /*
2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef LANG_BYTECODEARRAY_H
22 #define LANG_BYTECODEARRAY_H
25 typedef unsigned char Byte;
27 #define BYTE_CODE_CHUNK_SIZE 64
29 typedef struct {
30 Byte *bytes;
31 Byte *ptr;
32 size_t size;
33 } ByteCodeArray, *ByteCodes;
35 extern ByteCodes gCompilingByteCodes;
36 extern long totalByteCodes;
38 void initByteCodes();
39 void compileByte(long byte);
40 void compileAndFreeByteCodes(ByteCodes byteCodes);
41 void copyByteCodes(Byte *dest, ByteCodes byteCodes);
42 ByteCodes getByteCodes();
43 ByteCodes saveByteCodeArray();
44 void restoreByteCodeArray(ByteCodes byteCodes);
45 size_t byteCodeLength(ByteCodes byteCodes);
46 void compileByteCodes(ByteCodes byteCodes);
47 ByteCodes allocByteCodes();
48 void reallocByteCodes(ByteCodes byteCodes);
49 void freeByteCodes(ByteCodes byteCodes);
50 int compileOpcode(long opcode, long operand1);
51 void compileJump(long opcode, long jumplen);
52 int compileNumber(unsigned long value);
53 int compileNumber24(unsigned long value);
55 #endif