standard.h

Go to the documentation of this file.
00001 
00002 /*  $Id: standard.h 1328 2006-04-24 20:02:59Z sethdill $    */
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 /*
00029 standard.h -- standard types and constants
00030 */
00031 
00032 #ifndef standardinclude
00033 #define standardinclude /*so other modules can tell that we've been included*/
00034 
00035 #ifdef WIN95VERSION
00036     #include "macconv.h"
00037 #endif
00038 
00039 #ifdef MACVERSION  /* 2005-01-09 SMD - for getmilliseconds */
00040     #include "FastTimes.h"
00041 #endif
00042 
00043 #include "stringdefs.h"     /* embedded string definitions */
00044 
00045 #ifndef appletdefsinclude
00046 
00047 #define appletdefsinclude
00048 
00049 #ifdef MPWC
00050 
00051     #define SystemSevenOrLater 1
00052     /* A/UX is case sensitive, so use correct case for include file names */
00053     #include <values.h>
00054     #include <types.h>
00055     #include <quickdraw.h>
00056     #include <fonts.h>
00057     #include <events.h>
00058     #include <controls.h>
00059     #include <windows.h>
00060     #include <menus.h>
00061     #include <textedit.h>
00062     #include <resources.h>
00063     #include <dialogs.h>
00064     #include <desk.h>
00065     #include <scrap.h>
00066     #include <toolutils.h>
00067     //MW must add LowMem for certain functions (see notes).
00068     #include <LowMem.h>
00069     #include <segload.h>
00070     #include <memory.h>
00071     #include <packages.h>
00072 
00073 #endif
00074 
00075 
00076 
00077 /*constants*/
00078 
00079 #ifndef ctdirections
00080     
00081     typedef enum tydirection {
00082         
00083         nodirection = 0, 
00084         
00085         up = 1, 
00086         
00087         down = 2, 
00088         
00089         left = 3,
00090         
00091         right = 4, 
00092         
00093         flatup = 5, 
00094         
00095         flatdown = 6, 
00096         
00097         sorted = 8,
00098         
00099         pageup = 9,
00100         
00101         pagedown = 10,
00102         
00103         pageleft = 11,
00104         
00105         pageright = 12
00106         } tydirection;
00107     
00108     #define ctdirections 12 /*for arrays indexed on directions*/
00109 
00110 #endif
00111 
00112 typedef enum tybitdirection {
00113     
00114     upbit = 0x01, 
00115     
00116     downbit = 0x02, 
00117     
00118     leftbit = 0x04, 
00119     
00120     rightbit = 0x08
00121     } tybitdirection;
00122 
00123 
00124 typedef enum tylinespacing {
00125     
00126     singlespaced = 1,
00127     
00128     oneandalittlespaced = 2,
00129     
00130     oneandaquarterspaced = 3,
00131     
00132     oneandahalfspaced = 4,
00133     
00134     doublespaced = 5,
00135     
00136     triplespaced = 6
00137     } tylinespacing;
00138     
00139 
00140 typedef enum tyjustification {
00141     
00142     leftjustified, 
00143     
00144     centerjustified, 
00145     
00146     rightjustified,
00147     
00148     fulljustified,
00149     
00150     unknownjustification
00151     } tyjustification;
00152     
00153 
00154 #define true 1
00155 #define false 0
00156 
00157 #define infinity 32767
00158 #define longinfinity (long)0x7FFFFFFF
00159 #define intinfinity 32767
00160 #define intminusinfinity -32768
00161 
00162 #define emptystring (ptrstring) "\0"
00163 
00164 #define chnul           ((char) 0)
00165 #define chbacktab       ((char) 0)
00166 #define chhome          ((char) 1)
00167 #define chenter         ((char) 3)
00168 #define chend           ((char) 4)
00169 #define chhelp          ((char) 5)
00170 #define chbackspace     ((char) 8) 
00171 #define chtab           ((char) 9)
00172 #define chlinefeed      ((char) 10)
00173 #define chpageup        ((char) 11)
00174 #define chpagedown      ((char) 12)
00175 #define chreturn        ((char) 13)
00176 #define chescape        ((char) 27)
00177 #define chrightarrow    ((char) 29)
00178 #define chleftarrow     ((char) 28)
00179 #define chuparrow       ((char) 30)
00180 #define chdownarrow     ((char) 31)
00181 #define chsinglequote   ((char) 39)
00182 #define chdoublequote   ((char) 34)
00183 #define chspace         ((char) 32)
00184 #define chdelete        ((char) 127)
00185 
00186 #ifdef MACVERSION
00187     #define chcomment           ((byte) 0xc7)   /* '' */
00188     #define chendcomment        ((byte) 0xc8)   /* '' */
00189     #define chopencurlyquote    ((byte) 0xd2)   /* '' */
00190     #define chclosecurlyquote   ((byte) 0xd3)   /* '' */
00191     #define chtrademark         ((byte) 0xaa)   /* '' */
00192     #define chnotequals         ((byte) 0xad)   /* '' */
00193     #define chdivide            ((byte) 0xd6)   /* '' */
00194 #endif
00195 
00196 #ifdef WIN95VERSION
00197     #define chcomment           ((byte) 0xab)   /* '' */
00198     #define chendcomment        ((byte) 0xbb)
00199     #define chopencurlyquote    ((byte) 0x93)
00200     #define chclosecurlyquote   ((byte) 0x94)
00201     #define chtrademark         ((byte) 0x99)
00202     #define chnotequals         ((byte) 0xad)   /* '' */
00203     #define chdivide            ((byte) 0xf7)   /* '' */
00204 #endif
00205 
00206 
00207 #ifdef WIN95VERSION
00208 typedef unsigned char Str255[258];
00209 #endif
00210 
00211 #define lenbigstring 255
00212    
00213 #define sizegrowicon 15 /*it's square, this is the length of each side*/
00214  
00215 #define dragscreenmargin 4 /*for dragging windows, leave this many pixels on all sides*/
00216 
00217 #define doctitlebarheight 18 /*number of pixels in the title bar of each standard window*/
00218 
00219 /*#define nil 0L*/
00220 
00221 #define private static /*use "private" when a value or routine should not be seen outside the file it appears in*/
00222 
00223 
00224 /*types*/
00225 
00226 #define bigstring Str255
00227 
00228 #ifndef __RPCNDR_H__
00229 
00230     typedef unsigned char boolean;
00231 
00232 #endif
00233 
00234 typedef unsigned char *ptrstring, **hdlstring;
00235 
00236 typedef void * ptrvoid;
00237 
00238 typedef char *ptrchar;
00239 
00240 typedef short *ptrint;
00241 
00242 typedef RgnHandle hdlregion;
00243 
00244 typedef const Rect *rectparam;
00245 
00246 typedef Rect *ptrrect;
00247 
00248 typedef boolean (*callback) (void); /* 2004-10-24 aradke: was ... instead of void on Mac */
00249 
00250 #if defined(__RPCNDR_H_VERSION__)
00251 typedef unsigned char *ptrbyte; /* 2004-12-29 trt: byte defined by Win32 rpcndr.h */
00252 #else
00253 typedef unsigned char byte, *ptrbyte;   
00254 #endif
00255 
00256 
00257 /*macros*/
00258 
00259 #undef verify
00260 
00261 #ifdef NDEBUG
00262     #define verify(x)   ((void) x)
00263 #else
00264     #define verify(x)   assert(x)
00265 #endif
00266 
00267 #ifdef MACVERSION
00268     #define sysbeep() SysBeep(1) 
00269 #endif
00270 
00271 #ifdef WIN95VERSION
00272     //#define sysbeep() Beep (800, 300)
00273     #define sysbeep() MessageBeep(MB_OK)
00274 #endif
00275 
00276 #ifndef abs
00277     #define abs(x) ((x) < 0? -(x) : (x))
00278 #endif
00279 
00280 #define odd(x) ((x) & 0x0001)
00281 
00282 #define even(x) (!odd (x))
00283 
00284 #ifndef max
00285 #define max(x,y) ((x) > (y)? (x) : (y))
00286 #endif
00287 
00288 #ifndef min
00289 #define min(x,y) ((x) < (y)? (x) : (y))
00290 #endif
00291 
00292 #define sgn(x) ((x) < 0? -1 : ((x) > 0? 1 : 0))
00293 
00294 #define loword(x) ((x) & 0x0000ffff)
00295 #define hiword(x) ((x) >> 16)
00296 #define makelong(lo, hi) ((hi) << 16 | (lo))
00297 #define diskwordstomemlong(lo, hi) makelong(conditionalshortswap(lo), conditionalshortswap(hi))
00298 #define memlongtodiskwords(x, lo, hi) do { \
00299                             lo = conditionalshortswap (loword (x)); \
00300                             hi = conditionalshortswap (hiword (x));} while (0)
00301 
00302 #ifdef PASCALSTRINGVERSION
00303 #ifdef WIN95VERSION
00304 char * pwstringbaseaddress(char * bs);
00305 void pwsetstringlength(char * bs, short len);
00306 #endif
00307 
00308 #define stringbaseaddress(bs) (bs+1)
00309 #define setstringlength(bs,len) (bs[0]=(char)(len))
00310 #define stringlength(bs) ((unsigned char)(bs)[0])
00311 #define setstringwithchar(ch,bs) {bs[0]=1;bs[1]=(ch);}
00312 #define getstringcharacter(bs,pos) bs[(pos)+1]
00313 #define setstringcharacter(bs,pos,ch) {bs[(pos)+1] = (ch);}
00314 #define stringsize(bs) (stringlength (bs) + 1)
00315 #define lastchar(bs) (bs [stringlength (bs)])
00316 #endif
00317 
00318 #ifdef CSTRINGVERSION
00319 #define stringbaseaddress(bs) (bs)
00320 #define stringlength(bs) (strlen(bs))
00321 #define stringsize(bs) (stringlength (bs) + 1)
00322 #define setstringlength(bs,len) (bs[len]=0)
00323 #define setstringwithchar(ch,bs) {bs[1]=0;bs[0]=ch;}
00324 #define getstringcharacter(bs,pos) bs[pos]
00325 #define setstringcharacter(bs,pos,ch) {bs[pos] = ch;}
00326 #define lastchar(bs) (bs [stringlength (bs)-1])
00327 #endif
00328 
00329 #define BIGSTRING(s) ((unsigned char *)(s))
00330 
00331 #define setemptystring(bs) (setstringlength(bs,0))
00332 
00333 #define isemptystring(bs) (stringlength(bs)==0)
00334 
00335 #define isemptyrect(r) (((r).bottom <= (r).top) || ((r).right <= (r).left))
00336 
00337 #define bitboolean(fl) ((fl)?true:false)
00338 
00339 #define ouchreturn {ouch ();return(false);}
00340 
00341 #define optiondebug {if(optionkeydown())Debugger();}
00342 
00343 #define longsizeof(x) (long)sizeof(x)
00344 
00345 #define bundle 
00346 
00347 #ifdef MACVERSION
00348 #define gettickcount() TickCount()
00349 
00350 typedef short hdlfilenum;
00351 
00352 typedef Pattern xppattern;
00353 #endif
00354 
00355 #ifdef WIN95VERSION
00356 typedef HANDLE hdlfilenum;
00357 
00358 typedef HBRUSH xppattern;
00359 
00360 #define gettickcount() ((GetTickCount()*3L)/50L)
00361 
00362 boolean appendcstring (bigstring dest, char * cstringsource);
00363 boolean buildfilename (unsigned char * pathsource, short pathtype, unsigned char * filesource, short filetype, char * dest);
00364 
00365 void NumToString (long theNum, char * theString);
00366 void StringToNum (char * theString, long * theNum);
00367 
00368 typedef long double double_t;
00369 
00370 typedef struct tydecform
00371     {
00372     char style;
00373     char unused;
00374     short digits;
00375     } decform;
00376 
00377 #define SIGDIGLEN 36
00378 typedef struct tydecimal
00379     {
00380     char sgn;
00381     char unused;
00382     short exp;
00383     struct
00384         {
00385         unsigned char length;
00386         unsigned char text[SIGDIGLEN];
00387         unsigned char unused;
00388         } sig;
00389     } decimal;
00390 
00391 
00392 typedef struct tyDateTimeRec
00393     {
00394     short year;
00395     short month;
00396     short day;
00397     short hour;
00398     short minute;
00399     short second;
00400     short dayOfWeek;
00401     } DateTimeRec;
00402 
00403 typedef union tyLongDateRec
00404     {
00405     struct
00406         {
00407         short era;
00408         short year;
00409         short month;
00410         short day;
00411         short hour;
00412         short minute;
00413         short second;
00414         short dayOfWeek;
00415         short dayOfYear;
00416         short weekOfYear;
00417         short pm;
00418         short res1;
00419         short res2;
00420         short res3;
00421         }   ld;
00422     short   list[14];
00423     struct
00424         {
00425         short   eraAlt;
00426         DateTimeRec oldDate;
00427         }   od;
00428     } LongDateRec;
00429 
00430 typedef struct tyDateCacheRecord
00431     {
00432     short   hidden[256];
00433     } DateCacheRecord;
00434 #endif
00435 
00436 #define isnumeric(x) ((x >= '0') && (x <= '9'))
00437 
00438 #define quickdrawglobal(x) qd.x
00439 
00440 extern boolean flcominitialized; /* set up in lang.c */
00441 extern boolean initCOM( void ); /* see FrontierWinMain.c */
00442 extern void shutdownCOM( void );
00443 
00444 #endif
00445 
00446 #endif
00447 
00448 
00449 

Generated on Wed May 31 18:20:02 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6