User Tools

Site Tools


project_system_examples.htm
Navigation:  Advanced Topics > Legacy Project System Reference >====== Project System Examples ====== Previous pageReturn to chapter overviewNext page

Following is an example of some project system commands that we use here at SoftVelocity to make our file drivers. This example uses a wide variety of project system statements and shows how the project system can be used to control the accuracy and completeness of even the most complicated projects.

These example statements are divided among four files, showing the project system's ability to support structured programming, modularity, and reusability. The files are ALLDRV.PR, which #calls ORACLE.PR (among others), which #includes SQLFILES.PR, which in turn #includes DRVKIT.PI.

ALLDRV.PR

#system win dll

#model clarion

#set drvdebug  = full

#set kitdebug  = full

#set release = off

#set fromclw = on

#set incbuildno = off

#set demo = off

#if “%release”=“on” #then

 #pragma define(_RELEASE⇒on)

 #set incbuildno = on

 #set kitdebug  = off

 #set drvdebug  = off

#endif

#pragma define(DEMO_VERSION⇒%demo)

#set domodels=

'

#abort on

#set dowin32=off #set dolib=off

#call prjfile** ** #set dowin32=off #set dolib=on** ** #call prjfile

#set dowin32=off #set dolib=off

#abort off

#set dowin32=on #set dolib=off

#call prjfile** ** #set dowin32=on #set dolib=on** ** #call prjfile

#abort on

'

#if #exists btrieve.pr  #then #set prjfile=btrieve.pr %domodels  #endif

#if #exists odbc.pr     #then #set prjfile=odbc.pr %domodels     #endif

#if #exists cla21.pr    #then #set prjfile=cla21.pr %domodels    #endif

#if #exists tps.pr      #then #set prjfile=tps.pr %domodels      #endif

#if #exists dos.pr      #then #set prjfile=dos.pr %domodels      #endif

#if #exists ascii.pr    #then #set prjfile=ascii.pr %domodels    #endif

#if #exists basic.pr    #then #set prjfile=basic.pr %domodels    #endif

#set domodels=

'

#set dowin32=off #set dolib=off

#call prjfile** ** #set dowin32=off #set dolib=on** ** #call prjfile

#set dowin32=off #set dolib=off

'

#file redirect ts.red

#if #exists sql400.pr   #then #set prjfile=sql400.pr %domodels   #endif

#if #exists oracle.pr   #then #set prjfile=oracle.pr %domodels   #endif

ORACLE.PR:

#noedit

——————————————————————-

——————————————————————-

–  ORACLE.PR  Oracle Driver project file

——————————————————————-

——————————————————————-

#system win dll                               –target OS is windows, dll executable

#model clarion                                –memory model is clarion

–  Set default macro values. These “switches” will control the make process

#set drv        = ORA

#set trace      = off

#set heapchk    = off

#set drvdebug   = full

#set sqldebug   = full

#set kitdebug   = off

–#set release  = on

#expand ORACLEIN.CPP                            –set %cpath to path where file is created

                                               –%opath to path where file is opened

                                               –%ext to CPP

                                               –%tail to ORACLEIN

                                               –%cdir to directory where file is created

                                               –%odir to directory where file is opened

#set drvdir = %odir                             –save the %odir value

#set sql_type = O                               –set %sql_type to O

– Define a conditional compile symbol for subsequent compiles.

– The symbol is DRVSPEC, and its value is “oraclesp.h”

– DRVSPEC is available for interrogation by the OMIT and COMPILE

– statements'see the Language Reference for more information.

#pragma define(DRVSPEC⇒'“oraclesp.h”')

–Compile the sql modules with appropriate levels of debug code.

#include SQLFILES.PR                         –Execute statements from SQLFILES.PR here.

                                            –All macros, pragmas, and link list are fully

                                            –available to the #included statements.

#compile ORACLEIN.CPP                        –compile the oracle c++ source.

#compile ORAIMPOR.CLW /define (maincode⇒off)–and the clarion source.

                                            –both are added to the link list.

#pragma link(ORAIMPOR.RSC)                   –add ORAIMPOR.RSC to the link list.

#pragma link (ORA7WIN.LIB)                   –add ORA7WIN.LIB to the link list.

#pragma link (%lnkpfx%asc.LIB)               –add ClaASC.LIB to the link list.

                                            –%lnkpfx% resolves to Cla,

–  Execute the series of statements assigned to drv_Link at the very

–  end of the DRVKIT.PI file. These statements are designed to link

–  and patch the File Driver.

%drv_Link

SQLFILES.PR:

– Release version: Disable all debugging and tracing

#if “%release”=“on” #then

#set drvdebug  = off

#set kitdebug  = off

#set sqldebug  = off

#set trace     = off

#set heapchk   = off

#endif

– make sure the sql_type switch is explicitly set (no default)

#if '%sql_type' = #then  #error “sql_type must be set” #endif – Default is compact code. Set the DRIVER_COMPACT symbol based on – the value of the %compact macro #if “%compact”=“” #then #set compact=on #endif #if '%compact'='off' #or '%heapchk'='on' #then #pragma define(DRIVER_COMPACT⇒off) #else #pragma define(DRIVER_COMPACT⇒on) #endif #include DRVKIT.PI                           –Execute statements from DRVKIT.PI here.                                             –All macros, pragmas, and link list are fully                                             –available to the #included statements. #pragma save                                 –Save the current #pragma settings so they                                             –can be restored later with #pragma restore. – Debugging: Debugger info and Run-time checks #if “%sqldebug”=“” #then #set sqldebug=off #endif             –default is off #pragma debug(vid⇒%sqldebug) #if “%sqldebug”=“full” #then                                  –for full debugging, enable #pragma check(index⇒on,range⇒on,overflow⇒on)              –runtime error checks #pragma debug(line_num⇒on)                                  –and line numbering #endif #pragma warn(wall⇒on)                                        –enable all warning msgs #set srcfile = SAFESTR.CPP                                    –set %srcfile to SAFESTR.CPP #set dstfile = %sql_type%SAFE.CPP                             –set %dstfile to OSAFE.CPP –  Execute the series of statements assigned to makesrc in the middle –  of the DRVKIT.PI file. These statements are designed to get the C++ –  constructor entry point to have a different name for each driver. %makesrc #set srcfile = SQLOPEN.CPP                                     – ditto #set dstfile = %sql_type%SQLOPE.CPP %makesrc #set srcfile = SQLUPDAT.CPP                                    – ditto #set dstfile = %sql_type%SQLUPD.CPP %makesrc #set srcfile = SQLRETRI.CPP                                    – ditto #set dstfile = %sql_type%SQLRET.CPP %makesrc #set srcfile = SQLGLOB.CPP                                     – ditto #set dstfile = %sql_type%SQLGLO.CPP %makesrc #if %system=win #then                                          – conditionally #set srcfile = SQLVIEW.CPP                                    – ditto #set dstfile = %sql_type%SQLVIEW.CPP %makesrc #endif #pragma restore                                –restore the #pragma settings saved earlier #pragma warn(wall⇒on)                         –enable all warning messages   DRVKIT.PI: #noedit ———————————————————————– ———————————————————————– –  DRVKIT.PI   Driver Kit project include file ———————————————————————– ———————————————————————– – DrvKit.Pi contains project statements common to all Driver Kit based – File Drivers.  The following settings must be set before including – drvkit.pi: –      #set drv        = A 3 or 4 letter driver id (e.g C21) –      #pragma define(DRVSPEC='“c21specs.h”)   – or appropriate file –      Any other defines that affect the Driver Specification –  Optional: –      #set trace      = on        – Enable tracing –      #set heapchk    = on        – Enable Heap Checker –      #set common     = on        – Merge common code – Release version: Disable all debugging and tracing #if “%release”=“on” #then #set drvdebug  = off #set kitdebug  = off #set trace     = off #set heapchk   = off #endif – Windows: Ensure Clarion 4 Windows conventions are adopted #pragma warn(wall⇒on)              –enable all warning messages #pragma define(CLARION⇒on)     –set compiler directive switch #if #not %system=dos #then          –  dos, #if “%dowin32”=on #then  #system win32 dll                 –  win32, or #else  #system win dll                   –  win16 #endif #model clarion #if %filetype=dll #then  #pragma define(_WINDLL⇒on)       –set compiler directive switch #endif – Build the appropriate file names for this driver set. #if “%dolib”=“” #then  #set dolib=off                    –default dolib = off #endif #if “%dowin32”=“” #then  #set dowin32=off                  –default dowin32 = off #endif #if %dolib=on #then                –set link (.lib) prefix  #set lnkpfx = CL #else  #set lnkpfx = CW #endif #if “%pfx”=“” #then  #set pfx      = %drv%             –set prefix to driver name #endif #else #set dolib=off #if %model=extendll #then  #pragma define(_XTDDLL⇒on) #endif #set pfx       = %Mdrv%** ** #if '%RWMODE%' = 'on' #then** **  #set lnkpfx=drw** ** #else** **  #set lnkpfx=%clapfx%** ** #endif** ** #set S = ""                        --set suffix to null** **#endif** **#set drvname    = %lnkpfxdrvS%      --Put the name together** **#message "Making %drvname% File Driver" --Display status message** **#if #not "%inbrowser" #then** **  #if #exists %drvname%.ver #then       --Conditionally...** **    #compile %drvname%.ver              --  compile the driver** **  #endif** **#endif** **-- Heap Checker: Compile and enable Heap Checker (No Debugging)** **#if "%heapchk"="on" #or "%heapdbg"="on" #then** ** #set heapchk = on** ** #pragma define(HEAPCHK=>on)            --Set compiler directive switch.** ** #if "%heapdll"="on" #then              --If dll, then** **  #pragma link(%clapfx%hchk.lib)        --add heapchk lib to link list.** ** #else** **  #pragma save                          --Save current pragma settings.** **  #if "%heapdbg"="on" #then             --Conditionally...** **   #pragma debug(vid=>full)             -- enable debug code.** **  #endif** **  #compile HEAPCHK.C     #to %pfx%HCHK.OBJ--Compile heap checker.** **  #compile STRCHK.C      #to %pfx%SCHK.OBJ--** **  #compile NEW.CPP       #to %pfx%NEW.OBJ** **  #pragma restore                         --Restore saved pragma settings.** ** #endif** **#endif** **-- Debugging: Debugger info and Run-time checks** **#if "%drvdebug"="" #then #set drvdebug=full #endif--default is "full"** **#pragma debug(vid=>%drvdebug)** **#if "%drvdebug"="full" #then** ** #pragma check(index=>on,range=>on,overflow=>on)  --enable runtimes** ** #pragma debug(line_num=>on)                      --enable line nos.** **#endif** **-- Common Code: Some Driver Kit code is merged when linking multiple** **-- File Driver Libraries** **#if "%common"="on" #then                          --Conditionally...** ** #pragma define(COMMON_CODE=>on)                  -- define compiler switch** **#endif** **#if '%drvdir' = '' #then** ** #error "drvdir must be set to build lib versions of the drivers"** **#endif** **-- To get the C++ constructor entry point to have a different** **-- name for each of the drivers it is necessary to compile** **-- different C++ source modules:** **#set makesrc = '** **    #if (#not #exists drvdirdstfile) #or (drvdirdstfile #older srcfile ) #or (srcfile #older drvdirdstfile ) #then     #expand srcfile** **     #run "copy opath drvdirdstfile > NUL " ** **    #endif** **    #compile dstfile defns** **'** **-- Driver Kit: Compile Driver Kit sources** **#pragma save                                  --First, save current pragma settings** **#if #not "%kitdebug"="" #then                 --Conditionally...** ** #pragma debug(vid=>%kitdebug)                -- set debug level** **#else** ** #pragma debug(vid=>off)** **#endif** **#set srcfile = DRVL1.C                        --Set srcfile name** **#set dstfile = %pfx%L1.C                      --set dstfile name w correct prefix** **%makesrc                                      --Execute stmts defined above.** **#if #not "%nocommon" ="on" #then --if common code** ** #set srcfile = DRVSTATE.C                    --make DRVSTATE** ** #set dstfile = %pfx%STAT.C** ** %makesrc** ** #if #not (%system=dos) #then                 --if system is not DOS** **  #set srcfile = DRVVIEW.CPP                  --make DRVVIEW** **  #set dstfile = %pfx%VIEW.CPP** **  %makesrc** **  #if #not (%filetype=dll) #then              --Conditionally...** **   #pragma define(DRV_HAS_LIBMAIN=>on)        -- set compiler switch** **  #endif** **  #set srcfile = DRVW.C** **  #set dstfile = %pfx%W%dolib%.C** **  #set defns = '/define(_LIB_TARGET=>%dolib%)'** **  %makesrc** **  #set defns = ''** **  #set srcfile = DRVWUTIL.C                   --make DRVWUTIL** **  #set dstfile = %pfx%WUTI.C** **  %makesrc** **  #if #not %dolib% #then                      --Conditionally** **   #set srcfile = DRVDIAL.CLW                 -- make DRVDIAL** **   #set dstfile = %pfx%DIAL.CLW** **   #set defns = '/define(maincode=>off)'** **   %makesrc** **   #set defns = ''** **   #pragma link(%pfx%dial.rsc)                --Add DIAL to link list** **  #endif** ** #endif** **#endif** **#if "%trace"="on" #then                      --Conditionally...** ** #pragma save, define(TRACE=>on)             -- save settings...** ** #set srcfile = DRVTRACE.C                   -- make DRVTRACE** ** #set dstfile = %pfx%TRAC.C** ** %makesrc** **#endif** **#set srcfile = DRVPIPE.C                     --make DRVPIPE** **#set dstfile = %pfx%P%dolib%.C** **#set defns = '/define(_LIB_TARGET=>%dolib%)'** **%makesrc** **#set defns = ''** **#if "%trace"="on" #then** ** #pragma restore                             --restore saved pragma settings** **#endif** **#pragma restore** **-- Build Macro drv_Link to be used later in this process** **-- to link and patch the File Driver:** **#set drv_Link =** **'** ** #pragma link_option(share_const=>on)** ** #if #not (system=dos) #then  #if “dolib"="on" #then** **   #dolink drvname.lib** **  #else** **   #implib drvname.lib drvname.exp** **   #if define(_CW15)=on #then** **    #pragma linkfirst(idllSw.obj)** **   #else** **    #pragma linkfirst(icwdll.obj)** **   #endif** **   #pragma link(winS.lib)** **   #pragma link(cwrunS.lib)** **   #pragma link_option(decode=>off)** **   #dolink drvname.dll** **  #endif** **  #if "make” #and #not “dolib"="on" #then** **   #exemod drvname.dll drvname.exp drvname.map** **  #endif** ** #else** **  #if filetype=dll #then   #implib drvname.lib drvname.exp  #endif  #set tscla    = on  #set tscpp    = off  #link drvname  #if ”make" #and (filetype=dll) #then   #expand drvname.dll   #run “mkdriver %%cpath > NUL”  #endif #endif ' **

project_system_examples.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1