appinit001013.gif
appinit001013.gif
DrWimpC Program Initialisation.
3. The User Wimp Data Structure Continued.
wimp_i info_name;
wimp_i info_purpose;
wimp_i info_author;
wimp_i info_version;
wimp_i info_website;
wimp_i save_fileiconno;
wimp_i save_filenameiconno;
wimp_i save_ok_iconno;
DrWimpC makes use of icon names to remove the reliance on icon numbers that limit the editableness of templates due to the possible renumbering of icons which could break applications testing for icon numbers. To implement this in the standard Info Box and Save Box templates names are supplied for the icons in these templates. However, as those templates are local to the application only leaf names are used. When loading these templates into an application at application start the DrWimpC library tests for the presence of these icons by name and assigns the fileds above to the icon number they have at run time for their corresponding fields in the templates. They are initially set to (wimp_i) -1.
drw_uw_flags flags;
drw_uw_flags2 flags2;
These two flag words are placed in the user wimp data structure for the convenience of the DrwimpC library.
Most flags are set or cleared according to the values of the Options and compiler dialogues with some flags being stored in the dcdefaults and ccdefaults files.

char appdirname[drw_appname_len];
This field holfd the leaf name of the application as entered in the new application dialogue. It is read and written from/to the dcdefaults file by the DrWimpC library at application start up and is expected to be correct and match the actual application name..
void *appdata;
This is an application supplied field. You can use it to hold a handle to an application defined structure that can be passed to function's in source files other than the one where the structure is declared. The contents of the user wimp data structure is always available using the pointer in the standard wimp data structure. (The header file drwUxdata has one entry in it - extern drw_wimp_data *pwd; Include this file to gain access too the standard wimp data structure, then the user wimp data structure pointer (pwd->uwd). You can then access your application's data structure from as pwd->uwd->appdata, by declaring a local variable as a pointer to the data structure and casting the appdata pointer to its type.

  1. g. my_app_data *myappdataptr = (my_app_data *) pwd->uwd->appdata;
wimp_message_list *messages;
A user defined, zero terminated list of messages of interest to your application. They are added to the applicarion's existing list of messages it wats to receive from the wimp by pasing the list to swi Wimp_Initialise. The field is initially set to NULL which indicates to the wimp that no messages are of interest to your application. (The message_QUIT mesage (number 0) is always sent to your application). An empty list containing just the one element set to 0 indicates that you want all messages that can be received by your application to be sent to it.

Any other valid list will result in just those messages inthe list bwing sent to your application. You can adjust the list
during the application's lifetime by calling swi wimp_add_messages to add additional messages and swi wimp_remove_messages to remove messages from the list.
int waitforeditor;
A fudge field to the extent that it caters for !Zap using the redraw module. In order for the external edit of source files to work correctly iwth !Zap when adding a new function at the end of a source file it is necessary to wait until !Zap finishes the redraw of the window for the external edit and only then send the data for the new function to !Zap.
This field allows the length of the wait time to be adjusted. The default is 200. This seems to work on most systems but is dependent on the speed of a particular system so this field may need adjusting so that a new function definition is correctly added at the end of the source file and not the beginning whcihc can happen if the data for the new function is sent to !Zap too soon.
char *datahandle;
Not used in this release of DrWimpC App Builder. Should be left as 'NULL'.
void *localconv;
The pointer value returned by the call to localeconv made during DrWimpC library initialisation.
char *ccflags;
char *gccflags;
char *ccwarnings;
char *gccwarnings;
char *linkflags;
char *drlinkflags;
char *libfileflags;
char *gnulibfileflags;
char *squeezeflags;
These flags are specified in the DevOpts and Compiler Defaults dialogues and stored in the ccdefaults file and read and used prior to a compilation to build the make file for the compilation
osspriteop_area *mainwsprites;
Not currently used.
territory_t tno;
Used. to indicate the current territory in use both by DrWimpC App Builder and at run time by the DrWimpC library.
void *mainwdata;
Not currently used.
char *mwsprfile;
Not currently used.
int argc;
char **argv;
The application argument list, and number of arguments, from the call to drw_app().
int numfntypes;
The number of template function types in use in DrWimpC App Builder when the application was last compiled. Should have a value not less than 202.
char *fullappdirname;
Pointer to the full path name to the application (The full path minus the !<appname> part).
int extedit_retry_l;imit;
int ole_retry_limit;
While starting an external or ole edit DrWimpC uses null events to periodically scan for the edit window appearing in the window stack..In case there is an unexpected problem, these limits ensure that DrWimpC App Builder will eventually stop scanning for the window and stop using null events so avoiding unnecessary cpu and resource usage.
drw_ll_hdr resvsns;
char thisvsnstr[drw_version_str_size];
At one stage I tried to allow multiple versions of resource files such as message files, template files and menu definition files ro be associated with a template code library version but this turned out to be too complex to maintain easily. So I removed the feature but retained the fields in case I could revive the facility in some form.
int somexpire;
The default expire time for running shared libraries is 30 minutes. When developing shared template code libraries you might want to compile and test a new version of a running library and so want it to expire much sooner than 30 minutes after the last application using it has quit. The idea of this field is that on startup DrwimpC App Builder will issue a *SOMExpire command if this value is non zero (positive) in the DrWimpC App Builder dcdefaults file.The smallest time to expire that can be set is 1 minute. An alternative is to edit the SOmFirstRun obey file inside your !Sharedlibs directory and place the SOMExpire command before the SOMRun command.
4. The dcdefaults file.
For each application DrWimpC App Builder stores various options set using the NewApp and Options dialogues in the dcdefaults file which is stored in the Defaults sub directoryinside the main application directory. The DrWimpC library reads this file when it loads an application and sets various values in the use wimp data structure from the values in the dcdefaults file. Currently there are 28 default values stored as a token value pair in the form DRWDEF<n>:value where 1<=n<=28. Flag values are held as 0=FALSE, 1=TRUE. The tables are shown below with their default values followed by their user wimp data names and their default number as enum definitions from drwwh.h -:
Items marked (in flags) are flag values in drw_uw_flags (defined in drwwh.h) and set/unset in the user wimp data flags word.

Items marked (in flags2) are flag values in drw_uw_flags2 (defined in drw_uw_flags2 and set/unset in the user wimp data flags2 word.
DRWDEF1:1024
DRWDEF2:Resources
DRWDEF3:1024
DRWDEF4:
DRWDEF5:0
DRWDEF6:0
DRWDEF7:300
DRWDEF8:
DRWDEF9:1
DRWDEF10:1
DRWDEF11:
DRWDEF12:0
DRWDEF13:1
DRWDEF14:1
DRWDEF15:1
DRWDEF16:1
DRWDEF17:2000
DRWDEF18:NULL
DRWDEF19:20000
DRWDEF20:200
DRWDEF21:0
DRWDEF22:202
DRWDEF23:0
DRWDEF24:0
DRWDEF25:1
DRWDEF26:0
DRWDEF27:0
DRWDEF28:Your Apps Name
memforwimpblock
appresdir
maxobjsize
appresdirprefix
nolongerused1
savedesktopflag
version_in
appsyntax
drw_hasibaricon (in flags)
drw_ibariconlhs (in flags)
ibartext
ibarmaxlen
drw_use_terrname (in flags)
drw_useterrno (in flags)
drw_noopenappmsgfile (when 0) (in flags)
drw_nolibmsgfile (when 0) (in flags)
waitforeditor
datahandle
extedit_retry_limit
ole_retry_limit
drw_force_build_appn (in flags)
numfntypes
drw_is_runtime (in flags2)
drw_is_local_app (in flags2)
somexpire
NONE
NONE
appdirname
drwimpc_memforwimpblock = 1
drwimpc_appresdir = 2
drwimpc-maxobjsize = 3
drwimpc_appresdirprefix = 4
drwimpc_nolongerused1 = 5
drwimpc_savedesktopflag = 6
drwimpc_wimp_version = 7
drwimpc_appn_syntax_str = 8
drwimpc_has_ibaricon = 9
drwimpc_ibar_leftside = 10
drwimpc_ibartext = 11
drwimpc_ibarmaxlen = 12
drwimpc_use_terrname = 13
drwimpc_use_terrno = 14
drwimpc_open_appmsgs = 15
drwimpc_use_libmsgfile = 16
drwimpc_editor_delay = 17
drwimpc_datahandle = 18
drwimpc_edit_retries = 19
drwimpc_ole_retries = 20
drwimpc_force_build_appn = 21
drwimpc_num_fntypes = 22
drwimpc_is_runtime = 23
drwimpc_is_local = 24
drwimpc_som_expire = 25
drwimpc_rsvd_def4 = 26
drwimpc_rsvd_def5 = 27
drwimpc_appdirname = 28
Notes:
DrWimpC library automatically searches for an application messages file named 'Messages'. Setting DRWDEF15
(drw_noopenappmsgfile) will prvent that. Similarly, the DrWimpC uses a message file called libmsgs for is internal messages. Setting DRWDEF16 (drw_nolibmsgfile) will cause DrWimpC library not to search for a libmsgs file in the application resources but use its internal array of messages. The numfntypes default (DRWDEF22) is expected to have a minimum value of 202. The drw_is_runtime flag (DRWDEF23) is set by DrWimpC App Builder when an application distribution is built using the Distribution dialogue (available from the Projects Distribution button). This causes some project options only applicable to developing an application to be greyed out, and DrWimpC App Builder will not create any default files only applicable to a develpoment version of the application when the application is loaded into DrWimpC. In this way users can still edit such things as Defined Menus, Templates and Shortcuts that are not source code dependent. While not as vital as it used to be for correct working, the appname (DRWDEF28) is still expected to be present, and correctly set to the leaf name of the application. So, if you rename your application you should edit the dcdefaults file to update DRWDEF28 to the new name.
5. The ccdefaults file.
For each application DrWimpC App Builder stores compiler options specified in the DevOpts and Compiler defaults dialogues in the ccdefaults file inside the Defaults sub directory of the main application directory.: DrWimpC App Builder reads this file when it is about to compile an application and sets various values in the use wimp data structure from the values in the ccdefaults file. Then uses the information to generate the compilation make file.Currently there are 21 default values stored as a token value pair in the form DRWCCDEF<n>:value where 1<=n<=21. Flag values are held as 0=FALSE, 1=TRUE. The tables are shown below with their default values followed by their user wimp data names and their default number as enum definitions from drwwh.h -:
Items marked (in flags) are flag values in drw_uw_flags (defined in drwwh.h) and set/unset in the user wimp data flags word.

Items marked (in flags2) are flag values in drw_uw_flags2 (defined in drw_uw_flags2 and set/unset in the user wimp data flags2 word.
DRWCCDEF1:0
DRWCCDEF2:1
DRWCCDEF3:0
DRWCCDEF4:1
DRWCCDEF5:0
DRWCCDEF6:1
DRWCCDEF7:0
DRWCCDEF8:1
DRWCCDEF9:
DRWCCDEF10:-wa
DRWCCDEF11:
DRWCCDEF12:
DRWCCDEF13:
DRWCCDEF14:
DRWCCDEF15:
DRWCCDEF16:
DRWCCDEF17:0
DRWCCDEF18:-v -f
DRWCCDEF19:0
DRWCCDEF20:1
DRWCCDEF21:1
drw_def_compiler_cc (in flags)
drw_def_compiler_gcc (in flags)
drw_def_linker_link (in flags)
drw_def_linker_drlink (in flags)
drw_def_libfile_castle (in flags)
drw_def_libfile_gnu (in flags)
drw_def_make_castle (in flags)
drw_def_make_gnu (in flags)
cccflags
ccwarnings
gccflags
gccwarnings
linkflags
drlinkflags
libfileflags
gnulibfileflags
drw_do_squeeze_flag
squeezeflags
drw_use_scl (in flags)
drw_elf_fmt (in flags2)
drw_shared_libs (in flags2)
drwimpc_def_compiler_cc = 1
drwimpc_def_compiler_gcc = 2
drwimpc_def_linker_link = 3
drwimpc_def_linker_drlink = 4
drwimpc_def_libfile_castle = 5
drwimpc_def_libfile_gnu = 6
drwimpc_def_make_castle = 7
drwimpc_def_make_gnu = 8
drwimpc_cflags_cc = 9
drwimpc_warnings_cc = 10
drwimpc_cflags_gcc = 11
drwimpc_warnings_gcc = 12
drwimpc_link_flags_link = 13
drwimpc_link_flags_drlink = 14
drwimpc_libfile_flags_castle = 15
drwimpc_libfile_flags_gnu = 16
drwimpc_do_squeeze_flag = 17
drwimpc_squeeze_flags = 18
drwimpc_use_scl = 19
drwimpc_elf_fmt = 20
drwimpc_shared_libs = 21
Notes:
Some of these default are now of mainly historical value being and were intended for possible mixing and matching of linker, libfile and make utilities for versions of the tools prior to GCC 4. As I've decided to no longer support versions of GCC prior to version 4 I've recoded DrWimpC App Builder to automatically set the linker, libfile and make defaults according to whether the C or GCC compiler is being used, based on the settings of DRWCCDEF1 and DRWCCDEF2.
Next: The DrWimpC Library Initialisation Sequence.
Previous: The User Wimp Data Structure.