Article View: comp.lang.modula2
Article #1080Re: JPI M2 2.00 - PROCEDURE FUNCTIONS & ERROR CHECKING
From: Ernie Bokkelkamp
Date: Sun, 12 Aug 1990 22:02
Date: Sun, 12 Aug 1990 22:02
74 lines
4394 bytes
4394 bytes
On 08 Aug 1990 07:47, Peter M. Perchansky (1:273/101@Fidonet) wrote:
Hello Peter,
PP> One of the main reasons why most Modula-2 implementations
PP>shines over other language implementations is Modula-2's strong
PP>typing.
Which isn't much help to me at the momemt ;-) The MS-Windows support in TopSpeed allows you to call Windows routines written in Microsoft C from modula-2. There are many tricks required to fool the compiler and therefor it can't do much checking.
PP> Most errors are caught during compilation (which takes only
PP>seconds or minutes) as opposed to during run-time (which can
PP>takes months of testing before poping up).
Except when you have to interface to another language like C. Here is a small section of a windows program to show you what a mess it can be:
----------------------------------------
IF hPrevInstance = Windows.HANDLE(0)
THEN
wndclass.style := Windows.CS_HREDRAW + Windows.CS_VREDRAW;
wndclass.lpfnWndProc := FarADR(WndProc);
wndclass.cbClsExtra := 0;
wndclass.cbWndExtra := 0;
wndclass.hInstance := hInstance;
wndclass.hIcon := Windows.LoadIcon(Windows.HANDLE(0),
Windows.IDI_APPLICATION);
wndclass.hCursor := Windows.LoadCursor(Windows.HANDLE(0),
Windows.IDC_ARROW);
wndclass.hbrBackground := Windows.HBRUSH(Windows.GetStockObject(
Windows.WHITE_BRUSH));
wndclass.lpszMenuName := FarNIL;
wndclass.lpszClassName := Windows.LPSTR(FarADR(szAppName));
IF Windows.RegisterClass(Windows.LPWNDCLASS(FarADR(wndclass))) = 0
THEN
RETURN Windows.FALSE;
END;
END;
hWnd := Windows.CreateWindow(
FarADR(szAppName), (* window class name *)
FarADR("Get System Metrics"), (* window text *)
Windows.WS_TILEDWINDOW (* window style *)
+ Windows.WS_HSCROLL + Windows.WS_VSCROLL,
Windows.CW_USEDEFAULT, (* initial x position *)
0, (* initial y position *)
Windows.CW_USEDEFAULT, (* initial x size *)
0, (* initial y size *)
Windows.HANDLE(0), (* parent window handle *)
Windows.HANDLE(0), (* window menu handle *)
hInstance, (* program instance handle *)
FarNIL); (* create parameters *)
IF Windows.ShowWindow(hWnd,nCmdShow) # 0 THEN END;
-----------------------------------------------------
I want to use the windows user interface because it's is superior to any other user interface I have seen. Also, I do not want to program in C as it's the worst language to read. (No flames, personal opinion) But the extra effort to write windows programs in modula-2 is weakening the advantages of modula-2.
I have found a way to improve the readability a bit by using aliases for all windows calls. I have written a file which has to be incorporated in every definition module which uses the windows library. Unfortunately I can not tell the compiler to include the file during the compilation.
PP> I recently received release 1.05b, and they still did not
PP>implement this feature - even though it is present in JPI M2
PP>1.17.
I should have my update within the next few weeks. Did you receive new manuals and new software ?
Cheers
Ernie
--
uucp: uunet!m2xenix!puddle!5!491!1.22!Ernie.Bokkelkamp
Internet: Ernie.Bokkelkamp@p22.f1.n491.z5.fidonet.org
Technical Details
Message-ID:
<811.26C81274@puddle.fidonet.org>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!dali.cs.montana.edu!ogicse!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p22.f1.n491.z5.fidonet.org!Ernie.BokkelkampShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!dali.cs.montana.edu!ogicse!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p22.f1.n491.z5.fidonet.org!Ernie.Bokkelkamp From: Ernie.Bokkelkamp@p22.f1.n491.z5.fidonet.org (Ernie Bokkelkamp) Newsgroups: comp.lang.modula2 Subject: Re: JPI M2 2.00 - PROCEDURE FUNCTIONS & ERROR CHECKING Message-ID: <811.26C81274@puddle.fidonet.org> Date: 12 Aug 90 22:02:00 GMT Sender: ufgate@puddle.fidonet.org (newsout1.26) Organization: FidoNet node 5:491/1.22 - Golden City Opus, Johannesburg RSA Lines: 74