/* Copyright 1997 Acorn Computers Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /***************************************************/ /* File : Global.c */ /* */ /* Purpose: Holds all of the browser's globals. */ /* */ /* Author : A.D.Hodgkinson */ /* */ /* History: 12-Nov-96: Created. */ /***************************************************/ #include "setjmp.h" #include "wimp.h" #include "event.h" #include "svcprint.h" #include "Global.h" #include "Utils.h" #ifdef TRACE /********************************************************/ /* Trace level, for debug purposes only. */ /* */ /* All trace output is done through the Printf function */ /* which has an identical API to printf. This is */ /* commonly used for TML card output but any debug */ /* library can be linked in provided it provides the */ /* Printf interface. */ /* */ /* Some debug output takes advantage of 16 colour modes */ /* on the debug machine and sends VDU codes to change */ /* the text colour. This may influence the approach */ /* taken if authoring an alternative debugging library. */ /* */ /* Debug output is only available if the entire project */ /* is compiled with TRACE defined in the compiler. */ /* */ /* Some extra error messages (such as missing component */ /* IDs) will be raised in TRACE builds. Even more may */ /* be raised by defining STRICT_PARSER in the compiler; */ /* this ensures any image processing errors are */ /* reported and (e.g.) badly nested framesets will */ /* generate an appropriate complaint. STRICT_PARSER */ /* browser-owned errors are defined in the Messages */ /* file; TRACE errors are hard coded. */ /* */ /* Bit Purpose Arg Value */ /* */ /* 0 MessageTrans related messages MsgT 1 */ /* 1 Toolbar handler messages TBar 2 */ /* 2 Null claim/release messages Null 4 */ /* 3 Browser window created/deleted Wind 8 */ /* 4 Menu handler messages Menu 16 */ /* 5 Routine start, poll, exit Rout 32 */ /* 6 Fetcher functions Fetc 64 */ /* 7 Memory handling function calls Memo 128 */ /* 8 Reformatter functions Refo 256 */ /* 9 Redraw functions Redr 512 */ /* 10 Font library functions Font 1024 */ /* 11 Bounding box info for redraws BBox 2048 */ /* 12 Low level memory tracing LMem 4096 */ /* 13 Running malloc/free count CMal 8192 */ /* 14 Running flex alloc/free count CFle 16384 */ /* 15 Image handling code Imag 32768 */ /* 16 History (local and global) Hist 65536 */ /* 17 Frames Fram 131072 */ /* 18 Stream and memcpy/memmove trace Stre 262144 */ /* 19 Indications of special tags Circ 524288 */ /* 20 Table parsing information Tabl 1048576 */ /* 21 URI handler interfacing URIH 2097152 */ /* 22 Keyboard control functions KeyC 4194304 */ /* 23 Redraw rectangle display RBox 8388608 */ /* 24 JavaScript functinos JScr 16777216 */ /* 25 Hotlist manager Hotl 33554432 */ /* 26 Save functions Save 67108864 */ /* */ /* To use, put -debug or -d into the command line args */ /* for running !RunImage, followed by a series of comma */ /* separated values which are as given above. Use 'All' */ /* for everything, though with caution (large amounts */ /* of output will be generated!). For example: */ /* */ /* Run !RunImage -d MsgT,Menu,Rout %%*0 */ /********************************************************/ unsigned int tl; int malloccount; int flexcount = 0; #endif jmp_buf env; /* Used for error handler, so it can jump back to poll look if */ /* the user selects OK rather than Cancel */ int quit; /* Set to 1 to indicate a successful exit should occur */ int modechanged; /* Set to 1 immediately after a mode change */ int printing; /* Set to 1 during a printing loop, else 0 */ int printer_message_ref; /* Set when a PrintSave is send, so DataSaveAck is recognised */ int drag_in_progress; /* Somebody somewhere in the browser is doing a drag operation */ int authorising; /* Set to 1 during authorisation of a fetch (all fetches stop) */ int wimp_version; int nested_wimp; /* Wimp version, flag to say the nested window manager is */ int task_handle; /* present, Wimp task handle, pointer to sprite block. */ int sprite_block; int taskmodule_ds_registered; /* Set to 1 if the dialler status service call is being watched */ int uri_module_present; /* Set to 1 if the URI module is present and may be used */ MessagesFD meb; /* MessageTrans Messages file control block */ MessagesFD * chb; /* MessageTrans Choices file control block */ char tokens [Limits_Message]; /* lookup_token/choice puts looked up data in here */ char lasttokn [Limits_Token]; /* The last token looked up is stored here for future reference */ int messages_list [] = {0}; IdBlock idb; /* For all Toolbox-registered event handlers */ int event_code_list [] = {0}; WimpPollBlock b; /* For Toolbox-registered Wimp event handlers */ int null_counter; /* When zero, null events will be disabled, else enabled. For */ /* each time something wants to claim nulls, it increments this */ /* and decrements it when finished */ int bullets; /* Number of bullet sprites available */ unsigned int animation_frames; /* Holds the number of animation frames in the Sprites file */ browser_data * last_browser; /* Points to the last browser_data structure in the linked list */ /* of structures associated with all browser windows, or NULL */ /* there are no browser windows. The structure is defined in */ /* Global.h */ browser_data * highlight_frame = NULL; /* The currently highlighted frame (if any) */ global_choices choices; /* To store [temporary] global choices (from the Choices file) */ fixed_choices fixed; /* To store fixed choices (from the Messages file) */ char program_name[Limits_TaskName]; /* _TaskName token contents put in here, for the flex library */ _kernel_oserror erb; /* Global error block for custom errors */ menu_source menusrc = Menu_None; /* For Wimp menus - opened from forms, from history icons, etc. */ void * menuhdl; /* For any extra info needed with a menu */ #ifndef SINGLE_USER userdef user; /* For multiuser builds, holds details of the current user */ #endif