Powerbasic Museum 2020-B

IT-Berater: Theo Gottwald (IT-Consultant) => ADW Modula Corner => Topic started by: Theo Gottwald on July 16, 2013, 11:20:33 PM

Title: Opinions about ADW Modula
Post by: Theo Gottwald on July 16, 2013, 11:20:33 PM
Ok, you have tried ADW Modula?
You have tried PowerBasic, Oxygen Basic, PureBasic, VS and others?
Whats your opinion on ADW Modula?
Write it here!
Title: Re: Opinions about ADW Modula
Post by: Charles Pegge on July 17, 2013, 10:37:56 PM

I like the separation of declaratice and procedural code. But the Pascal syntax is a bit verbose, and I don't think modules are a sufficient substitute for OOP. Am I missing something?
Title: Re: Opinions about ADW Modula
Post by: Theo Gottwald on July 18, 2013, 09:03:05 AM
Did you try the Debugger?
Title: Re: Opinions about ADW Modula
Post by: José Roca on July 18, 2013, 04:48:27 PM
There are only 50 Windows API files translated and very outdated. There is no way of use the latest technologies without doing an awful ton of previous work.

Debuggers are rarely used by those that write clean and reusable code. Can be useful to those that use globals "à go-go".
Title: Re: Opinions about ADW Modula
Post by: John Spikowski on July 18, 2013, 04:51:53 PM
QuoteDebuggers are rarely used by those that write clean and reusable code.

My universal debugger.

PRINT "Got Here"

Title: Re: Opinions about ADW Modula
Post by: Patrice Terrier on July 18, 2013, 07:23:58 PM
Once again, so exotic  ???

Why the heck are you torturing yourself  ::)
Title: Re: Opinions about ADW Modula
Post by: Theo Gottwald on July 18, 2013, 10:41:19 PM
Ok, so we got some opinions here!
Thats great.
I must admit that until now i was unable to compile ANY working piece of code.
But it was the same with WINDEV.
It would take me more time to switch from the PowerBasic Paradigma.
;D
Title: Re: Opinions about ADW Modula
Post by: John Spikowski on July 18, 2013, 11:46:46 PM
Theo,

If you're looking for advice in your post PB days, I would recommend mastering C first before looking at anything else. Python would be a good secondary language to have under your belt with BASIC to relax with after a long day at the office.

Title: Re: Opinions about ADW Modula
Post by: Patrice Terrier on July 19, 2013, 07:53:22 AM
QuoteBut it was the same with WINDEV.

Theo

There is no comparison, one is years ahead of all you have used until now, and PC-Soft is a big company making lot of profits, thus they can hire some of the most talented C++ french programmers.
Their WLanguage is realy close to the PB syntax, and PowerBASIC DLL work like a charm with it.

It is even possible for a SDK programmer to write plain procedural code with it.
Here is an example


//+--------------------------------------------------------------------------+
//|                                GoldFish                                  |
//|                                                                          |
//|                   Example of 32-bit layered animation                    |
//|                                                                          |
//| This is a SDK FLAT API transposition of a C# project written by Davidwu  |
//|                            www.cnpopsoft.com                             |
//|                                                                          |
//+--------------------------------------------------------------------------+
//|                                                                          |
//|                         Author Patrice TERRIER                           |
//|                            copyright(c) 2008                             |
//|                           www.zapsolution.com                            |
//|                        pterrier@zapsolution.com                          |
//|                                                                          |
//+--------------------------------------------------------------------------+
//|                  Project started on : 09-23-2008 (MM-DD-YYYY)            |
//|                        Last revised : 09-23-2008 (MM-DD-YYYY)            |
//+--------------------------------------------------------------------------+

CONSTANT
    MAX_PATH             = 260
    ERROR_ALREADY_EXISTS = 183
    AC_SRC_OVER          = 0x00
    AC_SRC_ALPHA         = 0x01
    SW_SHOW              = 5
    SW_RESTORE           = 9
    WM_DESTROY           = 0x0002
    WM_NCHITTEST         = 0x0084
    WM_KEYDOWN           = 0x0100
    WM_TIMER             = 0x0113
    HTCAPTION            = 2
    WS_POPUP             = 0x80000000
    WS_EX_TOPMOST        = 0x00000008
    WS_EX_LAYERED        = 0x00080000
    CS_VREDRAW           = 0x0001
    CS_HREDRAW           = 0x0002
    CS_DBLCLKS           = 0x0008
    PM_REMOVE            = 0x0001
    ULW_ALPHA            = 0x00000002
    SM_CXSCREEN          = 0
    SM_CYSCREEN          = 1
    IDC_ARROW            = 32512
   
    GDI32                = "GDI32"
    USER32               = "USER32"
    GDIPLUS              = "GDIPLUS"
    GDIMAGE              = "GDIMAGE"
END

POINTAPI is structure
    x is int   // long x
    y is int   // long y
END

SIZEL is structure
    cx is int   // long x
    cy is int   // long y
END

RECT is structure
    nLeft   is int   // long Left
    nTop    is int   // long top
    nRight  is int   // long Right
    nBottom is int   // long bottom
END

SECURITY_ATTRIBUTES is structure
    nLength               is int   // DWORD nLength
    lpSecurityDescriptor is int   // LPVOID lpSecurityDescriptor
    bInheritHandle       is int   // BOOL bInheritHandle
END

TagMSG is structure
    hWnd    is int          // HWND hwnd
    nMessage is int         // UINT Message
    wParam  is int          // WPARAM wParam
    lParam  is int          // LPARAM lParam
    nTime    is int         // DWORD time
    pt       is POINTAPI    // POINT pt
END

BITMAP is structure
    bmType       is int         //Type C : LONG
    bmWidth      is int         //Type C : LONG
    bmHeight     is int         //Type C : LONG
    bmWidthBytes is int         //Type C : LONG
    bmPlanes     is 2-byte int  //Type C : WORD
    bmBitsPixel  is 2-byte int  //Type C : WORD
    bmBits       is int         //Type C : LPVOID
END

BLENDFUNCTION is structure
    BlendOp             is 1-byte int
    BlendFlags          is 1-byte int
    SourceConstantAlpha is 1-byte int
    AlphaFormat         is 1-byte int
END

WNDCLASSEXA is structure
    cbSize        is unsigned int   //Type C : UINT
    style         is unsigned int   //Type C : UINT
    lpfnWndProc   is int            //Type C : WNDPROC
    cbClsExtra    is int            //Type C : int
    cbWndExtra    is int            //Type C : int
    hInstance     is int            //Type C : HINSTANCE
    hIcon         is int            //Type C : HICON
    hCursor       is int            //Type C : HCURSOR
    hbrBackground is int            //Type C : HBRUSH
    lpszMenuName  is int            //Type C : LPCSTR
    lpszClassName is int            //Type C : LPCSTR
    hIconSm       is int            //Type C : HICON
END

BITMAPINFOHEADER is structure
    biSize          is int
    biWidth         is int
    biHeight        is int
    biPlanes        is 2-byte int
    biBitCount      is 2-byte int
    biCompression   is int
    biSizeImage     is int
    biXPelsPerMeter is int
    biYPelsPerMeter is int
    biClrUsed       is int
    biClrImportant  is int
END

RGBQUAD is structure
    bBlue     is 1-byte int
    bGreen    is 1-byte int
    bRed      is 1-byte int
    bReserved is 1-byte int
END

BITMAPINFO_API is structure
    bmiHeader is BITMAPINFOHEADER   //BITMAPINFOHEADER est une autre structure
    bmiColors is RGBQUAD            //RGBQUAD est une autre structure
END

GdiplusStartupInput is structure
    GdiplusVersion is int             // Must be 1
    DebugEventCallback is int         // Ignored on free builds
    SuppressBackgroundThread is int   // False unless you//re prepared TO call
    SuppressExternalCodecs is int     // False unless you want GDI+ only TO Use
END

gnToTheRight, gnFrame are int //  To store SetImage static values

gsIMAGE_FullPathName is string = CompleteDir(fExeDir()) + "GoldFish.png"
gnFRAME_SizeX is int = 84 // Must match the animation frame width
gnFRAME_SizeY is int = 84 // Must match the animation frame height
gnFRAME_Count is int = 20 // The frame number
gnUSE_StepX   is int = 3  // X step value in pixel
gnUSE_StepY   is int = 1  // Y step value in pixel

LOCAL
IF LoadDLL(GDIMAGE) THEN

    // The WinMain section
   
    nRet, x, y are int
    wc is WNDCLASSEXA
    zClass is string ASCIIZ on 16 = "ZANIMATION"
    wcStyle is int = CS_HREDRAW + CS_VREDRAW
    IsInitialized is int = API(USER32, "GetClassInfoExA", Instance, &zClass, &wc)
    IF IsInitialized = 0 THEN
        wc:cbSize        = Dimension(wc)
        wc:style         = wcStyle
        wc:lpfnWndProc   = &WndProc
        wc:cbClsExtra    = 0
        wc:cbWndExtra    = 0 // Extend_cbWndExtra * 4
        wc:hInstance     = Instance
        wc:hIcon         = API(USER32, "LoadImageA", Null, "GoldFish.ico", 1, 0, 0, 0x00000010 + 0x00000040)
        wc:hCursor       = API(USER32, "LoadCursorA", Null, IDC_ARROW)
        wc:hbrBackground = Null
        wc:lpszMenuName  = Null
        wc:lpszClassName = &zClass
        wc:hIconSm       = Null
        IF API(USER32, "RegisterClassExA", &wc) THEN IsInitialized = True
    END
   
    IF IsInitialized THEN
        x = Max((API(USER32, "GetSystemMetrics", SM_CXSCREEN) - gnFRAME_SizeX) / 2, 0)
        y = Max((API(USER32, "GetSystemMetrics", SM_CYSCREEN) - gnFRAME_SizeY) / 2, 0)
       
        hMain is int = API(USER32, "CreateWindowExA", ...
        WS_EX_LAYERED, ...              // SDK extended style
        zClass, ...                     // Set this one to your default path name
        "GoldFish", ...                 // Caption
        WS_POPUP + WS_EX_TOPMOST, ...   // SDK style
        x, ...                          // X location
        y, ...                          // Y location
        gnFRAME_SizeX, ...              // Control width
        gnFRAME_SizeY, ...              // Control height
        Null, ...                       // Parent handle
        0, ...                          // Control ID
        Instance, ...                   // Instance
        0)
       
        IF hMain THEN
           
            Msg is TagMSG
            SetImage(hMain, gsIMAGE_FullPathName, 255)
            API(USER32,"ShowWindow", hMain, SW_SHOW)
           
            IF gnFRAME_Count > 1 THEN API(USER32, "SetTimer", hMain, 1, 50, Null)
            WHILE API(USER32, "GetMessageA", &Msg, Null, 0, 0)
                API(USER32, "TranslateMessage", &Msg)
                API(USER32, "DispatchMessageA", &Msg)
            END
            IF gnFRAME_Count > 1 THEN API(USER32,"KillTimer", hMain, 1)
           
            nRet = Msg:wParam       
           
        END
       
    END
   
END
Title: Re: Opinions about ADW Modula
Post by: Charles Pegge on July 19, 2013, 10:42:43 AM
Pascal was an antidote to the unstructured languages of the 60s and 70s. I think most contemporary languages have assimilated Pascal structure and modularity concepts.
Title: Re: Opinions about ADW Modula
Post by: Theo Gottwald on July 22, 2013, 08:20:00 AM
MY current standpoint is that even if PowerBasic would not be improved anymore, that the current compiler together with all the fine things we have here from Jose etc. are all I need for most tasks.
If it comes to x64 then i have to think about what to do, and currently i use PureBasic as it seems to work and i already mastered some of the obstacles it has.
WINDEV would definitely be worth learning, but anytime when i think "now i have the money to buy it", i get a taxes Bill from Angela Merkel (who has to pay rich american banks and their owners with my money).
Title: Re: Opinions about ADW Modula
Post by: John Spikowski on July 22, 2013, 09:49:54 AM
QuoteWINDEV would definitely be worth learning, but anytime when i think "now i have the money to buy it"

(http://www.windev.com/img/home/Splash_WDExpress.gif) (http://www.windev.com/windev/WD-Express.htm)

[Added for completeness TG]
QuoteReminder: WinDev Express is a "limited" version of WinDev. This version enables you to discover the main features of WinDev.
To check all the features of WinDev, some examples of "WinDev commercial version" are supplied with this trial version.
Main limitations of the Express version
The performance of the applications developed with the Express version as well as some processes of the editors may be slowed down.
Some objects handled by WinDev Express are prefixed by "EXPRESS".
A project created with "WinDev commercial version" cannot be opened by WinDev Express.
A project or an element created with WinDev Express can be opened by "WinDev commercial version". To use the project (or the elements) of the Express version without inopportune messages, the project (or the elements) must be saved in "WinDev commercial version". For the project, an upgrade of the project may also be required ("Project .. Other .. Upgrade the project").
WinDev Express does not allow you to import the projects developed with the earlier versions.
The Source Code Manager (SCM), used to share and manage the resources (source code, windows, reports, ... ) is not available.
WinDev Express cannot be used in network by several developers. Only a single-computer use is allowed.
Note: A project created with an earlier Express version (WinDev 15 Express for example) can be opened and handled by WinDev Express.

Limitations of the Express version (http://www.windev.com/windev/windev-express/limitations.htm)
Title: Re: Opinions about ADW Modula
Post by: Laurence Jackson on July 22, 2013, 02:53:51 PM
Quote from: Charles Pegge on July 19, 2013, 10:42:43 AM
Pascal was an antidote to the unstructured languages of the 60s and 70s. I think most contemporary languages have assimilated Pascal structure and modularity concepts.
Very well put.
Title: Re: Opinions about ADW Modula
Post by: Richard Koch on August 03, 2013, 11:44:58 PM
modual allows generic and oop - and all of that is better then anything that PB has to offer. i hope i don't sound to pessimistic on PB, but i gave up on it. i think, that currently there are only two choices in this order x86/x64:

1.) modula -> mature and proven, excellent small code - realy fast, true fast debugger, huge code libray with anything one would like to have - crypt ..., oop, generics, easy to convert code, minimal number of keywords ..
2.) the dlanguage - all of the above and plenty more, but not mature! maybe in a year due to bad optimization, win integration ...
Title: Re: Opinions about ADW Modula
Post by: Theo Gottwald on August 04, 2013, 11:23:32 AM
Richard, what do you think about Jose's comment:

Quotehere are only 50 Windows API files translated and very outdated. There is no way of use the latest technologies without doing an awful ton of previous work.

Why is that API stuff there so outdated?
Title: Re: Opinions about ADW Modula
Post by: Richard Koch on August 05, 2013, 11:41:50 AM
i guess thats correct. i use - only when i need - with little work translated free pascal win header files.

Example:


Freepascal:
function SetFilePointer(hFile:HANDLE; lDistanceToMove:LONG; lpDistanceToMoveHigh:PLONG; dwMoveMethod:DWORD):DWORD; external 'kernel32' name 'SetFilePointer';

Modula.
PROCEDURE SetFilePointer(hFile : HANDLE;
                         lDistanceToMove : LONG;
                         lpDistanceToMoveHigh : PLONG;
                         dwMoveMethod : DWORD) : DWORD;



But i don't need windows gui to much, so i don't care. the \ADW Software Modula-2\advapidef has windows etc. header for portability to apple and i use those mostly (see http://modula2.awiedemann.de/). its the rest of the language, its modules, oop and generics is what i care for.
when you look at the \ADW Software Modula-2\examples directory, you find all the easy demos to make dlls etc, and the module def's and mod's show how to change and add win headers.
i attach a module, no cleaned up though, to have graphic in pascal/bgi style.
sorry forgot to mention that there is coco (parser generator) that need and miss for pb etc.
Title: Re: Opinions about ADW Modula
Post by: Richard Koch on August 05, 2013, 11:48:59 AM
there is one alternative other language that i kind of use sometimes (x86/x64 compiler):
dlanguage - http://dlang.org/
but it suck when it comes to windows etc., but it is VS integratable (http://wiki.dlang.org/Open_Source_Projects). if modula is nothering for some people, maybe they like this.
Title: Re: Opinions about ADW Modula
Post by: Richard Koch on August 07, 2013, 01:16:05 PM
As information:

Version 2.74 - August 2, 2013

    Corrected ResEdit
    Added Unicode support to library
    Correction in debugger when using Generic modules
    Correction of usage of arrays in Generic modules
    WinShell.mod: multiple corrections
    64-bit code generation when using DIV and MOD on 8-bit values

Download ADWm2.74.zip  http://www.modula2.org/adwm2/ADWm2.74.zip
Title: Re: Opinions about ADW Modula
Post by: Theo Gottwald on August 07, 2013, 08:03:52 PM
Richard, where can i find the first steps - NOT on Mosula, but on HOW to use the IDE, and just the "HOW TO".
Just how to compile "Hello world" and make a EXE file out of it.
I could not find that nowhere.
Title: Re: Opinions about ADW Modula
Post by: Richard Koch on August 08, 2013, 08:19:01 AM
the help file of the compiler content and index -> then select what you like to know. on the language etc consult http://www.modula2.org/.

Title: Re: Opinions about ADW Modula
Post by: Theo Gottwald on August 08, 2013, 10:19:52 AM
Ok, the compiler Help-File.
Its a bit short on explaining the concept but possibly all things needed are there.
Where did you learn it?
Title: Re: Opinions about ADW Modula
Post by: Richard Koch on August 08, 2013, 01:39:29 PM
this may sound stupid, but i read the help, tried the examples and started to write then my own modules. I am sure you did that with pb too.
Title: Re: Opinions about ADW Modula
Post by: Theo Gottwald on August 08, 2013, 07:03:21 PM
I started with PB ... was it 3 or 5 .. its so long ago.
At that time i just wrote the program - and pressed compile.
And the result worked.
Thinking back it seemed to be sooo easy ....
Title: Re: Opinions about ADW Modula
Post by: Richard Koch on August 09, 2013, 07:35:58 AM
yes i believe that. this is easy too and i thought the same way with modula. i think the hardest part is, that the thinking compared to PB is different. But when you compare it to PureB, then modula has a clear cut syntax, where as with PureB the syntax is ugly as hell. The Mod. compiler being a long, long time in the field has a minimum of bugs. you can see that easily on the update times they have. but also you should consider, that there are real, sold and serious programs made with modula and with PureB???
Title: Re: Opinions about ADW Modula
Post by: Theo Gottwald on August 09, 2013, 08:56:03 AM
I trust you on that Richard.
Actually if i have something to do - of course i still use PB because i know how to do it.
I'll have to take time and go through the help and see how to make things in Modula.
How do you make GUI's?
Is there a visual Designer available somewhere?
I understood it right, that Modula can really mak x64 DLL's and EXE's?
Title: Re: Opinions about ADW Modula
Post by: Richard Koch on August 09, 2013, 12:59:55 PM
The compiler will make 32/64 bit dll's and exe's, but i don't use 32 bit anymore - nobody wants it.
You can debug 32/64 bit dll's and exe's.
Unfortunately there is no gui builder, but thats not so bad. it is easy to use \ADW Software Modula-2\advapidef to make one. There is also FormEditUI which is very handy to use.