Author Topic: Compiling a PM sample with GCC (2023)  (Read 16681 times)

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4402
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #135 on: May 31, 2023, 07:22:24 pm »
Now the classic Hanoi Tower.
https://github.com/OS2World/DEV-SAMPLES-IBM_OS2_2-0_Toolkit/tree/master/C/SAMPLES/HANOI

It compiles and run fine. Removed all warnings.

But I lack experience with wipf to generate the .hlp file.
I get this error:

Quote
wipfc hanoi.ipf
Open Watcom OS/2 Help Compiler Version 2.0beta4 Limited Availability by GKYMar  2 2022
Copyright (c) 2010 Open Watcom Contributors. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
<hanoi.ipf:0:0> Fatal Error 10: Invalid language code
make: *** [hanoi.hlp] Error 255

Any tip of what may be wrong with wipfc or the .ipf file?

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Lars

  • Hero Member
  • *****
  • Posts: 1196
  • Karma: +63/-0
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #136 on: May 31, 2023, 07:40:38 pm »
Try to force a localization of en_US (I suppose your LANG env var is set to something that wipfc does not understand):

wipfc -l en_US ....

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4402
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #137 on: June 01, 2023, 03:40:43 pm »
Hi Lars

It gives me the same error with wipfc -l en_US.

Quote
wipfc -l en_US hanoi.ipf
Open Watcom OS/2 Help Compiler Version 2.0beta4 Limited Availability by GKYMar  2 2022
Copyright (c) 2010 Open Watcom Contributors. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
<hanoi.ipf:0:0> Fatal Error 10: Invalid language code
make: *** [hanoi.hlp] Error 255


Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4502
  • Karma: +92/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #138 on: June 01, 2023, 04:47:39 pm »
Here, I got,
Code: [Select]
wipfc hanoi.ipf
Open Watcom OS/2 Help Compiler Version 2.0beta1 Limited Availability
Copyright (c) 2010 Open Watcom Contributors. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
<hanoi.ipf:125:1> Warning 31: Unable to find the id or name for this reference
<hanoi.ipf:133:1> Warning 31: Unable to find the id or name for this reference
<hanoi.ipf:141:1> Warning 31: Unable to find the id or name for this reference
<hanoi.ipf:149:1> Warning 31: Unable to find the id or name for this reference
<hanoi.ipf:157:1> Warning 31: Unable to find the id or name for this reference
<hanoi.ipf:165:1> Warning 31: Unable to find the id or name for this reference
and a hanoi.hlp file.
Note that I had to install watcom-wipfc with ANPM and it wanted a reboot before it worked. It added
Code: [Select]
SET WIPFC=W:\usr\share\os2\wipfcto my config.sys.
Using ipfc, I see the warning,
Code: [Select]
Compiling document with following Country Code, Code Page:
1, 850

<hanoi.ipf:167> Warning 208: Missing tag [euserdoc]

Also I had to comment out this, as prodinfo.bmp is missing
Code: [Select]
/* BITMAP IDR_BITMAP "..\\prodinfo.bmp"*/

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4402
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #139 on: June 01, 2023, 07:14:30 pm »
Hi Dave

You are right. I found an issue in my config.sys. I had a wipfc mess there.

Now it generates the .hlp and works, I also got the:
"<hanoi.ipf:125:1> Warning 31: Unable to find the id or name for this reference..."
..etc.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4502
  • Karma: +92/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #140 on: June 02, 2023, 01:44:41 am »
Hi Dave

You are right. I found an issue in my config.sys. I had a wipfc mess there.

Now it generates the .hlp and works, I also got the:
"<hanoi.ipf:125:1> Warning 31: Unable to find the id or name for this reference..."
..etc.

Regards

Probably should compare the wipf and ipfc help files. Wipf isn't 100% compatible and those warning might mean something. Not that it matters much with these example programs

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4402
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #141 on: June 02, 2023, 04:13:07 am »
Thanks Dave.
I need to read more about ipf file format.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4402
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #142 on: June 02, 2023, 05:24:39 am »
Hi

I'm checking Jigsaw sample now.
https://github.com/OS2World/DEV-SAMPLES-C-PM-Jigsaw

It compiles, works and removed all warning, with the exception of this little one:
Quote
gcc -Wall -Zomf -c -O2 procs.c -o procs.obj
procs.c: In function 'WndProcPaint':
procs.c:205:10: warning: variable 'sRgnType' set but not used [-Wunused-but-set-variable]
  205 |   SHORT  sRgnType;
      |          ^~~~~~~~

If I comment "SHORT  sRgnType;" and "sRgnType = WinQueryUpdateRegion( hwndClient, hrgnUpdt); " the program gets unstable when opening a file.  So, even if it tells me that it is "not used", if I remove it, the program will not work.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4502
  • Karma: +92/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #143 on: June 02, 2023, 05:52:44 am »
According to the Presentation Manager Programming Guide, sRgnType should be a long.
Code: [Select]
This call obtains an update region of a window.


#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HWND    hwnd;         /*  Handle of window whose update region is to be queried. */
HRGN    hrgn;         /*  Handle of the window's update region. */
LONG    lComplexity;  /*  Complexity of resulting region/error indicator. */

lComplexity = WinQueryUpdateRegion(hwnd, hrgn);

It's like the rc in a previous example, there could be "Complexity of resulting region/error indicator"  checking later or can look at the variable in a debugger.
Considering the documentation shows the syntax shows using a variable like sRgnType, I'd leave it in even if it didn't hurt to remove it.

Lars

  • Hero Member
  • *****
  • Posts: 1196
  • Karma: +63/-0
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #144 on: June 02, 2023, 12:32:53 pm »
Hi.
I also don't have "SMVDD.SYS"

I found a reference on this book: https://komh.github.io/os2books/pdf/sg244627.pdf
(The Guide to OS/2 Warp Device Drivers. December 1995)

"This driver provides DOS and WIN-OS/2 digital video support. If you do not use DOS or WIN-OS/2 that require digital video support you can remove this driver from CONFIG.SYS."

Checking the readme it says:

Quote
SHOW.ZIP is an exectuable and source code which shows you how to
use DIVE (Direct Interface to Video Extensions) to directly
access the video display. It is useful for games and other apps
which need SPEED!  You actually write directly to video memory.

It contains the following items:

L        CMD  sample linker file
DIRECT   H    fucntion prototypes
SHOW     EXE  program to display a bitmap
SHOW     C    source code for DIVE interface
SMVDD    SYS  Device driver to map addresses
CHICK    BMP  Bitmap
DIRECT   C    More DIVE code
C        CMD  Compiler batch file.

SMVDD.SYS - Device driver to map addresses ? uhm?? It does not mach the description.

Regards

One of the features of SMVDD.SYS is (or rather: was) to provide a function to map a physical address (in this case: the screen aperture) to a linear address valid in the caller's address space so that you can access the screen and write to it like you would write to memory. This functionality is also provided by SCREEN01.SYS and since SCREEN01.SYS is contained in any OS/2 system up to present day, SCREEN01.SYS is the correct pick.
It would take a bit of effort to adapt the code.
« Last Edit: June 02, 2023, 12:55:54 pm by Lars »

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4402
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #145 on: June 02, 2023, 05:03:27 pm »
Thanks Lars.

In this case, I'm letting SHOW.ZIP  to rest.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4402
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #146 on: June 02, 2023, 05:18:08 pm »
Hi

I thought I was done with JigSaw...
https://github.com/OS2World/DEV-SAMPLES-C-PM-Jigsaw

But I found that it has the "JIGHELP.RC" file that I'm not using in the makefile.
The program works, but I don't know what is the idea of the "JIGHELP.RC" file.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4502
  • Karma: +92/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #147 on: June 02, 2023, 05:51:35 pm »
I change the jigsaw.res rule to,
Code: [Select]
jigsaw.res: jigsaw.rc jigsaw.h jigsaw.ico jighelp.rc jigsaw.dlg
        wrc -r jigsaw.rc jighelp.rc
Based on JIGSAW.MAK.
I think it is to help open the help at the correct spot

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4402
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling a PM sample with GCC (2023)
« Reply #148 on: June 05, 2023, 05:56:12 am »
Thanks Dave. Jigsaw now is fine with me.
https://github.com/OS2World/DEV-SAMPLES-C-PM-Jigsaw

I'm trying now this different "show" from the OS/2 Warp 4 Toolkit that works with DIVE.
https://github.com/OS2World/DEV-SAMPLES-IBM_Dev_Toolkit_Samples/tree/master/samples/mm/DIVE

I removed the warning, it compiles, but the image does not display on it.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4502
  • Karma: +92/-1
    • View Profile
Re: Compiling a PM sample with GCC (2023)
« Reply #149 on: June 05, 2023, 07:36:57 am »
Works fine here. I did have to adjust your compile.cmd (and a previous one) to be more portable. Basically changed all C: to %UNIXROOT%, which is W: here. Your binary also worked here
Do you have C:\mmos2\dll\dive.dll and is it on your libpath? I'm also running 64K colours if that makes a difference. What does Options-->Query Caps show?
BTW, the program really need slowing down on modern hardware, I'm getting over 18000 frames a second. It looks irritating.