Jump to content

Cubus C++ OCL v1.50 Samples Hack: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
This is a quick and dirty hack to make the samples in OCL v1.50 to compile.
This is a quick and dirty hack to make the samples in OCL v1.50 to compile.


In [[Cubus OCL]] v1.50 the header files now must be included using the #include directive, instead of using the #define INCL_O... macros as in previous versions of the library.
In [[Cubus OS/2 Class Library|Cubus OCL]] v1.50 the header files now must be included using the #include directive, instead of using the #define INCL_O... macros as in previous versions of the library.


Here is a REXX script that creates %OCL%\INCLUDE\OclAll.hpp, which is simply a header that includes all the headers. You must then edit the sample's *.hpp file to include OclAll.hpp after the #include <ocl.hpp> statement.
Here is a REXX script that creates %OCL%\INCLUDE\OclAll.hpp, which is simply a header that includes all the headers. You must then edit the sample's *.hpp file to include OclAll.hpp after the #include <ocl.hpp> statement.

Latest revision as of 15:25, 28 March 2018

This is a quick and dirty hack to make the samples in OCL v1.50 to compile.

In Cubus OCL v1.50 the header files now must be included using the #include directive, instead of using the #define INCL_O... macros as in previous versions of the library.

Here is a REXX script that creates %OCL%\INCLUDE\OclAll.hpp, which is simply a header that includes all the headers. You must then edit the sample's *.hpp file to include OclAll.hpp after the #include <ocl.hpp> statement.

The sample's code will look like this:

#define OINCL_OXAPP
...
#include <ocl.hpp>
#include <oclall.hpp>
...

/* ---------------------------------------------------------------------
 *  oclfix.cmd
 *
 *  Syntax      :   oclfix
 *
 *  Description :   Creates %OCL%\INCLUDE\OclAll.hpp which is a list
 *                  of all the OCL headers.
 *
 *  Returns     :   0 = success, 1 = error
 *
 * -------------------------------------------------------------------*/

"@echo off"
signal on Halt
signal on NoValue

Ocldir = value("OCL",, "OS2ENVIRONMENT")

if Ocldir == "" then do
    say "OCL environment not found."
    return 1
end

fnameout = Ocldir"\Include\OclAll.hpp"

call Syscls ; say center("Creating" fnameout, 80)

i = SysFileDelete(fnameout)

i = lineout(fnameout, "#ifndef OCLALL_HPP_INCLUDED")
i = lineout(fnameout, "#define OCLALL_HPP_INCLUDED"||"0d0a"x)

fmask = Ocldir"\Include\*.hpp"
drop file.
call SysFileTree fmask, 'file', 'f'
if file.0 = 0 then do
    say '' ; say 'No matching files: 'fmask ; exit 0
end
do fcount = 1 to file.0
    parse var file.fcount de te ea at fnamehpp
    fnamehpp = strip(fnamehpp)
    notready = stream(fnamehpp, 'c', 'open')
    oooooooo = stream(fnamehpp, 'c', 'close')
    if pos("NOTREADY", notready) \= 0 then do   /* file is NOT ready */
        say notready' 'fnamehpp
        return 1
    end
    else do                                     /* file is ready */
        fnamehpp = filespec('name', fnamehpp)
        cmp = translate(fnamehpp)
        call charout , '.'
        if (pos("OCL.HPP", cmp)) | (pos(cmp, "OCLALL.HPP")) then
            iterate
        i = lineout(fnameout, "#include" x2c(3c)||fnamehpp||x2c(3e))
    end
end

i = lineout(fnameout, "0d0a"x||"#endif // OCLALL_HPP_INCLUDED")

say "0d0a"x||"Done."||"0d0a"x
say center("Add", 80)
say center("#include "filespec('name',fnameout)"" , 80)
say center("to the header file(s) of the samples you want to compile,", 80)
say center("after the #include ocl.hpp statement.", 80)

return 0

/* ---------------------------------------------------------------------
 * Procedure :  Halt
 * Purpose   :  Ctrl+C, Ctrl+Break catcher
 * Returns   :  n/a
 * -------------------------------------------------------------------*/

Halt:
    
    parse source . . arg0
    say '0d0a'x||arg0 'halted at line' sigl
    exit 0
    
/* ---------------------------------------------------------------------
 * Procedure :  Novalue
 * Purpose   :  Catches uninitialized variables
 * Returns   :  n/a
 * -------------------------------------------------------------------*/
    
Novalue:
    
    parse source . . arg0
    say '0d0a'x||arg0 'Novalue at line' sigl
    exit 0