summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2010-04-18 20:40:22 +0000
committerAdrian Thurston <thurston@complang.org>2010-04-18 20:40:22 +0000
commit74d10390a33af5ea05f886dd364ab6337b1c44f0 (patch)
treec02e1ebc05bd8f5f6fd4939311e677ab20e914a9
parentc8f5eb2193b072465771f150bf2f3be3414b398b (diff)
downloadcolm-74d10390a33af5ea05f886dd364ab6337b1c44f0.tar.gz
more C porting
-rw-r--r--colm/bytecode.cpp155
-rw-r--r--colm/codevect.cpp6
-rw-r--r--colm/fsmrun.cpp2
-rw-r--r--colm/map.cpp1
-rw-r--r--colm/pdarun.cpp9
-rw-r--r--colm/pool.cpp24
-rw-r--r--colm/rtvector.h87
-rw-r--r--colm/string.cpp1
-rw-r--r--colm/tree.cpp2
9 files changed, 164 insertions, 123 deletions
diff --git a/colm/bytecode.cpp b/colm/bytecode.cpp
index b8076565..69d102b8 100644
--- a/colm/bytecode.cpp
+++ b/colm/bytecode.cpp
@@ -25,6 +25,9 @@
#include <alloca.h>
#include <sys/mman.h>
#include <sstream>
+#include <string.h>
+#include <assert.h>
+#include <stdlib.h>
#include "bytecode.h"
#include "pdarun.h"
@@ -646,7 +649,7 @@ void runProgram( Program *prg )
/* The root code should all be commit code and reverseCode
* should be empty. */
- assert( reverseCode.length() == 0 );
+ assert( reverseCode.tabLen == 0 );
}
/* Clear */
@@ -677,14 +680,14 @@ void initExecution( Execution *exec, Program *prg, RtCodeVect *reverseCode,
void rcodeDownrefAll( Program *prg, Tree **sp, RtCodeVect *rev )
{
- while ( rev->length() > 0 ) {
+ while ( rev->tabLen > 0 ) {
/* Read the length */
- Code *prcode = rev->data + rev->length() - SIZEOF_WORD;
+ Code *prcode = rev->data + rev->tabLen - SIZEOF_WORD;
Word len;
read_word_p( len, prcode );
/* Find the start of block. */
- long start = rev->length() - len - SIZEOF_WORD;
+ long start = rev->tabLen - len - SIZEOF_WORD;
prcode = rev->data + start;
/* Execute it. */
@@ -998,25 +1001,25 @@ bool makeReverseCode( RtCodeVect *all, RtCodeVect &reverseCode )
/* Do we need to revert the left hand side? */
/* Check if there was anything generated. */
- if ( reverseCode.length() == 0 )
+ if ( reverseCode.tabLen == 0 )
return false;
- long prevAllLength = all->length();
+ long prevAllLength = all->tabLen;
/* Go backwards, group by group, through the reverse code. Push each group
* to the global reverse code stack. */
- Code *p = reverseCode.data + reverseCode.length();
+ Code *p = reverseCode.data + reverseCode.tabLen;
while ( p != reverseCode.data ) {
p--;
long len = *p;
p = p - len;
- all->append( p, len );
+ append( all, p, len );
}
/* Stop, then place a total length in the global stack. */
- all->append( IN_STOP );
- long length = all->length() - prevAllLength;
- all->appendWord( length );
+ append( all, IN_STOP );
+ long length = all->tabLen - prevAllLength;
+ appendWord( all, length );
/* Clear the revere code buffer. */
reverseCode.tabLen = 0;
@@ -1027,12 +1030,12 @@ bool makeReverseCode( RtCodeVect *all, RtCodeVect &reverseCode )
void rexecute( Execution *exec, Tree **root, RtCodeVect *allRev )
{
/* Read the length */
- Code *prcode = allRev->data + allRev->length() - SIZEOF_WORD;
+ Code *prcode = allRev->data + allRev->tabLen - SIZEOF_WORD;
Word len;
read_word_p( len, prcode );
/* Find the start of block. */
- long start = allRev->length() - len - SIZEOF_WORD;
+ long start = allRev->tabLen - len - SIZEOF_WORD;
prcode = allRev->data + start;
/* Execute it. */
@@ -1234,7 +1237,7 @@ again:
push( exec->pdaRun->context );
/* Set up the reverse instruction. */
- exec->reverseCode->append( IN_LOAD_CONTEXT_BKT );
+ append( exec->reverseCode, IN_LOAD_CONTEXT_BKT );
exec->rcodeUnitLen = SIZEOF_CODE;
break;
}
@@ -1284,7 +1287,7 @@ again:
push( prg->global );
/* Set up the reverse instruction. */
- exec->reverseCode->append( IN_LOAD_GLOBAL_BKT );
+ append( exec->reverseCode, IN_LOAD_GLOBAL_BKT );
exec->rcodeUnitLen = SIZEOF_CODE;
break;
}
@@ -1334,7 +1337,7 @@ again:
push( exec->fsmRun->curStream );
/* Set up the reverse instruction. */
- exec->reverseCode->append( IN_LOAD_INPUT_BKT );
+ append( exec->reverseCode, IN_LOAD_INPUT_BKT );
exec->rcodeUnitLen = SIZEOF_CODE;
break;
}
@@ -1384,7 +1387,7 @@ again:
push( exec->pdaRun->context );
/* Set up the reverse instruction. */
- exec->reverseCode->append( IN_LOAD_INPUT_BKT );
+ append( exec->reverseCode, IN_LOAD_INPUT_BKT );
exec->rcodeUnitLen = SIZEOF_CODE;
break;
}
@@ -1688,8 +1691,8 @@ again:
push( split );
/* Set up the reverse instruction. */
- exec->reverseCode->append( IN_GET_FIELD_BKT );
- exec->reverseCode->appendHalf( field );
+ append( exec->reverseCode, IN_GET_FIELD_BKT );
+ appendHalf( exec->reverseCode, field );
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_HALF;
break;
}
@@ -1751,11 +1754,11 @@ again:
setField( prg, obj, field, val );
/* Set up the reverse instruction. */
- exec->reverseCode->append( IN_SET_FIELD_BKT );
- exec->reverseCode->appendHalf( field );
- exec->reverseCode->appendWord( (Word)prev );
+ append( exec->reverseCode, IN_SET_FIELD_BKT );
+ appendHalf( exec->reverseCode, field );
+ appendWord( exec->reverseCode, (Word)prev );
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_HALF + SIZEOF_WORD;
- exec->reverseCode->append( exec->rcodeUnitLen );
+ append( exec->reverseCode, exec->rcodeUnitLen );
/* FLUSH */
break;
}
@@ -2606,7 +2609,7 @@ again:
push( input );
treeDownref( prg, sp, accum );
//
-// exec->reverseCode->append( IN_EXTRACT_INPUT_BKT );
+// append( exec->reverseCode, IN_EXTRACT_INPUT_BKT );
// exec->rcodeUnitLen += SIZEOF_CODE;
break;
}
@@ -2663,11 +2666,11 @@ again:
treeUpref( stream );
push( stream );
- exec->reverseCode->append( IN_STREAM_APPEND_BKT );
- exec->reverseCode->appendWord( (Word) stream );
- exec->reverseCode->appendWord( (Word) input );
- exec->reverseCode->appendWord( (Word) len );
- exec->reverseCode->append( SIZEOF_CODE + 3 * SIZEOF_WORD );
+ append( exec->reverseCode, IN_STREAM_APPEND_BKT );
+ appendWord( exec->reverseCode, (Word) stream );
+ appendWord( exec->reverseCode, (Word) input );
+ appendWord( exec->reverseCode, (Word) len );
+ append( exec->reverseCode, SIZEOF_CODE + 3 * SIZEOF_WORD );
break;
}
case IN_STREAM_APPEND_BKT: {
@@ -2728,11 +2731,11 @@ again:
//treeDownref( prg, sp, stream );
//treeDownref( prg, sp, accum );
- exec->reverseCode->append( IN_PARSE_FRAG_BKT );
- exec->reverseCode->appendWord( (Word) accum );
- exec->reverseCode->appendWord( (Word) stream );
- exec->reverseCode->appendWord( consumed );
- exec->reverseCode->append( SIZEOF_CODE + 3 * SIZEOF_WORD );
+ append( exec->reverseCode, IN_PARSE_FRAG_BKT );
+ appendWord( exec->reverseCode, (Word) accum );
+ appendWord( exec->reverseCode, (Word) stream );
+ appendWord( exec->reverseCode, consumed );
+ append( exec->reverseCode, SIZEOF_CODE + 3 * SIZEOF_WORD );
break;
}
@@ -2782,11 +2785,11 @@ again:
push( result );
treeUpref( result );
- exec->reverseCode->append( IN_PARSE_FINISH_BKT );
- exec->reverseCode->appendWord( (Word) accum );
- exec->reverseCode->appendWord( (Word) result );
- exec->reverseCode->appendWord( (Word) consumed );
- exec->reverseCode->append( SIZEOF_CODE + 3*SIZEOF_WORD );
+ append( exec->reverseCode, IN_PARSE_FINISH_BKT );
+ appendWord( exec->reverseCode, (Word) accum );
+ appendWord( exec->reverseCode, (Word) result );
+ appendWord( exec->reverseCode, (Word) consumed );
+ append( exec->reverseCode, SIZEOF_CODE + 3*SIZEOF_WORD );
break;
}
case IN_PARSE_FINISH_BKT: {
@@ -2825,10 +2828,10 @@ again:
/* Single unit. */
treeUpref( string );
- exec->reverseCode->append( IN_STREAM_PULL_BKT );
- exec->reverseCode->appendWord( (Word) string );
+ append( exec->reverseCode, IN_STREAM_PULL_BKT );
+ appendWord( exec->reverseCode, (Word) string );
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_WORD;
- exec->reverseCode->append( exec->rcodeUnitLen );
+ append( exec->reverseCode, exec->rcodeUnitLen );
treeDownref( prg, sp, stream );
treeDownref( prg, sp, len );
@@ -2863,10 +2866,10 @@ again:
push( 0 );
/* Single unit. */
- exec->reverseCode->append( IN_STREAM_PUSH_BKT );
- exec->reverseCode->appendWord( len );
+ append( exec->reverseCode, IN_STREAM_PUSH_BKT );
+ appendWord( exec->reverseCode, len );
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_WORD;
- exec->reverseCode->append( exec->rcodeUnitLen );
+ append( exec->reverseCode, exec->rcodeUnitLen );
treeDownref( prg, sp, stream );
treeDownref( prg, sp, tree );
@@ -2884,10 +2887,10 @@ again:
push( 0 );
/* Single unit. */
- exec->reverseCode->append( IN_STREAM_PUSH_BKT );
- exec->reverseCode->appendWord( len );
+ append( exec->reverseCode, IN_STREAM_PUSH_BKT );
+ appendWord( exec->reverseCode, len );
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_WORD;
- exec->reverseCode->append( exec->rcodeUnitLen );
+ append( exec->reverseCode, exec->rcodeUnitLen );
treeDownref( prg, sp, stream );
treeDownref( prg, sp, tree );
@@ -3058,8 +3061,8 @@ again:
push( dval );
/* This is an initial global load. Need to reverse execute it. */
- exec->reverseCode->append( IN_PTR_DEREF_BKT );
- exec->reverseCode->appendWord( (Word) ptr );
+ append( exec->reverseCode, IN_PTR_DEREF_BKT );
+ appendWord( exec->reverseCode, (Word) ptr );
exec->rcodeUnitLen = SIZEOF_CODE + SIZEOF_WORD;
break;
}
@@ -3213,10 +3216,10 @@ again:
tree->tokdata = head;
/* Set up reverse code. Needs no args. */
- exec->reverseCode->append( IN_SET_TOKEN_DATA_BKT );
- exec->reverseCode->appendWord( (Word)oldval );
+ append( exec->reverseCode, IN_SET_TOKEN_DATA_BKT );
+ appendWord( exec->reverseCode, (Word)oldval );
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_WORD;
- exec->reverseCode->append( exec->rcodeUnitLen );
+ append( exec->reverseCode, exec->rcodeUnitLen );
treeDownref( prg, sp, tree );
treeDownref( prg, sp, val );
@@ -3310,9 +3313,9 @@ again:
push( prg->trueVal );
/* Set up reverse code. Needs no args. */
- exec->reverseCode->append( IN_LIST_APPEND_BKT );
+ append( exec->reverseCode, IN_LIST_APPEND_BKT );
exec->rcodeUnitLen += SIZEOF_CODE;
- exec->reverseCode->append( exec->rcodeUnitLen );
+ append( exec->reverseCode, exec->rcodeUnitLen );
/* FLUSH */
break;
}
@@ -3377,10 +3380,10 @@ again:
/* Set up reverse. The result comes off the list downrefed.
* Need it up referenced for the reverse code too. */
treeUpref( end );
- exec->reverseCode->append( IN_LIST_REMOVE_END_BKT );
- exec->reverseCode->appendWord( (Word)end );
+ append( exec->reverseCode, IN_LIST_REMOVE_END_BKT );
+ appendWord( exec->reverseCode, (Word)end );
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_WORD;
- exec->reverseCode->append( exec->rcodeUnitLen );
+ append( exec->reverseCode, exec->rcodeUnitLen );
/* FLUSH */
break;
}
@@ -3454,8 +3457,8 @@ again:
push( val );
/* Set up the reverse instruction. */
- exec->reverseCode->append( IN_GET_LIST_MEM_BKT );
- exec->reverseCode->appendHalf( field );
+ append( exec->reverseCode, IN_GET_LIST_MEM_BKT );
+ appendHalf( exec->reverseCode, field );
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_HALF;
break;
}
@@ -3512,11 +3515,11 @@ again:
Tree *existing = setListMem( (List*)obj, field, val );
/* Set up the reverse instruction. */
- exec->reverseCode->append( IN_SET_LIST_MEM_BKT );
- exec->reverseCode->appendHalf( field );
- exec->reverseCode->appendWord( (Word)existing );
+ append( exec->reverseCode, IN_SET_LIST_MEM_BKT );
+ appendHalf( exec->reverseCode, field );
+ appendWord( exec->reverseCode, (Word)existing );
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_HALF + SIZEOF_WORD;
- exec->reverseCode->append( exec->rcodeUnitLen );
+ append( exec->reverseCode, exec->rcodeUnitLen );
/* FLUSH */
break;
}
@@ -3563,11 +3566,11 @@ again:
/* Need to upref key for storage in reverse code. */
treeUpref( key );
- exec->reverseCode->append( IN_MAP_INSERT_BKT );
- exec->reverseCode->append( inserted );
- exec->reverseCode->appendWord( (Word)key );
+ append( exec->reverseCode, IN_MAP_INSERT_BKT );
+ append( exec->reverseCode, inserted );
+ appendWord( exec->reverseCode, (Word)key );
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_CODE + SIZEOF_WORD;
- exec->reverseCode->append( exec->rcodeUnitLen );
+ append( exec->reverseCode, exec->rcodeUnitLen );
if ( ! inserted ) {
treeDownref( prg, sp, key );
@@ -3664,11 +3667,11 @@ again:
/* Set up the reverse instruction. */
treeUpref( key );
treeUpref( existing );
- exec->reverseCode->append( IN_MAP_STORE_BKT );
- exec->reverseCode->appendWord( (Word)key );
- exec->reverseCode->appendWord( (Word)existing );
+ append( exec->reverseCode, IN_MAP_STORE_BKT );
+ appendWord( exec->reverseCode, (Word)key );
+ appendWord( exec->reverseCode, (Word)existing );
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_WORD + SIZEOF_WORD;
- exec->reverseCode->append( exec->rcodeUnitLen );
+ append( exec->reverseCode, exec->rcodeUnitLen );
/* FLUSH */
treeDownref( prg, sp, obj );
@@ -3733,11 +3736,11 @@ again:
push( pair.val );
/* Reverse instruction. */
- exec->reverseCode->append( IN_MAP_REMOVE_BKT );
- exec->reverseCode->appendWord( (Word)pair.key );
- exec->reverseCode->appendWord( (Word)pair.val );
+ append( exec->reverseCode, IN_MAP_REMOVE_BKT );
+ appendWord( exec->reverseCode, (Word)pair.key );
+ appendWord( exec->reverseCode, (Word)pair.val );
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_WORD + SIZEOF_WORD;
- exec->reverseCode->append( exec->rcodeUnitLen );
+ append( exec->reverseCode, exec->rcodeUnitLen );
treeDownref( prg, sp, obj );
treeDownref( prg, sp, key );
diff --git a/colm/codevect.cpp b/colm/codevect.cpp
index 542ceb7b..021401d4 100644
--- a/colm/codevect.cpp
+++ b/colm/codevect.cpp
@@ -21,6 +21,12 @@
#include "rtvector.h"
+#include <new>
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+
void initRtCodeVect( RtCodeVect *vect )
{
vect->data = 0;
diff --git a/colm/fsmrun.cpp b/colm/fsmrun.cpp
index 0d889b2a..268a21ac 100644
--- a/colm/fsmrun.cpp
+++ b/colm/fsmrun.cpp
@@ -418,7 +418,7 @@ void queueBackTree( Tree **sp, PdaRun *pdaRun, FsmRun *fsmRun, InputStream *inpu
void addNoToken( Program *prg, PdaRun *parser )
{
/* Check if there was anything generated. */
- if ( parser->queue == 0 && parser->reverseCode.length() > 0 ) {
+ if ( parser->queue == 0 && parser->reverseCode.tabLen > 0 ) {
#ifdef COLM_LOG_PARSE
if ( colm_log_parse ) {
cerr << "found reverse code but no token, sending _notoken" << endl;
diff --git a/colm/map.cpp b/colm/map.cpp
index 850edf1c..3603e2d4 100644
--- a/colm/map.cpp
+++ b/colm/map.cpp
@@ -20,6 +20,7 @@
*/
#include "pdarun.h"
+#include <assert.h>
MapEl *mapRebalance( Map *map, MapEl *n );
diff --git a/colm/pdarun.cpp b/colm/pdarun.cpp
index 961a007f..81fe65c4 100644
--- a/colm/pdarun.cpp
+++ b/colm/pdarun.cpp
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <fstream>
#include <string>
+#include <string.h>
#include "config.h"
#include "pdarun.h"
@@ -336,7 +337,7 @@ void commitFull( Tree **sp, PdaRun *parser, long causeReduce )
#endif
Kid *kid = parser->stackTop;
- Code *rcode = parser->allReverseCode->data + parser->allReverseCode->length();
+ Code *rcode = parser->allReverseCode->data + parser->allReverseCode->tabLen;
/* The top level of the stack is linked right to left. This is the
* traversal order we need for committing. */
@@ -545,9 +546,9 @@ again:
treeUpref( redLel->tree );
treeDownref( pdaRun->prg, sp, exec.lhs );
- pdaRun->reverseCode.append( IN_RESTORE_LHS );
- pdaRun->reverseCode.appendWord( (Word)exec.parsed );
- pdaRun->reverseCode.append( SIZEOF_CODE + SIZEOF_WORD );
+ append( &pdaRun->reverseCode, IN_RESTORE_LHS );
+ appendWord( &pdaRun->reverseCode, (Word)exec.parsed );
+ append( &pdaRun->reverseCode, SIZEOF_CODE + SIZEOF_WORD );
}
/* Pull out the reverse code, if any. */
diff --git a/colm/pool.cpp b/colm/pool.cpp
index d0fa6efd..20de3870 100644
--- a/colm/pool.cpp
+++ b/colm/pool.cpp
@@ -1,3 +1,27 @@
+/*
+ * Copyright 2010 Adrian Thurston <thurston@complang.org>
+ */
+
+/* This file is part of Colm.
+ *
+ * Colm is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Colm is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Colm; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <string.h>
+#include <stdlib.h>
+
#include "bytecode.h"
#include "pdarun.h"
#include "pool.h"
diff --git a/colm/rtvector.h b/colm/rtvector.h
index be74f2e9..e8eb0c75 100644
--- a/colm/rtvector.h
+++ b/colm/rtvector.h
@@ -22,11 +22,6 @@
#ifndef _RT_VECTOR_H
#define _RT_VECTOR_H
-#include <new>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-
typedef unsigned char Code;
typedef unsigned long Word;
typedef unsigned long Half;
@@ -39,50 +34,58 @@ void rtCodeVectRemove( RtCodeVect *vect, long pos, long len );
void initRtCodeVect( RtCodeVect *codeVect );
+inline static void remove( RtCodeVect *vect, long pos );
+inline static void append( RtCodeVect *vect, const Code *val, long len );
+inline static void append( RtCodeVect *vect, const Code &val );
+inline static void appendHalf( RtCodeVect *vect, Half half );
+inline static void appendWord( RtCodeVect *vect, Word word );
+
struct RtCodeVect
{
- long length() const
- { return tabLen; }
-
Code *data;
long tabLen;
long allocLen;
- /* Free all mem used by the vector. */
- ~RtCodeVect() { rtCodeVectEmpty( this ); }
-
- /* Stack operations. */
- void push( const Code &t ) { append( t ); }
- void pop() { remove( tabLen - 1 ); }
- Code &top() { return data[tabLen - 1]; }
-
- void remove(long pos) { rtCodeVectRemove( this, pos, 1 ); }
-
- void append(const Code &val) { rtCodeVectReplace( this, tabLen, &val, 1 ); }
- void append(const Code *val, long len) { rtCodeVectReplace( this, tabLen, val, len ); }
-
- void appendHalf( Half half )
- {
- /* not optimal. */
- append( half & 0xff );
- append( (half>>8) & 0xff );
- }
-
- void appendWord( Word word )
- {
- /* not optimal. */
- append( word & 0xff );
- append( (word>>8) & 0xff );
- append( (word>>16) & 0xff );
- append( (word>>24) & 0xff );
- #if SIZEOF_LONG == 8
- append( (word>>32) & 0xff );
- append( (word>>40) & 0xff );
- append( (word>>48) & 0xff );
- append( (word>>56) & 0xff );
- #endif
- }
+ /* FIXME: leak when freed. */
};
+inline static void remove( RtCodeVect *vect, long pos )
+{
+ rtCodeVectRemove( vect, pos, 1 );
+}
+
+inline static void append( RtCodeVect *vect, const Code *val, long len )
+{
+ rtCodeVectReplace( vect, vect->tabLen, val, len );
+}
+
+inline static void append( RtCodeVect *vect, const Code &val )
+{
+ rtCodeVectReplace( vect, vect->tabLen, &val, 1 );
+}
+
+inline static void appendHalf( RtCodeVect *vect, Half half )
+{
+ /* not optimal. */
+ append( vect, half & 0xff );
+ append( vect, (half>>8) & 0xff );
+}
+
+inline static void appendWord( RtCodeVect *vect, Word word )
+{
+ /* not optimal. */
+ append( vect, word & 0xff );
+ append( vect, (word>>8) & 0xff );
+ append( vect, (word>>16) & 0xff );
+ append( vect, (word>>24) & 0xff );
+ #if SIZEOF_LONG == 8
+ append( vect, (word>>32) & 0xff );
+ append( vect, (word>>40) & 0xff );
+ append( vect, (word>>48) & 0xff );
+ append( vect, (word>>56) & 0xff );
+ #endif
+}
+
+
#endif
diff --git a/colm/string.cpp b/colm/string.cpp
index 701de372..690e80bd 100644
--- a/colm/string.cpp
+++ b/colm/string.cpp
@@ -24,6 +24,7 @@
#include <assert.h>
#include <string.h>
#include <stdio.h>
+#include <stdlib.h>
/*
* In this system strings are not null terminated. Often strings come from a
diff --git a/colm/tree.cpp b/colm/tree.cpp
index ff561aad..ca0b2e1a 100644
--- a/colm/tree.cpp
+++ b/colm/tree.cpp
@@ -24,6 +24,8 @@
#include "fsmrun.h"
#include "pdarun.h"
#include <iostream>
+#include <string.h>
+#include <stdlib.h>
using std::cout;
using std::cerr;