common: prevent buffer overflow
[supercollider.git] / include / lang / PyrSlot.h
blobb4d702925f83ac584d68a10e3d71abb5f7baf321
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
22 PyrSlot is a value holder for SC variables.
23 A PyrSlot is an 8-byte value which is either a double precision float or a
24 32-bit tag plus a 32-bit value.
28 #ifndef _PYRSLOT_H_
29 #define _PYRSLOT_H_
31 #if ( __SIZEOF_POINTER__ == 4 ) || defined(__i386__) || defined(__ppc__) || defined(__arm__) || defined(_WIN32)
32 #include "PyrSlot32.h"
33 #elif ( __SIZEOF_POINTER__ == 8 ) || defined(__x86_64__) || defined(_WIN64)
34 #include "PyrSlot64.h"
35 #else
36 #error "no PyrSlot imlementation for this platform"
37 #endif
39 extern PyrSlot o_nil, o_true, o_false, o_inf;
40 extern PyrSlot o_pi, o_twopi;
41 extern PyrSlot o_fhalf, o_fnegone, o_fzero, o_fone, o_ftwo;
42 extern PyrSlot o_negtwo, o_negone, o_zero, o_one, o_two;
43 extern PyrSlot o_emptyarray, o_onenilarray, o_argnamethis;
45 extern PyrSymbol *s_object; // "Object"
46 extern PyrSymbol *s_this; // "this"
47 extern PyrSymbol *s_super; // "super"
49 void dumpPyrSlot(PyrSlot* slot);
50 void slotString(PyrSlot *slot, char *str);
51 void slotOneWord(PyrSlot *slot, char *str);
52 bool postString(PyrSlot *slot, char *str);
53 const char *slotSymString(PyrSlot* slot);
54 int asCompileString(PyrSlot *slot, char *str);
56 int slotIntVal(PyrSlot* slot, int *value);
57 int slotFloatVal(PyrSlot* slot, float *value);
58 int slotDoubleVal(PyrSlot *slot, double *value);
59 int slotStrVal(PyrSlot *slot, char *str, int maxlen);
60 int slotPStrVal(PyrSlot *slot, unsigned char *str);
61 int slotSymbolVal(PyrSlot *slot, PyrSymbol **symbol);
63 #endif