Changeset 22112 for branches


Ignore:
Timestamp:
Jan 25, 2016, 4:22:26 PM (10 years ago)
Author:
rousseau
Message:

And then there were three: (Pm32, Odin32 and Win32) [apitest]

This commit introduces the Odin32 and Win32 variants of ApiTest.
All three are generated from a software-model and composed from
source-snippets, a process that will continue to be enhanced at the
developer site.

Location:
branches/swt
Files:
15 added
11 edited

Legend:

Unmodified
Added
Removed
  • branches/swt/Makefile.kmk

    r22073 r22112  
    1111include $(PATH_SUB_CURRENT)/lib/Makefile.kmk
    1212include $(PATH_SUB_CURRENT)/tools/Makefile.kmk
     13include $(PATH_SUB_CURRENT)/testapp/Makefile.kmk
    1314include $(PATH_SUB_CURRENT)/src/Makefile.kmk
    1415
  • branches/swt/testapp/Makefile.kmk

    r21916 r22112  
    99# Include sub-makefiles.
    1010#
    11 INCLUDE_SUBDIRS = \
    12     console/file \
    13     console/fullpath \
    14     encodings \
    15     exceptions/seh \
    16     gui/fontlist \
    17     gui/input \
    18     gui/systray \
    19     network/iphlpapi \
    20     threads
     11INCLUDE_SUBDIRS =
     12INCLUDE_SUBDIRS += apitest
     13#INCLUDE_SUBDIRS += console/file
     14#INCLUDE_SUBDIRS += console/fullpath
     15#INCLUDE_SUBDIRS += encodings
     16#INCLUDE_SUBDIRS += exceptions/seh
     17#INCLUDE_SUBDIRS += gui/fontlist
     18#INCLUDE_SUBDIRS += gui/input
     19#INCLUDE_SUBDIRS += gui/systray
     20#INCLUDE_SUBDIRS += network/iphlpapi
     21#INCLUDE_SUBDIRS += threads
    2122
    2223$(foreach dir,$(INCLUDE_SUBDIRS),$(eval include $$(PATH_SUB_CURRENT)/$(dir)/Makefile.kmk))
  • branches/swt/testapp/apitest/ApiTest.properties

    r22108 r22112  
    1 #Initial Connection Properties
    2 #Thu, 03 Dec 2015 19:39:46 +0800
     1#Developer Connection Properties
     2#The properties in this file are here to aid the developer by providing a backlink.
     3#This kinda has to do with 'modeling' and being able to 'regenerate' a published commit.
     4#Mon, 25 Jan 2016 22:33:43 -0500
    35
    4 meta-commit=none
     6meta-commit=ba42daf18f7391a9815d5d7cbbb22a11559673a8
  • branches/swt/testapp/apitest/GNUmakefile

    r22110 r22112  
     1#! GENINFO :: platform:OS/2, version:20.45, target:ApiTest.generate
    12###############################################################################
    2 # GNUmakefile :: Build the ApiTestPm Program                                  #
     3# GNUmakefile :: Build the ApiTest Program as multiple variants               #
    34# --------------------------------------------------------------------------- #
    4 # For this initial version we start with a PM version because, well, we are   #
    5 # on OS/2! However, this is not the module of focus since it is not directly  #
    6 # connected to the SWT for OS/2 project. Upcoming commits will bring the      #
    7 # Odin32 based and Native Win32 variants.                                     #
     5#                                                                             #
     6# The purpose of the ApiTest Program is to get Odin in a better shape.        #
     7# Currently the main focus is on the Standard Widget Toolkit for OS/2, which  #
     8# is a separate but closely related project in development. For more info see #
     9# the 'doc' directory.                                                        #
     10#                                                                             #
     11# The ApiTest Program can be build as 3 variants:                             #
     12# -----------------------------------------------                             #
     13# o A native Pm32 variant                                                     #
     14#   This variant is not the true focus of ApiTest but is used to investigate  #
     15#   things from the Pm32 angle, especially stuff that Odin32 delegates to Pm. #
     16#                                                                             #
     17# o An Odin32 Based variant                                                   #
     18#   This variant is the true focus of ApiTest and relates to the test-module  #
     19#   of the SwtOs2Demo. That test-module addresses issues encountered through  #
     20#   the SwtOs2 layer while ApiTestOdin addresses these issues by directly     #
     21#   using the Odin32-API. Using this approach makes it easier to determine if #
     22#   issues are caused at the SwtOs2 layer or by Odin.                         #
     23#                                                                             #
     24# o A native Win32 variant                                                    #
     25#   This variant is a PE-executable which causes Odin32 to handle it          #
     26#   differently as apposed to the Odin Based (LX-executable) variant. This    #
     27#   variant also runs Win(e)dows, which enables investigation of the Win32    #
     28#   implementation of those environments. This is especially interesting with #
     29#   regard to the Wine because its sources may contain 'cherries' for Odin.   #
     30#                                                                             #
     31# Currently 2 tool-chains are supported on OS/2:                              #
     32# ----------------------------------------------                              #
     33# o Open Watcom (v1.9+)                                                       #
     34#   This is the default tool-chain for these 'out-of-kBuild' builds, because  #
     35#   it can build all 3 variants, either on OS/2 or on Win(e)dows.             #
     36#   For convenience and compatibility with gcc, the 'owcc' front-end is used. #
     37#                                                                             #
     38# o GNU Compiler Collection for OS/2                                          #
     39#   This is the same tool-chain used by kBuild when building Odin.            #
     40#   Currently the 4.9.2 version is used at the developer site.                #
     41#   This tool-chain can build the Pm32 and Odin32 variants.                   #
     42#                                                                             #
    843###############################################################################
    944
    10 # This is the default target when no targets are specified.
     45#
     46# File Commander User Menu
     47# ------------------------
     48# To ease building from the command-line, a File Commander user-menu is
     49# available. Just navigate with FC/2 to the directory containing this Makefile
     50# and press F2. Besides the normal menu navigation, one can use the hotkeys
     51# to quickly activate the desired entry. For instance, the 'bgo' key-sequence
     52# would build the Odin Based variant using GCC/2, while a sequence of 'ba'
     53# would build all variants using Open Watcom, which is the default tool-chain
     54# for these 'out-of-kBuild' builds of ApiTest.
     55#
     56
     57# Get the name of this Makefile so in can be recursively invoked if needed.
     58# This should always be the first statement, so any include statements should
     59# go *below* this one.
     60SELF:=$(lastword $(MAKEFILE_LIST))
     61
     62# This is the true default target invoked when no targets are specified.
     63# Because only one target can be specified, we redirect to a target called
     64# 'default' where multiple targets can be specified as dependencies.
     65# So any changes to default behavior should not be made here but to the
     66# mentioned 'default' target defined a few paragraphs down.
    1167.DEFAULT_GOAL:=default
    1268
    13 # Use the wl.exe Open Watcom derivative for linking
     69# When using extensions that are not in the default suffixes list, the special
     70# macro '$*' which holds the stem of the target has an empty value when the
     71# recipe is executed. Adding it to the suffixes list solves this. We use the
     72# '.ors' extension (object resource) to hold the translated Win32 resources
     73# for the Odin32 variant.
     74.SUFFIXES: .ors
     75
     76# Use 'wl.exe' for linking
    1477export EMXOMFLD_TYPE=wlink
    1578export EMXOMFLD_LINKER=wl.exe
    1679
    17 # The header, source and output directories relative to this makefile
     80# The header, source and output directories relative to this Makefile
    1881inc=h
    1982src=src
    2083out=out
    2184
    22 # While this is the first target, the true default target is
    23 # specified in .DEFAULT_GOAL above. Here we'll redirect to target 'default'.
    24 all: default
     85# Accumulate Open Watcom Include Directories and compose a ';' separated
     86# include-path with '/' for both for 32-bit OS/2 and 32-bit Windows.
     87WATCOM2:=$(subst \,/,$(WATCOM))
     88OW_OS2V2_INCDIRS:=$
     89OW_OS2V2_INCDIRS+=$(WATCOM2)/h
     90OW_OS2V2_INCDIRS+=$(WATCOM2)/h/os2
     91OW_OS2V2_INCDIRS:=$(strip $(OW_OS2V2_INCDIRS))
     92OW_OS2V2_INCPATH:=$(subst $  ,;,$(OW_OS2V2_INCDIRS))
     93OW_WIN32_INCDIRS:=$
     94OW_WIN32_INCDIRS+=$(WATCOM2)/h
     95OW_WIN32_INCDIRS+=$(WATCOM2)/h/nt
     96OW_WIN32_INCDIRS:=$(strip $(OW_WIN32_INCDIRS))
     97OW_WIN32_INCPATH:=$(subst $  ,;,$(OW_WIN32_INCDIRS))
     98
     99# Accumulate Odin32 Include Directories and compose a ';' separated
     100# include-path from them.
     101ODIN32SDK_INCDIRS:=$
     102ODIN32SDK_INCDIRS+=../../include
     103ODIN32SDK_INCDIRS+=../../include/win
     104ODIN32SDK_INCDIRS+=../../include/win/wine
     105ODIN32SDK_INCDIRS:=$(strip $(ODIN32SDK_INCDIRS))
     106ODIN32SDK_INCPATH:=$(subst $  ,;,$(ODIN32SDK_INCDIRS))
     107
     108# Accumulate Odin32 Library Directories (only one) and compose a ';' separated
     109# library-path from them.
     110ODIN32SDK_LIBDIRS:=$
     111ODIN32SDK_LIBDIRS+=../../out/os2.x86/release/stage/lib
     112ODIN32SDK_LIBDIRS:=$(strip $(ODIN32SDK_LIBDIRS))
     113ODIN32SDK_LIBPATH:=$(subst $  ,;,$(ODIN32SDK_LIBDIRS))
     114
     115# Accumulate Odin32 Libraries
     116ODIN32SDK_LIBS:=$
     117ODIN32SDK_LIBS+=kernel32.lib
     118ODIN32SDK_LIBS+=user32.lib
     119ODIN32SDK_LIBS+=gdi32.lib
     120ODIN32SDK_LIBS:=$(strip $(ODIN32SDK_LIBS))
     121
     122# This macro is invoked by defined but not yet implemented targets
     123define target.not.implemented
     124@echo !!! Target "$@" is not implemented yet... !!!
     125endef
     126
     127# Display an empty line
     128define nl
     129echo.
     130endef
     131
     132# Convert a space or ';' separated list of include dirs to a list of -I flags for gcc
     133define incdirs2flags.gcc
     134$(foreach idir,$(subst ;, ,$(1)),-I$(idir))
     135endef
     136
     137# Convert a space or ';' separated list of library dirs to a list of -L flags for gcc
     138define libdirs2flags.gcc
     139$(foreach ldir,$(subst ;, ,$(1)),-L$(ldir))
     140endef
     141
     142# Convert a space or ';' separated list of library names to a list of -l flags for gcc
     143define libnames2flags.gcc
     144$(foreach lname,$(subst ;, ,$(1)),-l$(lname))
     145endef
     146
     147
     148
     149# ------------------------------------------------------------------- [default]
     150# This is the redirected default target from the '.DEFAULT_GOAL' statement
     151# -----------------------------------------------------------------------------
     152# It gets invoked when no targets are specified. Any changes to the behavior of
     153# the default target should be made here by modifying the dependency list.
     154# Multiple targets can be specified on the dependency list.
     155# Please note that:
     156# When typing 'make', the default is building the 'Odin32' variant with GCC/2.
     157# However, the default from the FC/2 menu is building the 'Odin32' variant with
     158# Open Watcom. This makes is easy to switch between the two: F2 'BD' for 'owcc'
     159# or a command recall (cli:up / fc2:ctrl-up) of 'make' for 'gcc'.
     160# -----------------------------------------------------------------------------
     161default: gcc.build.odin32
    25162#       @echo [$@]
    26163
    27 # PM version of ApiTest
    28 $(out)/ApiTestPm.exe: $(src)/ApiTestPm.cpp $(out)/ApiTestPm.res $(src)/ApiTestPm.def
    29         @echo [$@]
    30         gcc -Zomf -I$(inc) $< -o $@ $(src)/ApiTestPm.def
     164
     165# ----------------------------------------------------------------------- [all]
     166# A 'well-known' target which we forward to building all 3 variants
     167# -----------------------------------------------------------------------------
     168all: owcc.build.all
     169#       @echo [$@]
     170
     171
     172# ------------------------------------------------------------ [owcc.build.all]
     173# This builds all 3 variants using Open Watcom
     174# -----------------------------------------------------------------------------
     175# Double colon targets are executed in sequence and each target can have their
     176# own target-specific macros. We just use them to display the target-name that
     177# is invoked and to be able to selectively comment-out the invocation of
     178# targets declared on the dependency list, which is now split-up over multiple
     179# '::'-targets.
     180# -----------------------------------------------------------------------------
     181owcc.build.all::
     182        @$(nl)
     183        @echo [$@]
     184        @echo Building all 3 variants using Open Watcom
     185owcc.build.all:: owcc.build.pm32
     186owcc.build.all:: owcc.build.odin32
     187owcc.build.all:: owcc.build.win32
     188
     189
     190# ----------------------------------------------------------- [owcc.build.pm32]
     191# This builds the Pm32 variant using Open Watcom
     192# -----------------------------------------------------------------------------
     193# Because the dependency list gets evaluated before the target-specific macros,
     194# $(modulename) is not defined yet. This could be solved by '.SECONDEXPANSION:'
     195# and '$(target-specific-var)', but the 'expandproperties' task used in the
     196# code-generator at the developers site currently eats all the '$' characters.
     197# (Ant::<concat><filterchain><expandproperties/></filterchain></concat>)
     198# So we work around this by using $(eval ...), which has the side-effect that
     199# $(modulename) becomes a global variable, but that has no further impact.
     200# -----------------------------------------------------------------------------
     201owcc.build.pm32::
     202        @$(nl)
     203        @echo [$@]
     204        @echo Building 'Pm32' variant using using Open Watcom
     205owcc.build.pm32:: $(eval modulename:=ApiTestPm)
     206owcc.build.pm32:: cc:=owcc
     207owcc.build.pm32:: cc.flags.sys:=-b os2v2
     208owcc.build.pm32:: cc.flags.pre:=-xc -Wc,"-q -bc" -Wl,"op q" -fo=$(out)/.obj
     209owcc.build.pm32:: cc.flags.pre+=-fd=$(out)/$(modulename).wlk
     210owcc.build.pm32:: cc.flags.pre+=-fm=$(out)/$(modulename).map
     211owcc.build.pm32:: cc.flags.incdirs:=-I. -I$(inc)
     212owcc.build.pm32:: cc.flags.libdirs:=
     213owcc.build.pm32:: cc.flags.libs:=
     214owcc.build.pm32:: cc.flags.post:=
     215owcc.build.pm32:: cc.defines:=-DNULL=0
     216owcc.build.pm32:: module.def:=
     217owcc.build.pm32:: export INCLUDE:=$(OW_OS2V2_INCPATH)
     218owcc.build.pm32:: export LIB:=
     219owcc.build.pm32:: $(out)/$(modulename).exe
     220
     221
     222# --------------------------------------------------------- [owcc.build.odin32]
     223# This builds the Odin32 variant using Open Watcom
     224# -----------------------------------------------------------------------------
     225owcc.build.odin32::
     226        @$(nl)
     227        @echo [$@]
     228        @echo Building 'Odin32' variant using using Open Watcom
     229owcc.build.odin32:: $(eval modulename:=ApiTestOdin)
     230owcc.build.odin32:: cc:=owcc
     231owcc.build.odin32:: cc.flags.sys:=-b os2v2
     232owcc.build.odin32:: cc.flags.pre:=-xc -Wc,"-q -bc" -Wl,"op q" -fo=$(out)/.obj
     233owcc.build.odin32:: cc.flags.pre+=-fd=$(out)/$(modulename).wlk
     234owcc.build.odin32:: cc.flags.pre+=-fm=$(out)/$(modulename).map
     235owcc.build.odin32:: cc.flags.incdirs:=-I. -I$(inc)
     236owcc.build.odin32:: cc.flags.libdirs:=
     237owcc.build.odin32:: cc.flags.libs:=
     238owcc.build.odin32:: cc.flags.post:=-Wl,"file {$(out)/ApiTestOdin.ors} lib {$(ODIN32SDK_LIBS)}"
     239owcc.build.odin32:: cc.defines:=-DNULL=0 -D__i386__ -D__WIN32OS2__
     240owcc.build.odin32:: module.def:=
     241owcc.build.odin32:: export INCLUDE:=$(OW_OS2V2_INCPATH);$(ODIN32SDK_INCPATH)
     242owcc.build.odin32:: export LIB:=$(ODIN32SDK_LIBPATH)
     243owcc.build.odin32:: $(out)/$(modulename).exe
     244
     245
     246# ---------------------------------------------------------- [owcc.build.win32]
     247# This builds the Win32 variant using Open Watcom
     248# -----------------------------------------------------------------------------
     249owcc.build.win32::
     250        @$(nl)
     251        @echo [$@]
     252        @echo Building 'Win32' variant using using Open Watcom
     253owcc.build.win32:: $(eval modulename:=ApiTestWin)
     254owcc.build.win32:: cc:=owcc
     255owcc.build.win32:: cc.flags.sys:=-b nt
     256owcc.build.win32:: cc.flags.pre:=-xc -Wc,"-q -bc" -Wl,"op q" -fo=$(out)/.obj
     257owcc.build.win32:: cc.flags.pre+=-fd=$(out)/$(modulename).wlk
     258owcc.build.win32:: cc.flags.pre+=-fm=$(out)/$(modulename).map
     259owcc.build.win32:: cc.flags.incdirs:=-I. -I$(inc)
     260owcc.build.win32:: cc.flags.libdirs:=
     261owcc.build.win32:: cc.flags.libs:=
     262owcc.build.win32:: cc.flags.post:=
     263owcc.build.win32:: cc.defines:=-DNULL=0
     264owcc.build.win32:: module.def:=
     265owcc.build.win32:: export INCLUDE:=$(OW_WIN32_INCPATH)
     266owcc.build.win32:: export LIB:=
     267owcc.build.win32:: $(out)/$(modulename).exe
     268
     269
     270# ------------------------------------------------------------- [gcc.build.all]
     271# This builds the Pm32 and Odin32 variants using the GNU/2 tool-chain
     272# -----------------------------------------------------------------------------
     273gcc.build.all::
     274        @$(nl)
     275        @echo [$@]
     276        @echo Building 'Pm32' and 'Odin32' variants using GCC/2
     277gcc.build.all:: gcc.build.pm32
     278gcc.build.all:: gcc.build.odin32
     279#gcc.build.all:: gcc.build.win32
     280
     281
     282# ----------------------------------------------------------- [gcc.build.pm32]
     283# This builds the Pm32 variant using the GNU/2 tool-chain
     284# -----------------------------------------------------------------------------
     285gcc.build.pm32::
     286        @$(nl)
     287        @echo [$@]
     288        @echo Building 'Pm32' variant using using GCC/2
     289gcc.build.pm32:: $(eval modulename:=ApiTestPm)
     290gcc.build.pm32:: cc:=gcc
     291gcc.build.pm32:: cc.flags.sys:=-Zomf -Zmap
     292gcc.build.pm32:: cc.flags.pre:=-xc
     293gcc.build.pm32:: cc.flags.incdirs:=-I. -I$(inc)
     294gcc.build.pm32:: cc.flags.libdirs:=
     295gcc.build.pm32:: cc.flags.libs:=
     296gcc.build.pm32:: cc.flags.post:=-Wl,"$(src)/$(modulename).def"
     297gcc.build.pm32:: cc.defines:=-DNULL=0
     298gcc.build.pm32:: module.def:=
     299gcc.build.pm32:: export INCLUDE:=
     300gcc.build.pm32:: export C_INCLUDE_PATH:=
     301gcc.build.pm32:: export CPLUS_INCLUDE_PATH:=
     302gcc.build.pm32:: $(out)/$(modulename).exe
     303
     304
     305# ---------------------------------------------------------- [gcc.build.odin32]
     306# This builds the Odin32 variant using the GNU/2 tool-chain
     307# -----------------------------------------------------------------------------
     308gcc.build.odin32::
     309        @$(nl)
     310        @echo [$@]
     311        @echo Building 'Odin32' variant using using GCC/2
     312gcc.build.odin32:: $(eval modulename:=ApiTestOdin)
     313gcc.build.odin32:: cc:=gcc
     314gcc.build.odin32:: cc.flags.sys:=-Zomf -Zmap
     315gcc.build.odin32:: cc.flags.pre:=-xc
     316gcc.build.odin32:: cc.flags.incdirs:=-I. -I$(inc)
     317gcc.build.odin32:: cc.flags.libdirs:=$(call libdirs2flags.gcc,$(ODIN32SDK_LIBDIRS))
     318gcc.build.odin32:: cc.flags.libs:=$(call libnames2flags.gcc,$(ODIN32SDK_LIBS))
     319gcc.build.odin32:: cc.flags.post:=-Wl,"$(out)/ApiTestOdin.ors" -Wl,"$(src)/$(modulename).def"
     320gcc.build.odin32:: cc.defines:=-DNULL=0 -D__i386__ -D__WIN32OS2__
     321gcc.build.odin32:: export INCLUDE:=$(ODIN32SDK_INCPATH)
     322gcc.build.odin32:: export C_INCLUDE_PATH:=$(ODIN32SDK_INCPATH)
     323gcc.build.odin32:: export CPLUS_INCLUDE_PATH:=$(ODIN32SDK_INCPATH)
     324gcc.build.odin32:: module.def:=
     325gcc.build.odin32:: $(out)/$(modulename).exe
     326
     327
     328# ------------------------------------------------------------- [ApiTestPm.exe]
     329# Build the Pm32 target executable (LX)
     330# -----------------------------------------------------------------------------
     331$(out)/ApiTestPm.exe: $(src)/ApiTestPm.cpp $(out)/ApiTestPm.res $(module.def)
     332        @echo [$@]
     333        $(cc) $(cc.flags.sys) $(cc.flags.pre) $(cc.flags.incdirs) $(cc.flags.libdirs) $(cc.flags.libs) $(cc.flags.post) $(cc.defines) $< -o $@
    31334        wrc -q -bt=os2 -zm $*.res $@
    32335
     336
     337# ------------------------------------------------------------- [ApiTestPm.res]
     338# Compile the Pm32 resources to binary form
     339# -----------------------------------------------------------------------------
    33340$(out)/ApiTestPm.res: $(src)/ApiTestPm.rc
    34341        @echo [$@]
     342        @if not exist $(out) mkdir $(out)
    35343        wrc -q -r -bt=os2 -zm -fo=$@ $<
    36344
    37 # The default target
    38 default: $(out)/ApiTestPm.exe
    39 #       @echo [$@]
    40 
    41 # Redirect to target 'default'
     345
     346# ----------------------------------------------------------- [ApiTestOdin.exe]
     347# Build the Odin32 target executable (LX)
     348# -----------------------------------------------------------------------------
     349$(out)/ApiTestOdin.exe: $(src)/ApiTestOdin.cpp $(out)/ApiTestOdin.ors $(module.def)
     350        @echo [$@]
     351        $(cc) $(cc.flags.sys) $(cc.flags.pre) $(cc.flags.incdirs) $(cc.flags.libdirs) $(cc.flags.libs) $(cc.flags.post) $(cc.defines) $< -o $@
     352
     353
     354# ----------------------------------------------------------- [ApiTestOdin.ors]
     355# Translate the Win32 resource source to binary form
     356# -----------------------------------------------------------------------------
     357# Resources for Odin Based applications (LX) are bound by first translating
     358# the Win32 resource source (.rc) to Assembly and then assembling the assembler
     359# source (.s) to an object file (.ors), which is linked-in when building the
     360# target executable. This target performs those steps and could be considered
     361# a case of 'early binding' as opposed to normal resource binding (.res) which
     362# is done after the target executable is built, which is 'late binding'.
     363# Unlike with regular Odin kBuilds, we do not use the 'rsrc' suffix on the
     364# modulename, but name the object '.ors', which is short for 'object resource'.
     365# The '.ors' file is in regular OMF however.
     366# -----------------------------------------------------------------------------
     367$(out)/ApiTestOdin.ors: $(src)/ApiTestOdin.rc
     368        @echo [$@]
     369        @if not exist $(out) mkdir $(out)
     370        winerc -D__WIN32OS2__ -s $(cc.flags.incdirs) -I$(src) $< -o $*.s
     371        as -Zomf $*.s -o $@
     372
     373
     374# ------------------------------------------------------------ [ApiTestWin.exe]
     375# Build the Win32 target executable (PE)
     376# -----------------------------------------------------------------------------
     377$(out)/ApiTestWin.exe: $(src)/ApiTestWin.cpp $(out)/ApiTestWin.res $(module.def)
     378        @echo [$@]
     379        $(cc) $(cc.flags.sys) $(cc.flags.pre) $(cc.flags.incdirs) $(cc.flags.libdirs) $(cc.flags.libs) $(cc.flags.post) $(cc.defines) $< -o $@ $(module.def)
     380        wrc -q -bt=nt -zm $*.res $@
     381
     382
     383# ------------------------------------------------------------ [ApiTestWin.res]
     384# Compile the Win32 resources to binary form
     385# -----------------------------------------------------------------------------
     386$(out)/ApiTestWin.res: $(src)/ApiTestWin.rc
     387        @echo [$@]
     388        @if not exist $(out) mkdir $(out)
     389        wrc -q -r -bt=nt -zm -fo=$@ $<
     390
     391
     392# --------------------------------------------------------------------- [build]
     393# Redirect to a target that is considered to do the default build
     394# -----------------------------------------------------------------------------
    42395build: default
    43396#       @echo [$@]
    44397
    45 # Cleanup files
     398
     399# ------------------------------------------------------------------ [run.pm32]
     400# Run the Pm32 variant
     401# -----------------------------------------------------------------------------
     402run.pm32: owcc.build.pm32
     403        @echo [$@]
     404        $(out)\ApiTestPm.exe
     405
     406
     407# ---------------------------------------------------------------- [run.odin32]
     408# Run the Odin32 variant
     409# -----------------------------------------------------------------------------
     410# Observation: *** App compiled as WINDOWAPI is started as WINDOWCOMPAT ***
     411# Starting a WINDOWAPI compiled Odin Based app directly (without 'cmd /c')
     412# starts it a WINDOWCOMPAT, thus waiting for it to end and stdout visible on
     413# the console. Using 'cmd /c' makes the starting behave correctly for both
     414# WINDOWCOMPAT and WINDOWAPI. Both 'make' and 'kmk' exhibit this behavior while
     415# 'nmake' (v4.00) does not. I wonder if this is related to the pe/pec quirk
     416# below...
     417# -----------------------------------------------------------------------------
     418run.odin32: owcc.build.odin32
     419        @echo [$@]
     420#       $(out)\ApiTestOdin.exe
     421        cmd /c $(out)\ApiTestOdin.exe
     422
     423
     424# ------------------------------------------------------------- [run.win32.pec]
     425# Run the Win32 variant using pec
     426# -----------------------------------------------------------------------------
     427# Quirk: *** Both pe and pec fail when started from 'make' or 'kmk' ***
     428# The pec.exe program pops up a stange dialog about not finding '?kLIBc?.exe'.
     429# The pe.exe program does not even show anything but returns with an error.
     430# Possibly an environment (shell? / klibc?) issue.
     431# Under investigation; for now 'cmd /c' works around this issue.
     432# -----------------------------------------------------------------------------
     433run.win32.pec: owcc.build.win32
     434        @echo [$@]
     435#       pec $(out)\ApiTestWin.exe
     436        cmd /c pec $(out)\ApiTestWin.exe
     437
     438
     439# ---------------------------------------------------------- [run.win32.win32k]
     440# Run the Win32 variant using the win32k.sys driver
     441# -----------------------------------------------------------------------------
     442run.win32.win32k: owcc.build.win32
     443        @echo [$@]
     444        $(out)\ApiTestWin.exe
     445
     446# ----------------------------------------------------------- [gen.tools.flags]
     447# Dump the usage flags of some tools used
     448# -----------------------------------------------------------------------------
     449gen.tools.flags:
     450        @echo [$@]
     451        -owcc -? 2> .flags.owcc
     452        -wcc386 > .flags.wcc386
     453        -wpp386 > .flags.wpp386
     454        -wcl386 > .flags.wcl386
     455        -gcc --help > .flags.gcc
     456        -gcc --help=common > .flags.gcc.common
     457
     458# --------------------------------------------------------------------- [clean]
     459# Cleanup by removing the complete out-directory
     460# -----------------------------------------------------------------------------
    46461clean:
    47462        @echo [$@]
    48         rm -f -v $(out)/*.exe $(out)/*.res
    49 
    50 # Run the program
    51 run: build
    52         @echo [$@]
    53         $(out)/ApiTestPm.exe
    54 
    55 # Distribute to somewhere (NI)
    56 dist:
    57         @echo [$@]
     463        rm -rf -v $(out)
     464#       rd $(out)
  • branches/swt/testapp/apitest/README

    r22107 r22112  
     1#! GENINFO :: platform:OS/2, version:20.45, target:ApiTest.generate
    12:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    23:: ApiTest -- A program to test several aspects of the Odin32 API            ::
  • branches/swt/testapp/apitest/doc/ApiTest.txt

    r22107 r22112  
     1#! GENINFO :: platform:OS/2, version:20.45, target:ApiTest.generate
    12:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    23:: ApiTest -- Additional Information                                         ::
     
    1617SwtOs2Demo contains a test-module. However, this test-module is not completely
    1718sufficient because it uses the SWT-JNI layer which makes is harder to identify
    18 Odin32 specific issues and most omportantly, where best to fix these.
     19Odin32 specific issues and most importantly, where best to fix these.
    1920
    2021
     
    4243The UniScribe and GdiPlus modules are examples of such modules, modules where
    4344Odin32 either has partial implementation, or none at all. The third purpose of
    44 the ApiTest program is to aid in the implementation of the missing modules.
     45the ApiTest program is to aid in the implementation of these missing modules.
    4546
    4647
     
    5556The multi-toolchain part means that besides the standard GCC-OS/2 toolchain,
    5657other toolchains like Open Watcom, MinGW, IBM Visual Age/Win, MS Visual Studio,
    57 ..., can be used.
     58Borland C/C++, etc., can be used.
    5859
    5960
     
    6465Building ApiTest as part of a normal Odin32 build has been enabled by providing
    6566the required kBuild Makefile. Note that the regular kBuild build will only
    66 build ApiTest as an Odin Based application using the GCC-OS/2 toolchain.
     67build ApiTest as an Odin Based application using the GCC-OS/2 toolchain. This
     68is of course the variant of interest with regard to testing the Odin32-API.
    6769
    6870
    6971Building the other ApiTest variants
    7072-----------------------------------
    71 To build the other variants of ApiTest, a regular 'GNUmakefile' is presents in
    72 the 'testapp/apitest' directory. This Makefile will extend with the addition
     73To build the other variants of ApiTest, a regular 'GNUmakefile' is present in
     74the 'testapp/apitest' directory. This Makefile will extended with the addition
    7375of targets and toolchains. To provide an easy menu-driven build-interface,
    7476a File Commander/2 user-menu is present. Just navigate with FC/2 to the
     
    8688sources seem to contain identical code, which could easily be combined using
    8789#ifdef statements. In the case of Software Modeling however, such code is
    88 generated from the same snippet and doing away with #ifdef calrifies sources.
     90generated from the same snippet and doing away with #ifdef clarifies sources.
    8991Another thing that might catch attention is the unusual use of 'do-while'.
    9092This is done to create a snippet which is a kind of independent entity with
    91 the possibility to use 'break' to escape from the do-while block.
     93the possibility to use 'break' to escape from the do-while block. One of the
     94many advantages of using Software Modeling is that it is possible to inject all
     95kinds of debug and test code without using conditional compilation. Producing
     96release source-code is just a regeneration-without-debug away.
  • branches/swt/testapp/apitest/fc.mnu

    r22107 r22112  
     1#! GENINFO :: platform:OS/2, version:20.45, target:ApiTest.generate
    12#
    2 # Simple User Menu for File Commander.
     3# User Menu for File Commander to build the 3 variants.
    34# Info: Starting with File Commander v2.40, XML syntax highlighting is functional.
    45#
    56
    6 #
    7 # Very, very simple Build Menu.
    8 #
    97B:      Build
    10         make build
     8{
     9D:      Default (Odin32 variant)    [owcc]
     10        make -B owcc.build.odin32
     11A:      All variants                [owcc]
     12        make -B owcc.build.all
     13-:      ----------------------------------
     14P:      Pm32 variant                [owcc]
     15        make -B owcc.build.pm32
     16O:      Odin32 variant              [owcc]
     17        make -B owcc.build.odin32
     18W:      Win32 variant               [owcc]
     19        make -B owcc.build.win32
     20-:      ----------------------------------
     21G:      GNU Tool Chain
     22{
     23D:      Default (Odin32 variant)    [gcc]
     24        make -B gcc.build.odin32
     25A:      All variants                [gcc]
     26        make -B gcc.build.all
     27-:      ---------------------------------
     28P:      Pm32 variant                [gcc]
     29        make -B gcc.build.pm32
     30O:      Odin32 variant              [gcc]
     31        make -B gcc.build.odin32
     32}
     33}
     34R:      Run
     35{
     36D:      Default (Odin32 variant)
     37        make run.odin32
     38-:      --------------------------------
     39P:      Pm32 variant
     40        make run.pm32
     41O:      Odin32 variant
     42        make run.odin32
     43W:      Win32 variant (using pec.exe)
     44        make run.win32.pec
     45-:      --------------------------------
     46K:      Win32 variant (using win32k.sys)
     47        make run.win32.win32k
     48}
     49G:      Generate Tools Flags
     50        make gen.tools.flags
    1151C:      Clean
    1252        make clean
    13 R:      Run
    14         make run
  • branches/swt/testapp/apitest/src/ApiTestPm.cpp

    r22109 r22112  
    1 
     1//! GENINFO :: platform:OS/2, version:20.45, target:ApiTest.generate
    22/*****************************************************************************\
    3 * ApiTestPm.cpp                                                               *
     3* ApiTestPm.cpp :: This is the PM variant of ApiTest                          *
    44* --------------------------------------------------------------------------- *
    5 * This is the PM version of the ApiTest program.                              *
    6 * It is used as a casco to construct the basic structure.                     *
    7 * Note that this is not the program of focus, that would be the Odin32 and    *
    8 * Win32 variants which will use the Odin32-API and will be added in upcoming  *
    9 * commits.                                                                    *
     5* The PM version has a different purpose than the Odin Based and Windows      *
     6* variants. Here the focus is not directly on testing the Odin32-API, but     *
     7* rather on testing the OS/2-API. While Odin implements a lot of Win32        *
     8* functionality from scratch, there are also situations where things are      *
     9* delegated to OS/2. This variant provides that angle.                        *
    1010\*****************************************************************************/
    1111
    1212
    1313/*
    14 // Include the standard C/C++ headers.
     14// Standard C/C++ Headers
    1515*/
    1616#include    <stdlib.h>
     
    1818#include    <string.h>
    1919
    20 /*
    21 // Include the Platform headers for OS/2.
     20
     21
     22/*
     23// Platform Headers for OS/2
    2224*/
    2325#define     INCL_DOS
     
    2628
    2729
    28 /*
    29 // Module related include-files.
     30
     31/*
     32// Module Headers
    3033*/
    3134#include    "ids.h"
    32 
    33 /*
    34 // Minimal Window Procedure.
    35 */
    36 MRESULT EXPENTRY    PmWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
     35#include    "ApiTestPm.hpp"
     36
     37
     38
     39/*
     40// Minimal Window Procedure
     41*/
     42MRESULT EXPENTRY Pm32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
    3743    /*
    3844    // Local Variables follow here.
     
    5460            /*
    5561            // Create a button on the client-window
    56             // ------------------------------------
    57             // So we can quickly exit the application by just pressing
    58             // the space-bar.
    5962            */
    6063            do {
     
    6366                /* Create the button */
    6467                hwndButton = WinCreateWindow(
    65                     hwnd,                       // Parent (client-window)
    66                     WC_BUTTON,                  // We want a window of class WC_BUTTON
    67                     (PSZ)"Bye",                 // The button-text
    68                     WS_VISIBLE|BS_PUSHBUTTON,   // Make it visible
    69                     20,                         // The x-pos from llc
    70                     20,                         // The y-pos from llc
    71                     100,                        // Width of the button
    72                     50,                         // Height of the button
    73                     hwnd,                       // Owner (client-window)
    74                     HWND_TOP,                   // Z-order
    75                     ID_EXIT,                    // Window ID
    76                     NULL,                       // Control Data (none)
    77                     NULL                        // Presentation Parameters (none)
     68                    hwnd,                           // Parent (client-window)
     69                    WC_BUTTON,                      // We want a window of class WC_BUTTON
     70                    (PSZ)"Bye",                     // The button-text
     71                    WS_VISIBLE|BS_PUSHBUTTON,       // Make it visible
     72                    20,                             // The x-pos from llc
     73                    20,                             // The y-pos from llc
     74                    100,                            // Width of the button
     75                    50,                             // Height of the button
     76                    hwnd,                           // Owner (client-window)
     77                    HWND_TOP,                       // Z-order
     78                    ID_EXIT,                        // Window ID
     79                    NULL,                           // Control Data (none)
     80                    NULL                            // Presentation Parameters (none)
    7881                );
    7982                /* Give the focus to the button */
     
    120123                    printf("WM_COMMAND received, id: %04d\n", SHORT1FROMMP(mp1));
    121124                    break;
    122 
     125                default:
     126                    mres = WinDefWindowProc(hwnd, msg, mp1, mp2);
     127                    break;
    123128            }
    124129            break;  /*WM_COMMAND*/
     
    133138
    134139        /*
     140        // Request to quit the application.
     141        */
     142        case WM_QUIT:
     143            printf("WM_QUIT received\n");
     144            mres = WinDefWindowProc(hwnd, msg, mp1, mp2);
     145            break;
     146
     147        /*
    135148        // Request to close the application.
     149        // On PM this this posts a WM_QUIT message which in turn terminates
     150        // the message-loop. Only an explicit call to WinDestroyWindow()
     151        // seems to generate a WM_DESTROY message, which we do after the loop
     152        // has terminated.
     153        // On Win32 WM_CLOSE does a DestroyWindow() but does not post a WM_QUIT
     154        // message and thus does not terminate the message-loop.
    136155        */
    137156        case WM_CLOSE:
     
    142161        /*
    143162        // Window is being destroyed, time to cleanup resources allocated.
     163        // This message seems only to be sent on a WinDestroyWindow() call.
     164        // When clicking the close-button and not doing an explicit
     165        // WinDestroyWindow() does not output the message below.
    144166        */
    145167        case WM_DESTROY:
     
    166188
    167189/*
    168 // PmMain Selective EntryPoint.
    169 */
    170 int     PmMain(int argc, char* argv[]) {
     190// Gui EntryPoint for Presentation Manager
     191*/
     192int APIENTRY PmMain(int argc, char* argv[]) {
    171193    BOOL    brc     = FALSE;    // Boolean return values
    172194    APIRET  ulrc    = -1;       // Numeric return values
     
    185207                FCF_TASKLIST        // Put the beast in the task-list
    186208            };
    187     PSZ     pszClassClient  = (PSZ) "PmMainWindow";             // Window Class Name
    188     PSZ     pszTitle        = (PSZ) "ApiTestPm :: Main Window"; // Window Title
     209    PSZ     pszClassClient  = (PSZ) "ApiTestPm";                // Window Class Name
     210    PSZ     pszTitle        = (PSZ) "ApiTestPm :: Main Window [generated:201601252233]";    // Window Title
    189211    ULONG   flStyleClient   = 0;                                // Style for Client Window
    190212    HWND    hwndFrame       = NULL;                             // Receives handle for Frame Window
    191213    HWND    hwndClient      = NULL;                             // Receives handle for Client Window
    192 
    193214
    194215
     
    207228
    208229
    209 
    210230    /* Initialize the PM Graphics System */
    211231    hab = WinInitialize(NULL);
     
    215235
    216236    /* Register the class of the Main Window */
    217     brc = WinRegisterClass(hab, pszClassClient, PmWindowProc, CS_SIZEREDRAW,  0);
     237    brc = WinRegisterClass(hab, pszClassClient, Pm32WindowProc, CS_SIZEREDRAW,  0);
    218238
    219239    /* Create the Main Window */
     
    229249        &hwndClient         // Storage for Client Handle
    230250    );
    231 
    232251
    233252
     
    250269        printf("Continuing program...\n");
    251270    } while (0);
    252 
    253271
    254272
     
    272290        WinDispatchMsg(hab, &qmsg);
    273291
     292    /* Destroy the Main Window -- causes WM_DESTROY to be sent */
     293    brc = WinDestroyWindow(hwndFrame);
     294
    274295    /* Destroy the message-queue for this (main) thread */
    275296    brc = WinDestroyMsgQueue(hmq);
     
    286307
    287308
    288 /*
    289 // This is the standard C/C++ EntryPoint.
     309
     310/*
     311// This is the standard C/C++ EntryPoint
    290312*/
    291313int     main(int argc, char* argv[]) {
    292314    printf("\n");
    293315    printf("%s\n","###############################################################################");
    294     printf("%s\n","# This is the PM version of ApiTest                      version.201512030711 #");
     316    printf("%s\n","# This is the PM variant of ApiTest                      version.201601252233 #");
    295317    printf("%s\n","###############################################################################");
    296318    printf("\n");
  • branches/swt/testapp/apitest/src/ApiTestPm.def

    r22109 r22112  
     1;#! GENINFO :: platform:OS/2, version:20.45, target:ApiTest.generate
    12;##############################################################################
    23;# ApiTestPm.def :: Module Definition file                                    #
    34;# -------------------------------------------------------------------------- #
    4 ;# PmApiTest is the PM version of the ApiTest program.                        #
    5 ;# It has a different purpose than the Odin32 based and Native Win32 versions,#
    6 ;# which is to test Odin32 from Native PM.                                    #
    7 ;# This version has low development priority since it does not directly       #
    8 ;# connect to SWT-OS2, which is the project depending on Odin32.              #
     5;# This is the PM variant of the ApiTest program.                             #
     6;# Purpose is to test the OS/2-API in areas where Odin32 delegates to it.     #
    97;##############################################################################
    108
    11 
    12 NAME            ApiTestPm   WINDOWCOMPAT
     9;NAME           ApiTestPm       WINDOWAPI           ; PM
     10NAME            ApiTestPm       WINDOWCOMPAT        ; CLI
    1311DESCRIPTION     'A Program to test the Odin32 API from Native PM'
    14 
  • branches/swt/testapp/apitest/src/ApiTestPm.rc

    r22110 r22112  
     1//! GENINFO :: platform:OS/2, version:20.45, target:ApiTest.generate
    12/*****************************************************************************\
    2 * resource.rc :: PM Resources                                                 *
     3* ApiTestPm.rc :: PM Resources                                                *
    34* --------------------------------------------------------------------------- *
    45* OS/2 resource management is different from Win32 resource management.       *
  • branches/swt/testapp/apitest/src/ids.h

    r22107 r22112  
     1//! GENINFO :: platform:OS/2, version:20.45, target:ApiTest.generate
    12/*****************************************************************************\
    23* ids.h :: Numeric Resource Identifiers                                       *
    34* --------------------------------------------------------------------------- *
    4 * Used by all buildable versions of ApiTest.                                  *
     5* Used by all buildable variants of ApiTest.                                  *
    56\*****************************************************************************/
    67
Note: See TracChangeset for help on using the changeset viewer.