| 1 | XWP Helpers 0.9.7 README
 | 
|---|
| 2 | (W) Ulrich Mller, October 26, 2000
 | 
|---|
| 3 | Last updated January 6, 2001, Ulrich Mller
 | 
|---|
| 4 | 
 | 
|---|
| 5 | 
 | 
|---|
| 6 | 0. CONTENTS OF THIS FILE
 | 
|---|
| 7 | ========================
 | 
|---|
| 8 | 
 | 
|---|
| 9 |     1. LICENSE, COPYRIGHT, DISCLAIMER
 | 
|---|
| 10 |     2. INTRODUCTION
 | 
|---|
| 11 |     3. CREATING CODE DOCUMENTATION
 | 
|---|
| 12 |     4. COMPILING
 | 
|---|
| 13 |     5. INCLUDING HEADER FILES
 | 
|---|
| 14 | 
 | 
|---|
| 15 | 
 | 
|---|
| 16 | 1. LICENSE, COPYRIGHT, DISCLAIMER
 | 
|---|
| 17 | =================================
 | 
|---|
| 18 | 
 | 
|---|
| 19 |     Copyright (C) 1997-2000 Ulrich Mller,
 | 
|---|
| 20 |                             Christian Langanke,
 | 
|---|
| 21 |                             and others (see the individual source files).
 | 
|---|
| 22 | 
 | 
|---|
| 23 |     This program is free software; you can redistribute it and/or modify
 | 
|---|
| 24 |     it under the terms of the GNU General Public License as contained in
 | 
|---|
| 25 |     the file COPYING in this distribution.
 | 
|---|
| 26 | 
 | 
|---|
| 27 |     This program is distributed in the hope that it will be useful,
 | 
|---|
| 28 |     but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
| 29 |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 | 
|---|
| 30 | 
 | 
|---|
| 31 | 
 | 
|---|
| 32 | 2. INTRODUCTION
 | 
|---|
| 33 | ===============
 | 
|---|
| 34 | 
 | 
|---|
| 35 |     Welcome to the XWorkplace Helpers.
 | 
|---|
| 36 | 
 | 
|---|
| 37 |     This CVS archive is intended to support OS/2 developers with any
 | 
|---|
| 38 |     code they might need writing OS/2 programs.
 | 
|---|
| 39 | 
 | 
|---|
| 40 |     The XWPHelpers are presently used in XWorkplace and WarpIN. They
 | 
|---|
| 41 |     started out from various code snippets I created for XFolder,
 | 
|---|
| 42 |     the predecessor of XWorkplace. I then isolated the code which could
 | 
|---|
| 43 |     be used independently and put that code into separate directories
 | 
|---|
| 44 |     in the WarpIN CVS repository (also at Netlabs).
 | 
|---|
| 45 | 
 | 
|---|
| 46 |     At Warpstock Europe 2000 in Karlsruhe, I talked to a number of
 | 
|---|
| 47 |     developers and then decided that this should become an independent
 | 
|---|
| 48 |     Netlabs CVS archive so that other people can more easily contribute.
 | 
|---|
| 49 | 
 | 
|---|
| 50 |     Even though the helpers are called "XWorkplace helpers", they
 | 
|---|
| 51 |     have nothing to do with WPS and SOM programming. They can help
 | 
|---|
| 52 |     any OS/2 programmer.
 | 
|---|
| 53 | 
 | 
|---|
| 54 |     The XWPHelpers offer you frequently used code for writing all
 | 
|---|
| 55 |     sorts of OS/2 programs, including:
 | 
|---|
| 56 | 
 | 
|---|
| 57 |     --  standard C code which is independent of the OS/2 platform;
 | 
|---|
| 58 | 
 | 
|---|
| 59 |     --  OS/2-specific code which can be used in any OS/2 program
 | 
|---|
| 60 |         (text mode or PM);
 | 
|---|
| 61 | 
 | 
|---|
| 62 |     --  PM-specific code which assists you in writing PM programs.
 | 
|---|
| 63 | 
 | 
|---|
| 64 |     The XWPHelpers can be compiled with EMX/GCC or IBM VisualAge
 | 
|---|
| 65 |     C++ 3.08. They can be used with C or C++ programs.
 | 
|---|
| 66 | 
 | 
|---|
| 67 | 
 | 
|---|
| 68 |     Getting Sources from Netlabs CVS
 | 
|---|
| 69 |     --------------------------------
 | 
|---|
| 70 | 
 | 
|---|
| 71 |     First set the CVS enviroment:
 | 
|---|
| 72 |         CVSROOT=:pserver:guest@www.netlabs.org:d:/netlabs.src/xwphelpers
 | 
|---|
| 73 |         USER=guest
 | 
|---|
| 74 | 
 | 
|---|
| 75 |     Then, to check out the most current XWPHelpers sources, create
 | 
|---|
| 76 |     a subdirectory in your CVS root dir called "xwphelpers".
 | 
|---|
| 77 | 
 | 
|---|
| 78 |     Do a "cvs login" with "readonly" as your password and do a
 | 
|---|
| 79 |     "cvs checkout ." from the "xwphelpers" subdirectory. Don't forget
 | 
|---|
| 80 |     the dot.
 | 
|---|
| 81 | 
 | 
|---|
| 82 |     Alternatively, use the Netlabs Open Source Archive Client (NOSAC).
 | 
|---|
| 83 |     See http://www.netlabs.org/nosa for details.
 | 
|---|
| 84 | 
 | 
|---|
| 85 |     In any case, I strongly recommend to create a file in $(HOME)
 | 
|---|
| 86 |     called ".cvsrc" and add "cvs -z9" in there to enable maximum
 | 
|---|
| 87 |     compression during transfers. This greatly speeds up things.
 | 
|---|
| 88 | 
 | 
|---|
| 89 | 
 | 
|---|
| 90 | 3. CREATING CODE DOCUMENTATION
 | 
|---|
| 91 | ==============================
 | 
|---|
| 92 | 
 | 
|---|
| 93 |     The XWPHelpers do not come with pre-made documentation. However,
 | 
|---|
| 94 |     you can automatically have documentation generated from the sources
 | 
|---|
| 95 |     using my "xdoc" utility, which resides in the main directory of
 | 
|---|
| 96 |     the helpers. (The source code for xdoc is in the WarpIN CVS
 | 
|---|
| 97 |     repository because it shares some C++ code with WarpIN.)
 | 
|---|
| 98 | 
 | 
|---|
| 99 |     To have the code generated, call "createdoc.cmd" in the main
 | 
|---|
| 100 |     directory. This will call xdoc in turn with the proper parameters
 | 
|---|
| 101 |     and create a new "HTML" directory, from where you should start
 | 
|---|
| 102 |     with the "index.html" file.
 | 
|---|
| 103 | 
 | 
|---|
| 104 | 
 | 
|---|
| 105 | 4. COMPILING
 | 
|---|
| 106 | ============
 | 
|---|
| 107 | 
 | 
|---|
| 108 |     Compiling is a bit tricky because the code and the makefiles
 | 
|---|
| 109 |     were designed to be independent of any single project. As a
 | 
|---|
| 110 |     result, I had to used environment variables in order to pass
 | 
|---|
| 111 |     parameters to the makefiles.
 | 
|---|
| 112 | 
 | 
|---|
| 113 |     The most important environment variable is PROJECT_BASE_DIR.
 | 
|---|
| 114 |     This should point to the root directory of your own project.
 | 
|---|
| 115 |     In this directory, src\helpers\makefile expects a file called
 | 
|---|
| 116 |     "setup.in" which sets up more environment variables. You can
 | 
|---|
| 117 |     take the one from the XWPHelpers makefile as a template.
 | 
|---|
| 118 | 
 | 
|---|
| 119 |     Here's an example: Say you have a CVS root directory of
 | 
|---|
| 120 |     "C:\cvs" on your system. The XWPHelpers reside in
 | 
|---|
| 121 |     "C:\cvs\xwphelpers". Your own project resides in
 | 
|---|
| 122 |     "C:\cvs\myproject" (plus subdirectories). So set
 | 
|---|
| 123 |     PROJECT_BASE_DIR to "C:\cvs\myproject" and put setup.in
 | 
|---|
| 124 |     in that directory.
 | 
|---|
| 125 | 
 | 
|---|
| 126 |     Note that the XWPHelpers also expect a "setup.h" header
 | 
|---|
| 127 |     file to be somewhere on your INCLUDE path. See remarks
 | 
|---|
| 128 |     below.
 | 
|---|
| 129 | 
 | 
|---|
| 130 |     See the top of src\helpers\makefile for additional variables.
 | 
|---|
| 131 | 
 | 
|---|
| 132 |     Of course, nothing stops you from writing your own makefile
 | 
|---|
| 133 |     if you find all this too complicated. However, if you choose
 | 
|---|
| 134 |     to use my makefile from within your own project, you can
 | 
|---|
| 135 |     then simply change to the src\helpers directory and start a
 | 
|---|
| 136 |     second nmake from your own makefile like this:
 | 
|---|
| 137 | 
 | 
|---|
| 138 |         @cd xxx\src\helpers
 | 
|---|
| 139 |         nmake -nologo "PROJECT_BASE_DIR=C:\myproject" "MAINMAKERUNNING=YES"
 | 
|---|
| 140 |         @cd olddir
 | 
|---|
| 141 | 
 | 
|---|
| 142 | 
 | 
|---|
| 143 | 5. INCLUDING HEADER FILES
 | 
|---|
| 144 | =========================
 | 
|---|
| 145 | 
 | 
|---|
| 146 |     The "include policy" of the helpers is that the "include"
 | 
|---|
| 147 |     directory in the helpers source tree should be part of your
 | 
|---|
| 148 |     include path. This way you can include helper headers in
 | 
|---|
| 149 |     your own project code using
 | 
|---|
| 150 | 
 | 
|---|
| 151 |         #include "helpers\header.h"
 | 
|---|
| 152 | 
 | 
|---|
| 153 |     so that the helpers headers won't interfere with your own
 | 
|---|
| 154 |     headers.
 | 
|---|
| 155 | 
 | 
|---|
| 156 |     Note that all the helpers C code includes their own include
 | 
|---|
| 157 |     files this way. As a result, the XWPHelpers "include"
 | 
|---|
| 158 |     directory must be in your include path, or this won't
 | 
|---|
| 159 |     compile.
 | 
|---|
| 160 | 
 | 
|---|
| 161 |     I have a "flat" include policy, meaning that include files
 | 
|---|
| 162 |     may not include other files. Instead, #include's may only
 | 
|---|
| 163 |     occur in C files. This makes makefile dependencies easier
 | 
|---|
| 164 |     to maintain.
 | 
|---|
| 165 | 
 | 
|---|
| 166 |     Besides, the helpers C code expects a file called "setup.h"
 | 
|---|
| 167 |     in your include path somewhere. This is included by _all_
 | 
|---|
| 168 |     the C files so you can (re)define certain macros there.
 | 
|---|
| 169 |     XWorkplace and WarpIN both have such a header file in their
 | 
|---|
| 170 |     respective "include" directories.
 | 
|---|
| 171 | 
 | 
|---|
| 172 |     With V0.9.7, many function prototypes have been changed in
 | 
|---|
| 173 |     the helpers headers to allow exporting them in a DLL.
 | 
|---|
| 174 |     (This was necessary for creating XWorkplace plugin DLLs.)
 | 
|---|
| 175 |     As a result, you now MUST define XWPENTRY in your setup.h
 | 
|---|
| 176 |     to contain the linkage for the helpers functions. This
 | 
|---|
| 177 |     can look like this:
 | 
|---|
| 178 | 
 | 
|---|
| 179 |         #ifdef __EMX__
 | 
|---|
| 180 |             // with EMX, do nothing; EMX always uses _System linkage
 | 
|---|
| 181 |             #define XWPENTRY
 | 
|---|
| 182 |         #elif defined (__IBMCPP__) || defined (__IBMC__)
 | 
|---|
| 183 |             // with VAC, use _Optlink; that's faster than _System
 | 
|---|
| 184 |             #define XWPENTRY _Optlink
 | 
|---|
| 185 |             // or: #define XWPENTRY _System
 | 
|---|
| 186 |         #endif
 | 
|---|
| 187 | 
 | 
|---|
| 188 | 
 | 
|---|