src/data_buffer.h

Sun, 19 Jan 2014 20:39:30 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sun, 19 Jan 2014 20:39:30 +0200
changeset 85
264a61e9eba0
parent 75
bf8c57437231
child 86
43fe4be38a58
permissions
-rw-r--r--

- use the Skulltag 97c2 license which is slightly differently worded

73
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
85
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
2 Copyright 2012-2014 Santeri Piippo
73
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 All rights reserved.
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 Redistribution and use in source and binary forms, with or without
85
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
6 modification, are permitted provided that the following conditions
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
7 are met:
73
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8
85
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
9 1. Redistributions of source code must retain the above copyright
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
10 notice, this list of conditions and the following disclaimer.
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
11 2. Redistributions in binary form must reproduce the above copyright
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
12 notice, this list of conditions and the following disclaimer in the
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
13 documentation and/or other materials provided with the distribution.
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
14 3. The name of the author may not be used to endorse or promote products
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
15 derived from this software without specific prior written permission.
73
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16
85
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
17 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
18 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
19 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
20 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
21 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
22 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
23 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
24 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
264a61e9eba0 - use the Skulltag 97c2 license which is slightly differently worded
Teemu Piippo <crimsondusk64@gmail.com>
parents: 75
diff changeset
26 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
73
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 */
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 #ifndef BOTC_DATABUFFER_H
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 #define BOTC_DATABUFFER_H
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 #include <stdio.h>
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 #include <string.h>
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 #include "main.h"
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 #include "stringtable.h"
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 #define MAX_MARKS 512
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 extern int g_NextMark;
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 // ============================================================================
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 // DataBuffer: A dynamic data buffer.
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 class data_buffer
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 {
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 public:
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 // The actual buffer
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 byte* buffer;
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 // Allocated size of the buffer
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 int allocsize;
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 // Written size of the buffer
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 int writesize;
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 // Marks and references
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 ScriptMark* marks[MAX_MARKS];
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 ScriptMarkReference* refs[MAX_MARKS];
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 data_buffer (int size = 128);
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 ~data_buffer ();
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 // ====================================================================
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 // Write stuff to the buffer
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 // TODO: un-template and remove the union, move to source file
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65 template<class T> void write (T stuff)
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66 {
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 if (writesize + sizeof (T) >= allocsize)
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68 {
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69 // We don't have enough space in the buffer to write
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70 // the stuff - thus resize. First, store the old
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 // buffer temporarily:
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72 char* copy = new char[allocsize];
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 memcpy (copy, buffer, allocsize);
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
74
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 // Remake the buffer with the new size. Have enough space
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76 // for the stuff we're going to write, as well as a bit
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77 // of leeway so we don't have to resize immediately again.
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78 size_t newsize = allocsize + sizeof (T) + 128;
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 delete buffer;
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81 buffer = new unsigned char[newsize];
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 allocsize = newsize;
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 // Now, copy the stuff back.
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 memcpy (buffer, copy, allocsize);
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86 delete copy;
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 }
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 // Buffer is now guaranteed to have enough space.
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90 // Write the stuff one byte at a time.
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 generic_union<T> uni;
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92 uni.as_t = stuff;
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94 for (int x = 0; x < sizeof (T); x++)
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95 {
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96 if (writesize >= allocsize) // should NEVER happen because resizing is done above
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97 error ("DataBuffer: written size exceeds allocated size!\n");
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98
75
bf8c57437231 - renamed files to .cxx, restructured parser.cc
Teemu Piippo <crimsondusk64@gmail.com>
parents: 73
diff changeset
99 buffer[writesize] = uni.as_bytes[x];
73
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100 writesize++;
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101 }
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102 }
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 // ====================================================================
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105 // Merge another data buffer into this one.
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 void merge (data_buffer* other);
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
108 // Clones this databuffer to a new one and returns it.
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
109 data_buffer* clone ();
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
111 // ====================================================================
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
112 // Adds a mark to the buffer. A mark is a "pointer" to a particular
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
113 // position in the bytecode. The actual permanent position cannot
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
114 // be predicted in any way or form, thus these things will be used
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
115 // to "mark" a position like that for future use.
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116 int add_mark (string name);
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
117
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
118 // ====================================================================
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
119 // A ref is another "mark" that references a mark. When the bytecode
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
120 // is written to file, they are changed into their marks' current
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121 // positions. Marks themselves are never written to files, only refs are
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
122 int add_reference (int marknum, bool placeholder = true);
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
123
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
124 // Delete a mark and all references to it.
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125 void delete_mark (int marknum);
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
126
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
127 // Adjusts a mark to the current position
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128 void move_mark(int i);
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
129
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
130 void offset_mark (int mark, int offset);
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
131
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
132 // Dump the buffer (for debugging purposes)
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
133 void dump();
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
134
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
135 // Count the amount of marks
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
136 int count_marks ();
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
137
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
138 // Count the amount of refs
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
139 int count_references ();
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
140
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
141 // Write a float into the buffer
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
142 void write_float (string floatstring);
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
143
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
144 void write_string (string a);
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
145 };
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
146
1ee9b312dc18 - *hot stuff coming through*
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
147 #endif // BOTC_DATABUFFER_H

mercurial