memory.h

Go to the documentation of this file.
00001 
00002 /*  $Id: memory.h 1186 2006-04-03 13:06:44Z hasseily $    */
00003 
00004 /******************************************************************************
00005 
00006     UserLand Frontier(tm) -- High performance Web content management,
00007     object database, system-level and Internet scripting environment,
00008     including source code editing and debugging.
00009 
00010     Copyright (C) 1992-2004 UserLand Software, Inc.
00011 
00012     This program is free software; you can redistribute it and/or modify
00013     it under the terms of the GNU General Public License as published by
00014     the Free Software Foundation; either version 2 of the License, or
00015     (at your option) any later version.
00016 
00017     This program is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020     GNU General Public License for more details.
00021 
00022     You should have received a copy of the GNU General Public License
00023     along with this program; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 
00026 ******************************************************************************/
00027 
00028 #ifndef memoryinclude /*so other includes can tell if we've been loaded*/
00029 #define memoryinclude /*so other includes can tell if we've been loaded*/
00030 
00031 
00032 #ifndef shelltypesinclude
00033 
00034     #include "shelltypes.h"
00035 
00036 #endif
00037 
00038 
00039 typedef struct handlestream {
00040     
00041     /*
00042     5.0.2 dmb: new structure for stream-like operations on handle-based data
00043     */
00044     
00045     Handle data;
00046     long pos;
00047     long eof;
00048     long size;
00049     } handlestream, *ptrhandlestream;
00050 
00051 
00052 #define isemptyhandle(h) (gethandlesize(h)==0)
00053 
00054 
00055 #if (MEMTRACKER != 1)
00056     /*function prototypes*/
00057     extern boolean newhandle (long, Handle *);
00058 
00059     extern boolean newemptyhandle (Handle *);
00060 
00061     extern void disposehandle (Handle);
00062 
00063     extern boolean newclearhandle (long, Handle *);
00064 
00065     extern boolean newfilledhandle (ptrvoid, long, Handle *);
00066 
00067     #ifdef flnewfeatures
00068         extern boolean newgrowinghandle (long, Handle *);
00069     #endif
00070 
00071     extern boolean copyhandle (Handle, Handle *);
00072 
00073     extern boolean newtexthandle (const bigstring, Handle *);
00074 
00075     extern boolean newheapstring (const bigstring, hdlstring *);
00076 
00077     extern boolean concathandles (Handle, Handle, Handle *);
00078 
00079     extern boolean mergehandles (Handle, Handle, Handle *);
00080 
00081     extern boolean unmergehandles (Handle, Handle *, Handle *);
00082 
00083     extern boolean newintarray (short, hdlintarray *);
00084 
00085     extern boolean loadfromhandletohandle (Handle, long *, long, boolean, Handle *);
00086 
00087     extern boolean loadhandleremains  (long, Handle, Handle *);
00088 
00089 #else
00090 
00091     #ifdef MACVERSION
00092         #define GetCurrentThreadId() (0L)
00093     #endif
00094 
00095     #define newhandle(sz, ph) debugnewhandle(__FILE__, __LINE__, GetCurrentThreadId(), sz, ph)
00096 
00097     #define newemptyhandle(ph) debugnewemptyhandle(__FILE__, __LINE__, GetCurrentThreadId(), ph)
00098 
00099 //  #define disposehandle(h) debugdisposehandle(__FILE__, __LINE__, GetCurrentThreadId(), h)
00100 
00101     #define newclearhandle(sz, ph) debugnewclearhandle(__FILE__, __LINE__, GetCurrentThreadId(), sz, ph)
00102 
00103     #define newfilledhandle(ptr, sz, ph) debugnewfilledhandle(__FILE__, __LINE__, GetCurrentThreadId(), ptr, sz, ph)
00104 
00105     #ifdef flnewfeatures
00106         #define newgrowinghandle(sz, ph) debugnewgrowinghandle(__FILE__, __LINE__, GetCurrentThreadId(), sz, ph)
00107     #endif
00108 
00109     #define copyhandle(h, ph) debugcopyhandle(__FILE__, __LINE__, GetCurrentThreadId(), h, ph)
00110 
00111     #define newtexthandle(bs, ph) debugnewtexthandle(__FILE__, __LINE__, GetCurrentThreadId(), bs, ph)
00112 
00113     #define newheapstring(bs, ph) debugnewheapstring(__FILE__, __LINE__, GetCurrentThreadId(), bs, ph)
00114 
00115     #define concathandles(h1, h2, ph) debugconcathandles(__FILE__, __LINE__, GetCurrentThreadId(), h1, h2, ph)
00116 
00117     #define mergehandles(h1, h2, ph) debugmergehandles(__FILE__, __LINE__, GetCurrentThreadId(), h1, h2, ph)
00118 
00119     #define unmergehandles(h, ph1, ph2) debugunmergehandles(__FILE__, __LINE__, GetCurrentThreadId(), h, ph1, ph2)
00120 
00121     #define newintarray(sz, ph) debugnewintarray(__FILE__, __LINE__, GetCurrentThreadId(), sz, ph)
00122 
00123     #define loadfromhandletohandle(h, posptr, sz, fl, ph) debugloadfromhandletohandle(__FILE__, __LINE__, GetCurrentThreadId(), h, posptr, sz, fl, ph)
00124 
00125     #define loadhandleremains(sz, h, ph) debugloadhandleremains(__FILE__, __LINE__, GetCurrentThreadId(), sz, h, ph)
00126 
00127 
00128     extern boolean debugnewhandle (char * filename, unsigned long linenumber, unsigned long threadid, long, Handle *);
00129 
00130     extern boolean debugnewemptyhandle (char * filename, unsigned long linenumber, unsigned long threadid, Handle *);
00131 
00132     extern void disposehandle (Handle);
00133 
00134     extern boolean debugnewclearhandle (char * filename, unsigned long linenumber, unsigned long threadid, long, Handle *);
00135 
00136     extern boolean debugnewfilledhandle (char * filename, unsigned long linenumber, unsigned long threadid, ptrvoid, long, Handle *);
00137 
00138     #ifdef flnewfeatures
00139         extern boolean debugnewgrowinghandle (char * filename, unsigned long linenumber, unsigned long threadid, long, Handle *);
00140     #endif
00141 
00142     extern boolean debugcopyhandle (char * filename, unsigned long linenumber, unsigned long threadid, Handle, Handle *);
00143 
00144     extern boolean debugnewtexthandle (char * filename, unsigned long linenumber, unsigned long threadid, const bigstring, Handle *);
00145 
00146     extern boolean debugnewheapstring (char * filename, unsigned long linenumber, unsigned long threadid, const bigstring, hdlstring *);
00147 
00148     extern boolean debugconcathandles (char * filename, unsigned long linenumber, unsigned long threadid, Handle, Handle, Handle *);
00149 
00150     extern boolean debugmergehandles (char * filename, unsigned long linenumber, unsigned long threadid, Handle, Handle, Handle *);
00151 
00152     extern boolean debugunmergehandles (char * filename, unsigned long linenumber, unsigned long threadid, Handle, Handle *, Handle *);
00153 
00154     extern boolean debugnewintarray (char * filename, unsigned long linenumber, unsigned long threadid, short, hdlintarray *);
00155 
00156     extern boolean debugloadfromhandletohandle (char * filename, unsigned long linenumber, unsigned long threadid, Handle, long *, long, boolean, Handle *);
00157 
00158     extern boolean debugloadhandleremains  (char * filename, unsigned long linenumber, unsigned long threadid, long, Handle, Handle *);
00159 #endif
00160 
00161 
00162 extern boolean analyzeheap (void);
00163 
00164 extern boolean haveheapspace  (long);
00165 
00166 extern boolean testheapspace (long);
00167 
00168 extern void lockhandle (Handle);
00169 
00170 extern void unlockhandle (Handle);
00171 
00172 extern boolean validhandle (Handle);
00173 
00174 extern long gethandlesize (Handle);
00175 
00176 extern boolean sethandlesize (Handle, long);
00177 
00178 extern boolean minhandlesize (Handle, long);
00179 
00180 extern void moveleft (ptrvoid, ptrvoid, long);
00181 
00182 extern void moveright (ptrvoid, ptrvoid, long);
00183 
00184 extern void clearbytes (ptrvoid, long);
00185 
00186 extern void clearhandle (Handle);
00187 
00188 extern void movefromhandle (Handle, ptrvoid, long);
00189 
00190 #ifdef flnewfeatures
00191 
00192 extern boolean prepareforgrowing (Handle);
00193 
00194 #endif
00195 
00196 extern short comparehandles (Handle, Handle);
00197 
00198 extern boolean equalhandles (Handle, Handle);
00199 
00200 extern long searchhandle (Handle, Handle, long, long);
00201 
00202 extern long searchhandleunicase (Handle, Handle, long, long);
00203 
00204 extern boolean sethandlecontents (ptrvoid, long, Handle);
00205 
00206 extern void texttostring (ptrvoid, long, bigstring);
00207 
00208 extern void texthandletostring (Handle, bigstring);
00209 
00210 extern boolean insertinhandle (Handle, long, ptrvoid, long);
00211 
00212 extern boolean inserttextinhandle (Handle, long, bigstring);
00213 
00214 extern boolean inserthandleinhandle (Handle hinsert, Handle h, unsigned long ix);
00215 
00216 extern boolean pullfromhandle (Handle, long, long, ptrvoid);
00217 
00218 extern boolean enlargehandle (Handle, long, ptrvoid);
00219 
00220 extern boolean mungehandle (Handle, long, long, ptrvoid, long);
00221 
00222 extern boolean pushtexthandle (const bigstring, Handle);
00223 
00224 extern boolean pushindentedline (short, bigstring, Handle);
00225 
00226 extern boolean setheapstring (const bigstring, hdlstring);
00227 
00228 extern boolean pushhandle (Handle, Handle);
00229 
00230 extern boolean pushcharhandle (char, Handle);   /*2006-03-10 aradke*/
00231 
00232 extern boolean pushstringhandle (const bigstring, Handle);
00233 
00234 //extern boolean concatheapstrings (hdlstring *, hdlstring *, hdlstring *);
00235 
00236 extern boolean loadfromhandle (Handle, long *, long, ptrvoid);
00237 
00238 extern boolean pushlongondiskhandle (long, Handle);
00239 
00240 extern boolean loadlongfromdiskhandle (Handle, long *, long *);
00241 
00242 extern boolean popfromhandle  (Handle, long, ptrvoid);
00243 
00244 extern boolean copyhandlecontents (Handle, Handle);
00245 
00246 extern boolean setintarray (hdlintarray, short, short);
00247 
00248 extern boolean getintarray (hdlintarray, short, short *);
00249 
00250 extern void fillintarray (hdlintarray, short);
00251 
00252 extern void openhandlestream (Handle h, handlestream *s);
00253     
00254 extern boolean growhandlestream (handlestream *s, long ct);
00255     
00256 extern boolean writehandlestream (handlestream *s, void *p, long ct);
00257 
00258 extern boolean writehandlestreamlong (handlestream *s, long x); /*6.2a8 AR*/
00259 
00260 extern boolean writehandlestreamchar (handlestream *s, byte ch);
00261 
00262 extern boolean writehandlestreamstring (handlestream *s, bigstring bs);
00263     
00264 extern boolean writehandlestreamhandle (handlestream *s, Handle h);
00265 
00266 extern boolean writehandlestreamhandlepart (handlestream *s, Handle h, long ix, long len); /*2003-04-27 AR*/
00267 
00268 extern boolean writehandlestreamhandleindent (handlestream *s, Handle h, long i);
00269 
00270 extern boolean writehandlestreamstringindent (handlestream *s, bigstring bs, long i);
00271 
00272 extern boolean mergehandlestreamdata (handlestream *s, long ctreplace, ptrvoid pdata, long ctmerge);
00273 
00274 extern boolean mergehandlestreamhandle (handlestream *s, long ctreplace, Handle hmerge);
00275 
00276 extern boolean mergehandlestreamstring (handlestream *s, long ctreplace, bigstring bsmerge);
00277 
00278 extern boolean readhandlestream (handlestream *, void *, long);
00279 
00280 extern boolean pullfromhandlestream (handlestream *s, long ctpull, void *pdata);
00281 
00282 extern long skiphandlestreamchars (handlestream *s, byte chskip);
00283 
00284 extern boolean skiphandlestreamwhitespace (handlestream *);
00285 
00286 extern long seekhandlestreamchar (handlestream *s, byte chseek);
00287 
00288 extern boolean readhandlestreamfieldtohandle (handlestream *s, byte chdelimiter, Handle *hreturned);
00289 
00290 extern boolean readhandlestreamfield (handlestream *s, byte chdelimiter, bigstring bsfield);
00291     
00292 extern byte gethandlestreamcharacter (handlestream *s, long pos);
00293     
00294 extern byte nexthandlestreamcharacter (handlestream *s);
00295     
00296 extern byte lasthandlestreamcharacter (handlestream *s);
00297     
00298 extern boolean athandlestreameof (handlestream *s);
00299 
00300 extern Handle closehandlestream (handlestream *s);
00301 
00302 extern void disposehandlestream (handlestream *s);
00303 
00304 
00305 
00306 extern boolean initmemory (void);
00307 
00308 #endif
00309 
00310 
00311 

Generated on Wed May 31 18:19:55 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6