Skip to content

Latest commit

 

History

History
241 lines (208 loc) · 9.65 KB

README.md

File metadata and controls

241 lines (208 loc) · 9.65 KB

ADW Modula-2 Examples

Modula-2 project Directory adw-examples\ contains Modula-2 code examples coming from the ADW Modula-2 distribution.

Clock Example

This project has the following directory structure :

> tree /f /a . | findstr /v /b [A-Z]
|   build.bat
|   build.sh
|   Makefile
\---src
    \---main
        \---mod
                Clock.mod

Command build.bat-verbose clean run generated and executes :

> build -verbose clean run
Delete directory "target"
Compile "F:\adw-examples\Clock\target\mod\Clock.MOD" into directory "target\mod"
Modula-2, AMD64. Build ADW 1.6.879
Copyright (c) 2009 by ADW Software

Tokenizing
Reading (.SYM) files
Parsing imported (.SYM) files
Procedure    MAKEINTATOM
Procedure    GlobalDiscard
Procedure    LocalDiscard
Procedure    MAKELANGID
Procedure    PRIMARYLANGID
Procedure    SUBLANGID
Procedure    MAKELCID
Procedure    LANGIDFROMLCID
Procedure    SORTIDFROMLCID
Procedure    ProcThreadAttributeValue
Procedure    PROC_THREAD_ATTRIBUTE_PARENT_PROCESS
Procedure    PROC_THREAD_ATTRIBUTE_HANDLE_LIST
Procedure    PROC_THREAD_ATTRIBUTE_GROUP_AFFINITY
Procedure    PROC_THREAD_ATTRIBUTE_PREFERRED_NODE
Procedure    PROC_THREAD_ATTRIBUTE_IDEAL_PROCESSOR
Procedure    PROC_THREAD_ATTRIBUTE_UMS_THREAD
Procedure    PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY
Procedure    PROC_THREAD_ATTRIBUTE_SECURITY_CAPABILITIES
Procedure    PROC_THREAD_ATTRIBUTE_PROTECTION_LEVEL
[...]
Procedure    WM_ACTIVATE_STATE
Procedure    WM_ACTIVATE_FMINIMIZED
Procedure    WM_ACTIVATE_HWND
Procedure    WM_CHARTOITEM_CHAR
Procedure    WM_CHARTOITEM_CHARW
Procedure    WM_CHARTOITEM_POS
Procedure    WM_CHARTOITEM_HWND
Procedure    WM_COMMAND_ID
Procedure    WM_COMMAND_HWND
Procedure    WM_COMMAND_CMD
[...]]
Procedure    GetTime
Procedure    HourHandPos
Procedure    VertEquiv
Procedure    HorzEquiv
Procedure    CreateTools
Procedure    DeleteTools
Procedure    ClockCreate
Procedure    CircleClock
Procedure    ClockSize
Procedure    DrawFace
Procedure    DrawHand
Procedure    DrawFatHand
Procedure    ClockPaint
Procedure    ClockTimer
Procedure    AboutProc
Procedure    ClockWndProc
Procedure    ClockInit
Main body
Compile memory: 3840
Compile time: 139
Execute ADW linker
Linker. Build ADW 1.6.879
Copyright (C) 2009, by ADW Software

Time = 12
Memory = 1616k

> tree /a /f target | findstr /v /b [A-Z]
|   Clock.exe
|   Clock.map
|   linker_opts.txt
+---mod
|       Clock.MOD
|       Clock.obj
\---sym
        AES.sym
        [...]
        WIN32.sym
        WINUSER.sym
        WINVER.sym
        WINX.sym

EstimatePi Example

This project has the following directory structure :

> tree /f /a . | findstr /v /b [A-Z]
|   build.bat
|   build.sh
|   Makefile
\---src
    \---main
        +---def
        |       Rand.def
        \---mod
                EstimatePi.mod
                Rand.mod

Command build.bat-verbose clean run generates and executes the Modula-2 program target\EstimatePi.exe :

> build -verbose clean run
Compile "P:\adw-examples\EstimatePi\target\def\Rand.def" into directory "target\def"
Compile "P:\adw-examples\EstimatePi\target\mod\Rand.mod" into directory "target\mod"
Compile "P:\adw-examples\EstimatePi\target\mod\EstimatePi.mod" into directory "target\mod"
Execute ADW linker
Execute program "target\EstimatePi.exe"
PI by Monte Carlo simulation = 3.14332
PI true value                = 3.14159

RealSpeedTest Example

This project has the following directory structure :

> tree /f /a . | findstr /v /b [A-Z]
|   build.bat
|   build.sh
|   Makefile
\---src
    \---main
        \---mod
                RealSpeedTest.mod

Command build.bat-verbose clean run generates and executes the Modula-2 program target\RealSpeedTest.exe :

> build -verbose clean run
Delete directory "target"
Compile "P:\adw-examples\RealSpeedTest\target\mod\RealSpeedTest.mod" into directory "target\mod"
Execute ADW linker
Execute program "target\RealSpeedTest.exe"
REAL     :   156
LONGREAL :   141

Whetstone_benchmark Example

This project has the following directory structure :

> tree /f /a . | findstr /v /b [A-Z]
|   build.bat
|   build.sh
|   Makefile
\---src
    \---main
        \---mod
                Whetstone.mod

Command build.bat-verbose clean run generates and executes the Modula-2 program target\Whetstone.exe :

> build -verbose clean run
Delete directory "target"
Compile "P:\adw-examples\Whetstone_benchmark\target\mod\Whetstone.mod" into directory "target\mod"
Execute ADW linker
Execute program "target\Whetstone.exe"
LOOP   TIME  ITER
# 1   0.000    20     0     0    -0.067    -0.466    -0.733    -1.132
# 2   0.017   120     0     0    -0.068    -0.463    -0.730    -1.124
# 3   0.048   140     0     0    -0.055    -0.447    -0.711    -1.103
# 4   0.006  3450     1     1     0.000     0.000     0.000     0.000
# 6   0.044  2100     1     2     6.000     6.000    -0.711    -1.103
# 7   0.387   320     0     0     0.490     0.490     0.490     0.490
# 8   0.000  8990     0     0     1.000     1.000     1.000     1.000
# 9   0.025  6160     1     2     3.000     2.000     3.000    -1.103
#10   0.000     0     2     3     0.000     0.000     0.000     0.000
#11   0.266   930     0     0     0.835     0.835     0.835     0.835
      0.854

Whetstone KIPS  0
Whetstone MIPS   Infinite
 
Press any key to exit

mics/January 2025