osainternal.h

Go to the documentation of this file.
00001 
00002 /*  $Id: osainternal.h 355 2005-01-11 22:48:55Z andreradke $    */
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 osainternalinclude
00029 #define osainternalinclude
00030 
00031 
00032 #ifndef __COMPONENTS__
00033     #include <Components.h>
00034 #endif
00035 
00036 #ifndef __OSA__
00037     #include <OSA.h>
00038 #endif
00039 
00040 #ifndef usertalkinclude
00041     #include <UserTalk.h>
00042 #endif
00043 
00044 #ifndef processinternalinclude
00045     #include "processinternal.h"
00046 #endif
00047 
00048 /*constants*/
00049 
00050 #define typeLAND 'LAND'
00051 
00052 #define componentlistnumber 512
00053 #define recordinglistnumber 513
00054 
00055 enum { /*recording strings*/
00056     
00057     frontierstring = 1,
00058     
00059     usertalkstring,
00060     
00061     scriptingcomponentstring,
00062     
00063     menusharingcomponentstring,
00064     
00065     windowsharingcomponentstring
00066     };
00067 
00068 
00069 /*types*/
00070 
00071 typedef pascal Boolean (*GNEProcPtr) (short, EventRecord *);
00072 
00073 typedef pascal void (*tyMSstringcallback) (Str255);
00074 
00075 typedef pascal void (*tyMSeventcallback) (EventRecord *);
00076 
00077 typedef pascal void (*tyMSmenuscallback) (hdlmenuarray);
00078 
00079 
00080 enum {
00081     uppGNEProcInfo = kPascalStackBased
00082          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
00083          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
00084          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(EventRecord*)))
00085 };
00086 
00087 enum {
00088     uppMSstringcallbackProcInfo = kPascalStackBased
00089          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(char *)))
00090 };
00091 
00092 enum {
00093     uppMSeventcallbackProcInfo = kPascalStackBased
00094          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(EventRecord*)))
00095 };
00096 
00097 enum {
00098     uppMSmenuscallbackProcInfo = kPascalStackBased
00099          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(hdlmenuarray)))
00100 };
00101 
00102 //Code change by Timothy Paustian Friday, June 16, 2000 1:32:41 PM
00103 //Changed to Opaque call for Carbon
00104 //Had to mask out the GENERATINGCFM directive. 
00105 #if TARGET_API_MAC_CARBON
00106     typedef GNEProcPtr GNEUPP;
00107     
00108     #define CallGNEProc(userRoutine, mask, theEvent)        \
00109             (*(userRoutine))((mask), (theEvent))
00110     #define NewGNEProc(userRoutine)     \
00111             (GNEUPP)(userRoutine)
00112     
00113     typedef tyMSstringcallback MSstringcallbackUPP;
00114     
00115     #define CallMSstringcallbackProc(userRoutine, theString)        \
00116             (*(userRoutine))((theString))
00117     #define NewMSstringcallbackProc(userRoutine)        \
00118             (MSstringcallbackUPP)(userRoutine)
00119     
00120     typedef tyMSeventcallback MSeventcallbackUPP;
00121     
00122     #define CallMSeventcallbackProc(userRoutine, theEvent)      \
00123             (*(userRoutine))((theEvent))
00124     #define NewMSeventcallbackProc(userRoutine)     \
00125             (MSeventcallbackUPP)(userRoutine)
00126     
00127     typedef tyMSmenuscallback MSmenuscallbackUPP;
00128     
00129     #define CallMSmenuscallbackProc(userRoutine, theMenus)      \
00130             (*(userRoutine))((theMenus))
00131     #define NewMSmenuscallbackProc(userRoutine)     \
00132             (MSmenuscallbackUPP)(userRoutine)
00133 #else
00134 #if GENERATINGCFM
00135 
00136     typedef UniversalProcPtr GNEUPP;
00137     
00138     #define CallGNEProc(userRoutine, mask, theEvent)        \
00139             CallUniversalProc((UniversalProcPtr)(userRoutine), uppGNEProcInfo, (mask), (theEvent))
00140     #define NewGNEProc(userRoutine)     \
00141             (GNEUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppGNEProcInfo, GetCurrentISA())
00142     
00143     typedef UniversalProcPtr MSstringcallbackUPP;
00144     
00145     #define CallMSstringcallbackProc(userRoutine, theString)        \
00146             CallUniversalProc((UniversalProcPtr)(userRoutine), uppMSstringcallbackProcInfo, (theString))
00147     #define NewMSstringcallbackProc(userRoutine)        \
00148             (MSstringcallbackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppMSstringcallbackProcInfo, GetCurrentISA())
00149     
00150     typedef UniversalProcPtr MSeventcallbackUPP;
00151     
00152     #define CallMSeventcallbackProc(userRoutine, theEvent)      \
00153             CallUniversalProc((UniversalProcPtr)(userRoutine), uppMSeventcallbackProcInfo, (theEvent))
00154     #define NewMSeventcallbackProc(userRoutine)     \
00155             (MSeventcallbackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppMSeventcallbackProcInfo, GetCurrentISA())
00156 
00157     typedef UniversalProcPtr MSmenuscallbackUPP;
00158     
00159     #define CallMSmenuscallbackProc(userRoutine, theMenus)      \
00160             CallUniversalProc((UniversalProcPtr)(userRoutine), uppMSmenuscallbackProcInfo, (theMenus))
00161     #define NewMSmenuscallbackProc(userRoutine)     \
00162             (MSmenuscallbackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppMSmenuscallbackProcInfo, GetCurrentISA())
00163 #else
00164 
00165     typedef GNEProcPtr GNEUPP;
00166     
00167     #define CallGNEProc(userRoutine, mask, theEvent)        \
00168             (*(userRoutine))((mask), (theEvent))
00169     #define NewGNEProc(userRoutine)     \
00170             (GNEUPP)(userRoutine)
00171     
00172     typedef tyMSstringcallback MSstringcallbackUPP;
00173     
00174     #define CallMSstringcallbackProc(userRoutine, theString)        \
00175             (*(userRoutine))((theString))
00176     #define NewMSstringcallbackProc(userRoutine)        \
00177             (MSstringcallbackUPP)(userRoutine)
00178     
00179     typedef tyMSeventcallback MSeventcallbackUPP;
00180     
00181     #define CallMSeventcallbackProc(userRoutine, theEvent)      \
00182             (*(userRoutine))((theEvent))
00183     #define NewMSeventcallbackProc(userRoutine)     \
00184             (MSeventcallbackUPP)(userRoutine)
00185     
00186     typedef tyMSmenuscallback MSmenuscallbackUPP;
00187     
00188     #define CallMSmenuscallbackProc(userRoutine, theMenus)      \
00189             (*(userRoutine))((theMenus))
00190     #define NewMSmenuscallbackProc(userRoutine)     \
00191             (MSmenuscallbackUPP)(userRoutine)
00192 #endif  //GENERATINGCFM
00193 #endif //TARGET_API_MAC_CARBON
00194 
00195 
00196 
00197 typedef struct tyMSglobals { /*Menu Sharing globals, all in one struct*/
00198 
00199     OSType serverid; /*identifier for shared menu server*/
00200 
00201     OSType clientid; /*id of this application*/
00202     
00203     hdlmenuarray hsharedmenus; /*data structure that holds shared menus*/
00204     
00205     Boolean fldirtysharedmenus; /*if true, menus are reloaded next time app comes to front*/
00206     
00207     Boolean flscriptcancelled; /*set true by calling CancelSharedScript*/
00208     
00209     Boolean flscriptrunning; /*true if a script is currently running*/
00210     
00211     Boolean flhavecomponentmanager; /*true if the Component Manager is present*/
00212     
00213     ComponentInstance serverinstance; /*if we have a Component Manager connection, this is it*/
00214     
00215     unsigned long timefirstrequest; /*5.0d19 dmb: keeps track of time of first requeste of new menus.*/
00216     
00217     unsigned long timelastformulacheck; /*5.0b6 dmb: so we don't checkformulas too often*/
00218     
00219     MSstringcallbackUPP scripterrorcallback; /*if non-nil, it's called when a script error occurs*/
00220     
00221     MSeventcallbackUPP eventfiltercallback; /*if non-nil, it's called w/an event while script runs*/
00222     
00223     MSmenuscallbackUPP installmenuscallback; /*4.1b4 dmb: if non-nil, it's called to install the shared menus*/
00224     
00225     MSmenuscallbackUPP removemenuscallback; /*4.1b4 dmb: if non-nil, it's called to remove the shared menus*/
00226     
00227     long idscript; /*the server's id for the currently running script, makes it easy to kill it*/
00228     } tyMSglobals, *ptrMSglobals, **hdlMSglobals;
00229 
00230 
00231 typedef struct tyrecordingstate { /*maintain info about recording in progress*/
00232     
00233     boolean flrecording;
00234     
00235     OSType lastappid;
00236     
00237     hdlhashtable lastapptable;
00238     
00239     Handle hrecordedtext;
00240     } tyrecordingstate;
00241 
00242 #ifdef dropletcomponent
00243 
00244 typedef struct tydropletglobals { /*droplet application globals*/
00245     
00246     DialogPtr pmainwindow;
00247     
00248     MenuHandle happlemenu, hfilemenu;
00249     
00250     boolean flexitmainloop;
00251     
00252     AppleEvent initialevent;
00253     } tydropletglobals;
00254 
00255 #endif
00256 
00257 typedef struct tycomponentglobals { /*a place to store your globals safely*/
00258     
00259     struct tycomponentglobals **hnext; /*for linked list*/
00260     
00261     struct tycomponentglobals **hserverosaglobals; /*for nesting*/
00262     
00263     short ctpushes; /*also for nesting*/
00264     
00265     Component self;
00266     
00267     Boolean isHomeProcess;
00268     
00269     long clienta5;
00270     
00271     THz clientzone;
00272     
00273     short clientresfile;
00274     
00275     Handle clientresmaphandle;
00276     
00277     OSType clientid;
00278     
00279     ProcessSerialNumber clientpsn;
00280     
00281     long idcounter;
00282     
00283     hdlhashtable storagetable;
00284     
00285     AEDesc errordesc;
00286 
00287     GNEUPP getnexteventproc;
00288     
00289     OSAActiveUPP activeproc;
00290     
00291     OSACreateAppleEventUPP createproc;
00292     
00293     OSASendUPP sendproc;
00294     
00295     AEEventHandlerUPP resumedispatchproc;
00296     
00297     OSADebugUPP debugproc;
00298     
00299     long activeprocrefcon;
00300     
00301     long createprocrefcon;
00302     
00303     long sendprocrefcon;
00304     
00305     long resumedispatchprocrefcon;
00306     
00307     long debugprocrefcon;
00308     
00309     hdltreenode debugnode;
00310     
00311     hdlthreadglobals clientthreadglobals;
00312     
00313     hdlthreadglobals serverthreadglobals;
00314     
00315     tyMSglobals menusharingglobals;
00316     
00317     #ifdef dropletcomponent
00318     
00319     tydropletglobals dropletglobals;
00320     
00321     #endif
00322     
00323     tyrecordingstate recordingstate;
00324     //Code change by Timothy Paustian Sunday, September 3, 2000 9:56:14 PM
00325     //These are dynamic and each component needs its own set of UPPs that cannot
00326     //be shared. So put them here.
00327     #if TARGET_API_MAC_CARBON
00328     ComponentRoutineUPP cmpcloseUPP;
00329     ComponentRoutineUPP cmpcandoUPP;
00330     ComponentRoutineUPP cmpversionUPP;
00331     ComponentRoutineUPP osaLoadUPP;
00332     ComponentRoutineUPP osaStoreUPP;
00333     ComponentRoutineUPP osaExecuteUPP;
00334     ComponentRoutineUPP osaDisplayUPP;
00335     ComponentRoutineUPP osaScriptErrorUPP;
00336     ComponentRoutineUPP osaDisposeUPP;
00337     ComponentRoutineUPP osaSetScriptInfoUPP;
00338     ComponentRoutineUPP osaGetScriptInfoUPP;
00339     ComponentRoutineUPP osaCompileUPP;
00340     ComponentRoutineUPP osaGetSourceUPP;
00341     ComponentRoutineUPP osaCoerceFromDescUPP;
00342     ComponentRoutineUPP osaCoerceToDescUPP;
00343     ComponentRoutineUPP osaStartRecordingUPP;
00344     ComponentRoutineUPP osaStopRecordingUPP;
00345     ComponentRoutineUPP osaScriptingComponentNameUPP;
00346     ComponentRoutineUPP osaLoadExecuteUPP;
00347     ComponentRoutineUPP osaCompileExecuteUPP;
00348     ComponentRoutineUPP osaDoScriptUPP;
00349     ComponentRoutineUPP osaMakeContextUPP;
00350     ComponentRoutineUPP osaSetResumeDispatchProcUPP;
00351     ComponentRoutineUPP osaGetResumeDispatchProcUPP;
00352     ComponentRoutineUPP osaExecuteEventUPP;
00353     ComponentRoutineUPP osaDoEventUPP;
00354     ComponentRoutineUPP osaSetActiveProcUPP;
00355     ComponentRoutineUPP osaSetDebugProcUPP;
00356     ComponentRoutineUPP osaDebugUPP;
00357     ComponentRoutineUPP osaSetSendProcUPP;
00358     ComponentRoutineUPP osaGetSendProcUPP;
00359     ComponentRoutineUPP osaSetCreateProcUPP;
00360     ComponentRoutineUPP osaGetCreateProcUPP;
00361     #endif
00362     } tycomponentglobals, **hdlcomponentglobals;
00363 
00364 
00365 typedef pascal ComponentResult (*ComponentRoutine) (ComponentParameters *, Handle);
00366 
00367 
00368 /*globals*/
00369 
00370 extern hdlcomponentglobals osaglobals;
00371 
00372 extern boolean flosashutdown;
00373 
00374 
00375 /*prototypes*/
00376 
00377 extern void disposecomponentglobals (hdlcomponentglobals);
00378 
00379 extern boolean newcomponentglobals (Component, long, hdlcomponentglobals *);
00380 
00381 extern pascal OSAError osaScriptError (hdlcomponentglobals, OSType, DescType, AEDesc*);
00382 
00383 extern pascal ComponentResult callosafunction (Handle, ComponentParameters *, ComponentFunctionUPP);
00384 
00385 extern long osapreclientcallback (hdlcomponentglobals); /*osacomponent.c*/
00386 
00387 extern void osapostclientcallback (hdlcomponentglobals);
00388 
00389 extern GNEUPP osainstallpatch (hdlcomponentglobals);
00390 
00391 extern void osaremovepatch (hdlcomponentglobals, GNEUPP);
00392 
00393 extern boolean getprocessname (ProcessSerialNumber, bigstring, boolean *);
00394 
00395 extern void closeosaservers (void);
00396 
00397 extern Component osaregistercomponent (OSType, long, ComponentRoutine, short, short);
00398 
00399 #endif
00400 
00401 
00402 
00403 
00404 
00405 

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