2 * The contents of this file are subject to the Mozilla Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/MPL/
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
12 * The Original Code is the Sablotron XSLT Processor.
14 * The Initial Developer of the Original Code is Ginger Alliance Ltd.
15 * Portions created by Ginger Alliance are Copyright (C) 2000-2002
16 * Ginger Alliance Ltd. All Rights Reserved.
20 * Alternatively, the contents of this file may be used under the
21 * terms of the GNU General Public License Version 2 or later (the
22 * "GPL"), in which case the provisions of the GPL are applicable
23 * instead of those above. If you wish to allow use of your
24 * version of this file only under the terms of the GPL and not to
25 * allow others to use your version of this file under the MPL,
26 * indicate your decision by deleting the provisions above and
27 * replace them with the notice and other provisions required by
28 * the GPL. If you do not delete the provisions above, a recipient
29 * may use your version of this file under either the MPL or the
50 SabArena(int bloxize_);
51 /*size of by Tim Crook release 0.51 _PH_ */
52 void* armalloc(int size, int alignment = sizeof (void*));
53 void initialize(int bloxize_);
58 ArenaBlock* newBlock(int size);
60 ArenaBlock *block0, *blockn;
61 int totalAsked, totalMalloced;
67 /* VC++ 4.2 doesn't take the following:
68 void operator delete(void *ptr, SabArena *arena_) {};
69 so far, VC++6 throws warnings
72 void *operator new(size_t size, SabArena *arena_ = NULL)
74 // shouldn't be called without an arena specified
76 return arena_? arena_ -> armalloc(size) : ::operator new(size);
79 void operator delete(void *ptr, size_t size)
82 // ::operator delete(ptr);
86 class SabArenaStr : public SabArenaMember, public Str
89 SabArenaStr(SabArena *arena__)
92 SabArenaStr(Str& string, SabArena *arena__)
98 SabArenaStr(int num, SabArena *arena__)
104 SabArenaStr(double num, SabArena *arena__)
110 SabArenaStr(char c, SabArena *arena__)
116 SabArenaStr(char *chars, SabArena *arena__)
121 SabArenaStr(DStr &dstring, SabArena *arena__)
127 const SabArenaStr& operator= (const Str& string)
128 { nset((char*)string, string.length()); return *this; }
130 const SabArenaStr& operator= (const DStr& dstring)
131 { nset((char*)dstring, dstring.length()); return *this; }
133 const SabArenaStr& operator= (const char *s)
134 { nset(s, strlen(s)); return *this; }
142 virtual char* claimMemory( int nbytes ) const
144 // ask for memory with alignment 1 if from arena
145 return arena_ ? (char*)(arena_ -> armalloc(nbytes,1)) : Str::claimMemory(nbytes);
147 virtual void returnMemory( char *&p ) const